Skip to Content
Welcome to Vyno! 🍷

.set()

立即设置属性,无动画过渡。

函数签名

set(props: PixiProperty): Figure

基础用法

// 立即设置位置 figure.set({ x: 500, y: 200 }); // 立即设置透明度 figure.set({ alpha: 0.5 }); // 立即设置多个属性 figure.set({ x: 500, y: 200, scaleX: 1.5, scaleY: 1.5, });

与 .to() 的区别

方法效果
.set()立即设置,无过渡
.to()平滑过渡动画
// 立即设置 figure.set({ x: 500 }); // 动画过渡 figure.to({ x: 500 }, { duration: 1 });

链式调用

figure.set({ x: 500 }).speak`我移动了`;
Last updated on