API / base/pivot
base/pivot
피봇. (2D 좌표계를 기준으로 좌상(0,0) ~ 우하(1,1)을 기준으로 삼는다.)
Pivot. (In the 2D coordinate system, uses top-left (0,0) ~ bottom-right (1,1) as the reference.)
예제Example노드의 기준점을 아래 가운데로 두기Set a node's pivot to the bottom center
import { WorldNode, Pivot, Vector2 } from "./build/vanilla.js";
const iconNode = new WorldNode();
const iconSize = Vector2.create(64, 64);
iconNode.setContentSize(iconSize);
iconNode.setPivot(Pivot.bottomCenter);
const pivot = iconNode.getPivot();
console.log(pivot.x, pivot.y);Pivotenum
피봇. (2D 좌표계를 기준으로 좌상(0,0) ~ 우하(1,1)을 기준으로 삼는다.)
Pivot. (In the 2D coordinate system, uses top-left (0,0) ~ bottom-right (1,1) as the reference.)
| 이름Name | 값Value | 설명Description |
|---|---|---|
topLeft | Vector2.create(0, 0) | 좌상단. (0, 0)Top left. (0, 0) |
topCenter | Vector2.create(0.5, 0) | 위 가운데. (0.5, 0)Top center. (0.5, 0) |
topRight | Vector2.create(1, 0) | 우상단. (1, 0)Top right. (1, 0) |
middleLeft | Vector2.create(0, 0.5) | 왼쪽 가운데. (0, 0.5)Middle left. (0, 0.5) |
middleCenter | Vector2.create(0.5, 0.5) | 정가운데. (0.5, 0.5)Middle center. (0.5, 0.5) |
middleRight | Vector2.create(1, 0.5) | 오른쪽 가운데. (1, 0.5)Middle right. (1, 0.5) |
bottomLeft | Vector2.create(0, 1) | 좌하단. (0, 1)Bottom left. (0, 1) |
bottomCenter | Vector2.create(0.5, 1) | 아래 가운데. (0.5, 1)Bottom center. (0.5, 1) |
bottomRight | Vector2.create(1, 1) | 우하단. (1, 1)Bottom right. (1, 1) |