vanilladocs
vanillapunch.com
API / misc/indicator

misc/indicator

인디케이터 클래스.

Indicator class.

Indicatorextends Object

짝Counterpart: vanilla-engine Indicator

인디케이터 클래스.

Indicator class.

예제Example씬 위에 도는 톱니 그리기Draw a spinning gear over a scene
import { Engine, EngineConfiguration, Scene, Indicator, Vector2 } from "./build/vanilla.js";

const indicator = new Indicator();
indicator.setPosition(640, 360);
indicator.setRadius(32);
indicator.setColor("#ffd34dff");
indicator.setSpeed(Math.PI);

class IndicatorScene extends Scene {
	tick(timeDelta) {
		super.tick(timeDelta);
		indicator.tick(timeDelta);
	}

	draw(graphic) {
		super.draw(graphic);
		indicator.draw(graphic);
	}
}

const engineConfiguration = new EngineConfiguration();
engineConfiguration.referenceResolutionSize = Vector2.create(1280, 720);
const engine = new Engine(engineConfiguration);
engine.run(new IndicatorScene());
생성자constructorconstructor()#0.0.9 부터since 0.0.9소스source

생성.

Constructor.

짝Counterpart: vanilla-engine Indicator.new

메서드methodtick(timeDelta)#0.0.9 부터since 0.0.9소스source

갱신.

Update.

timeDeltanumber
지난 프레임부터의 시간. (초, 숨겨져 있으면 돌지 않는다)Time since the last frame. (seconds, does not spin while hidden)

짝Counterpart: vanilla-engine Indicator.tick

메서드methoddraw(graphic)#0.0.9 부터since 0.0.9소스source

출력.

Draw.

graphicGraphic
그릴 그래픽. (숨겨져 있으면 그리지 않는다)Graphic to draw on. (draws nothing while hidden)

짝Counterpart: vanilla-engine Indicator.draw

메서드methodbuildTeethSegments()#0.4.0 부터since 0.4.0소스source

톱니 선분 목록 반환. (회전 전 중심 기준, [시작, 끝] 의 목록)

Returns the list of gear tooth segments. (relative to the center before rotation, a list of [start, end])

반환ReturnsVector2[][] 톱니 8 개의 [시작, 끝] 선분 목록.List of [start, end] segments for the 8 teeth.

짝Counterpart: vanilla-engine Indicator.build_teeth_segments

메서드methodsetPosition(x, y)#0.0.9 부터since 0.0.9소스source

위치 설정.

Sets the position.

xnumber
중심 x 좌표.Center x coordinate.
ynumber
중심 y 좌표.Center y coordinate.

짝Counterpart: vanilla-engine Indicator.set_position

메서드methodgetPosition()#0.0.9 부터since 0.0.9소스source

위치 반환.

Returns the position.

반환ReturnsVector2 중심 위치. (복사본이 아니다)Center position. (not a copy)

짝Counterpart: vanilla-engine Indicator.get_position

메서드methodsetRadius(radius)#0.0.9 부터since 0.0.9소스source

크기 설정.

Sets the size.

radiusnumber
톱니 끝까지의 반지름. (1 보다 작으면 1)Radius to the tooth tips. (1 if less than 1)

짝Counterpart: vanilla-engine Indicator.set_radius

메서드methodgetRadius()#0.4.0 부터since 0.4.0소스source

크기 반환.

Returns the volume.

반환Returnsnumber 톱니 끝까지의 반지름.Radius to the tooth tips.

짝Counterpart: vanilla-engine Indicator.get_radius

메서드methodsetColor(color)#0.0.9 부터since 0.0.9소스source

색 설정.

Sets the color.

colorstring | Color
(예: "#ff0000", "rgba(255,255,255,0.8)")(e.g. "#ff0000", "rgba(255,255,255,0.8)")

짝Counterpart: vanilla-engine Indicator.set_color

메서드methodsetSpeed(speedRadiansPerSecond)#0.0.9 부터since 0.0.9소스source

회전 속도 설정.

Sets the rotation speed.

speedRadiansPerSecondnumber
회전 속도. (라디안/초, 음수면 반대로 돈다)Rotation speed. (radians per second, spins the other way if negative)

짝Counterpart: vanilla-engine Indicator.set_speed

메서드methodgetRotation()#0.4.0 부터since 0.4.0소스source

지금 회전 각도 반환. (라디안)

Returns the current rotation angle. (radians)

반환Returnsnumber 지금 회전 각도. (라디안)Current rotation angle. (radians)

짝Counterpart: vanilla-engine Indicator.get_rotation

메서드methodsetVisible(isVisible)#0.0.9 부터since 0.0.9소스source

출력 여부 설정.

Sets whether it is displayed.

isVisibleboolean
보이면 참. (거짓이면 tick 과 draw 가 아무것도 하지 않는다)True if visible. (tick and draw do nothing when false)

짝Counterpart: vanilla-engine Indicator.set_visible

메서드methodgetVisible()#0.0.9 부터since 0.0.9소스source

출력 여부 반환.

Returns whether it is displayed.

반환Returnsboolean 보이면 참.True if visible.

짝Counterpart: vanilla-engine Indicator.get_visible