vanilladocs
vanillapunch.com
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

짝Counterpart: vanilla-engine Pivot

피봇. (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
topLeftVector2.create(0, 0)좌상단. (0, 0)Top left. (0, 0)
topCenterVector2.create(0.5, 0)위 가운데. (0.5, 0)Top center. (0.5, 0)
topRightVector2.create(1, 0)우상단. (1, 0)Top right. (1, 0)
middleLeftVector2.create(0, 0.5)왼쪽 가운데. (0, 0.5)Middle left. (0, 0.5)
middleCenterVector2.create(0.5, 0.5)정가운데. (0.5, 0.5)Middle center. (0.5, 0.5)
middleRightVector2.create(1, 0.5)오른쪽 가운데. (1, 0.5)Middle right. (1, 0.5)
bottomLeftVector2.create(0, 1)좌하단. (0, 1)Bottom left. (0, 1)
bottomCenterVector2.create(0.5, 1)아래 가운데. (0.5, 1)Bottom center. (0.5, 1)
bottomRightVector2.create(1, 1)우하단. (1, 1)Bottom right. (1, 1)