misc/indicator
인디케이터 클래스.
Indicator class.
Indicatorextends Object
인디케이터 클래스.
Indicator class.
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());갱신.
Update.
- timeDeltanumber
- 지난 프레임부터의 시간. (초, 숨겨져 있으면 돌지 않는다)Time since the last frame. (seconds, does not spin while hidden)
짝Counterpart: vanilla-engine Indicator.tick
출력.
Draw.
- graphicGraphic
- 그릴 그래픽. (숨겨져 있으면 그리지 않는다)Graphic to draw on. (draws nothing while hidden)
짝Counterpart: vanilla-engine Indicator.draw
톱니 선분 목록 반환. (회전 전 중심 기준, [시작, 끝] 의 목록)
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
위치 설정.
Sets the position.
- xnumber
- 중심 x 좌표.Center x coordinate.
- ynumber
- 중심 y 좌표.Center y coordinate.
짝Counterpart: vanilla-engine Indicator.set_position
위치 반환.
Returns the position.
반환ReturnsVector2 중심 위치. (복사본이 아니다)Center position. (not a copy)
짝Counterpart: vanilla-engine Indicator.get_position
크기 설정.
Sets the size.
- radiusnumber
- 톱니 끝까지의 반지름. (1 보다 작으면 1)Radius to the tooth tips. (1 if less than 1)
짝Counterpart: vanilla-engine Indicator.set_radius
크기 반환.
Returns the volume.
반환Returnsnumber 톱니 끝까지의 반지름.Radius to the tooth tips.
짝Counterpart: vanilla-engine Indicator.get_radius
색 설정.
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
회전 속도 설정.
Sets the rotation speed.
- speedRadiansPerSecondnumber
- 회전 속도. (라디안/초, 음수면 반대로 돈다)Rotation speed. (radians per second, spins the other way if negative)
짝Counterpart: vanilla-engine Indicator.set_speed
지금 회전 각도 반환. (라디안)
Returns the current rotation angle. (radians)
반환Returnsnumber 지금 회전 각도. (라디안)Current rotation angle. (radians)
짝Counterpart: vanilla-engine Indicator.get_rotation
출력 여부 설정.
Sets whether it is displayed.
- isVisibleboolean
- 보이면 참. (거짓이면 tick 과 draw 가 아무것도 하지 않는다)True if visible. (tick and draw do nothing when false)
짝Counterpart: vanilla-engine Indicator.set_visible
출력 여부 반환.
Returns whether it is displayed.
반환Returnsboolean 보이면 참.True if visible.
짝Counterpart: vanilla-engine Indicator.get_visible