vanilladocs
vanillapunch.com
API / base/pivot

base/pivot

피봇 / 앵커 값.

  • 원본 base/pivot.js 의 Pivot 객체를 연관 상수로 옮겼다.

Pivot / anchor values.

  • The Pivot object of the original base/pivot.js moved to associated constants.

Pivotstruct

짝Counterpart: vanilla.js Pivot소스source

피봇과 앵커 상수. (내용 크기 안의 비율, (0, 0) 이 왼쪽 위, (1, 1) 이 오른쪽 아래)

Pivot and anchor constants. (ratios within the content size, (0, 0) is the top left, (1, 1) the bottom right)

예제Example노드의 기준점을 아래 가운데로 두기Set a node's pivot to the bottom center
use vanilla::{NodeTree, Pivot, Vector2};

let mut node_tree = NodeTree::new();
let root_id = node_tree.get_root_id();
let icon_id = node_tree.create_child(root_id, "icon");
node_tree[icon_id].set_content_size(Vector2::create(64.0, 64.0));
node_tree[icon_id].set_pivot(Pivot::BOTTOM_CENTER);
assert_eq!(node_tree[icon_id].get_pivot(), Vector2::create(0.5, 1.0));
정적staticpub const TOP_LEFT: Vector2 = Vector2::create(0.0, 0.0)#0.3.2 부터since 0.3.2소스source

왼쪽 위. (0, 0)

Top left. (0, 0)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.topLeft

정적staticpub const TOP_CENTER: Vector2 = Vector2::create(0.5, 0.0)#0.3.2 부터since 0.3.2소스source

위 가운데. (0.5, 0)

Top center. (0.5, 0)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.topCenter

정적staticpub const TOP_RIGHT: Vector2 = Vector2::create(1.0, 0.0)#0.3.2 부터since 0.3.2소스source

오른쪽 위. (1, 0)

Top right. (1, 0)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.topRight

정적staticpub const MIDDLE_LEFT: Vector2 = Vector2::create(0.0, 0.5)#0.3.2 부터since 0.3.2소스source

왼쪽 가운데. (0, 0.5)

Middle left. (0, 0.5)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.middleLeft

정적staticpub const MIDDLE_CENTER: Vector2 = Vector2::create(0.5, 0.5)#0.3.2 부터since 0.3.2소스source

정가운데. (0.5, 0.5)

Middle center. (0.5, 0.5)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.middleCenter

정적staticpub const MIDDLE_RIGHT: Vector2 = Vector2::create(1.0, 0.5)#0.3.2 부터since 0.3.2소스source

오른쪽 가운데. (1, 0.5)

Middle right. (1, 0.5)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.middleRight

정적staticpub const BOTTOM_LEFT: Vector2 = Vector2::create(0.0, 1.0)#0.3.2 부터since 0.3.2소스source

왼쪽 아래. (0, 1)

Bottom left. (0, 1)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.bottomLeft

정적staticpub const BOTTOM_CENTER: Vector2 = Vector2::create(0.5, 1.0)#0.3.2 부터since 0.3.2소스source

아래 가운데. (0.5, 1)

Bottom center. (0.5, 1)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.bottomCenter

정적staticpub const BOTTOM_RIGHT: Vector2 = Vector2::create(1.0, 1.0)#0.3.2 부터since 0.3.2소스source

오른쪽 아래. (1, 1)

Bottom right. (1, 1)

반환ReturnsVector2

짝Counterpart: vanilla.js Pivot.bottomRight