.show()
显示角色,可选择性设置初始位置和属性。
函数签名
show(props?: PixiProperty): Figure基础用法
// 使用默认位置显示
figure.show();
// 指定位置和属性
figure.show({
x: 500,
y: 100,
scaleX: 0.5,
scaleY: 0.5,
alpha: 1,
});预设位置
// 定义常用位置
const leftPosition = {
x: 100,
y: 50,
scaleX: 0.4,
scaleY: 0.4,
};
const rightPosition = {
x: 800,
y: 50,
scaleX: 0.4,
scaleY: 0.4,
};
// 使用预设位置
anon.show(leftPosition);
qing.show(rightPosition);多角色同时出场
anon.show(leftPosition);
Game.parallel();
qing.show(rightPosition);PixiProperty 属性
| 属性 | 类型 | 描述 |
|---|---|---|
x | number | X 坐标 |
y | number | Y 坐标 |
scaleX | number | X 缩放 |
scaleY | number | Y 缩放 |
rotation | number | 旋转角度 |
alpha | number | 透明度 (0-1) |
anchorX | number | 锚点 X |
anchorY | number | 锚点 Y |
链式调用
figure.show(position).speak`你好!`;Last updated on