core/component/outline
테만 그리는 컴포넌트. (둥근 네모 테 또는 동그라미 테)
Component that draws only a border. (rounded rectangle border or circle border)
Outlineextends Component
테만 그리는 컴포넌트. (둥근 네모 테 또는 동그라미 테)
- Paint 는 속을 채우기만 하므로, 비치는 판 위에 테를 따로 얹을 때 쓴다. (채운 판 두 장을 겹치면 비치는 속에 바깥 색이 섞인다)
- 둥근 네모 테는 노드의 내용 크기 그대로, 동그라미 테는 그 가운데에 짧은 변의 반을 반지름으로 그린다.
- 선은 내용 크기 안쪽에 들어온다. (선의 가운데가 굵기의 반만큼 안쪽)
Component that draws only a border. (rounded rectangle border or circle border)
- Paint only fills the inside, so this is used to put a separate border on top of a translucent panel. (stacking two filled panels mixes the outer color into the translucent inside)
- The rounded rectangle border is drawn at the node's content size as is, and the circle border is drawn at its center with half the shorter side as the radius.
- The line stays inside the content size. (the line's center is inset by half the thickness)
import { Engine, EngineConfiguration, Scene, Vector2, WorldNode, Paint, Outline } from "./build/vanilla.js";
class MainScene extends Scene {
async load(engine) {
await super.load(engine);
const root = this.getRoot();
const panelNode = new WorldNode();
panelNode.setContentSize(Vector2.create(240, 140));
panelNode.setLocalPosition(Vector2.create(200, 180));
const paint = panelNode.addComponent(Paint);
paint.setColor("rgba(0, 0, 0, 0.5)");
paint.setRoundSize(20);
const outline = panelNode.addComponent(Outline);
outline.setColor("#ffffff");
outline.setLineWidth(4);
outline.setRoundSize(20);
root.addChild(panelNode);
const ringNode = new WorldNode();
ringNode.setContentSize(Vector2.create(100, 100));
ringNode.setLocalPosition(Vector2.create(480, 180));
const ring = ringNode.addComponent(Outline);
ring.setColor("#ffcc00");
ring.setLineWidth(6);
ring.setCircle(true);
root.addChild(ringNode);
}
}
const engineConfiguration = new EngineConfiguration();
engineConfiguration.referenceResolutionSize = Vector2.create(640, 360);
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());내용 영역 안에서만 그리는지 반환. (선은 내용 크기 안쪽으로 굵기의 반만큼 들여 그린다)
- draw 를 덮어쓴 하위 클래스는 어디에 그리는지 모르므로 false.
Returns whether it draws only inside the content area. (the line is drawn inset inside the content size by half the thickness)
- false for subclasses that override draw, since where they draw is unknown.
반환Returnsboolean 내용 영역 안에서만 그리면 참.True if drawing only inside the content area.
색상 설정.
Sets the color.
- otherColor | string
- 테의 색. (Color 나 "#rrggbb(aa)", "rgb(a)(...)" 글, null 이나 undefined 면 투명, 그 밖의 값은 무시한다)Outline color. (a Color or a "#rrggbb(aa)" or "rgb(a)(...)" string, transparent if null or undefined, other values are ignored)
짝Counterpart: vanilla-engine Outline.set_color
색상 반환.
Returns the color.
반환ReturnsColor 테의 색.Outline color.
짝Counterpart: vanilla-engine Outline.get_color
굵기 설정.
Sets the thickness.
- lineWidthnumber
- 테의 굵기. (내용 크기 단위, 0 이하면 그리지 않는다)Outline width. (content size units, not drawn if 0 or less)
짝Counterpart: vanilla-engine Outline.set_line_width
굵기 반환.
Returns the thickness.
반환Returnsnumber 테의 굵기.Outline width.
짝Counterpart: vanilla-engine Outline.get_line_width
귀퉁이 둥근 정도 설정. (바깥 꼴 기준)
Sets the corner roundness. (based on the outer shape)
- roundSizenumber
- 바깥 꼴의 귀퉁이 반지름. (내용 크기 단위, 동그라미 테면 쓰지 않는다)Corner radius of the outer shape. (content size units, unused for a circle outline)
짝Counterpart: vanilla-engine Outline.set_round_size
귀퉁이 둥근 정도 반환.
Returns the corner roundness.
반환Returnsnumber 바깥 꼴의 귀퉁이 반지름.Corner radius of the outer shape.
짝Counterpart: vanilla-engine Outline.get_round_size
동그라미 테로 그릴지 설정.
Sets whether to draw as a circle border.
- isCircleboolean
- 참이면 동그라미 테, 거짓이면 둥근 네모 테.A circle outline if true, a rounded rectangle outline if false.
짝Counterpart: vanilla-engine Outline.set_circle
동그라미 테인지 반환.
Returns whether it is a circle border.
반환Returnsboolean 동그라미 테면 참.True if it is a circle outline.
짝Counterpart: vanilla-engine Outline.is_circle