用户:
老李头13zl查看:3 回复:1 评论:3 创建时间:2022-11-16T15:42:09
怎么让一个实体在一个范围内移动
名探酱const npc = world.querySelector('#排行榜') //填入实体名称
npc.fixed = true//不受外力影响
npc.collides = true//允许碰撞
const startPos = [1, 11, 17]//起始位置
const endPos = [1, 12, 17]//终止位置
const ani = npc.animate([//
{ position: startPos, duration: 1 },// 1/12 的时间停留
{ position: startPos, duration: 5 },// 5/12 的时间用于移动
{ position: endPos, duration: 1 },// 1/12 的时间停留
{ position: endPos, duration: 5 },// 5/12 的时间回去
], {
duration: 12 * 2.5, //播放一个循环共用时2.5秒,
iterations: Infinity,//动画无限循环播放
direction: Box3AnimationDirection.WRAP,//让动画实体从终点回到起点
})
//备注:吉吉API教程的电梯模板改的点赞0
评论