Lv.1
每天和编程猫喵喵叫的杰瑞鼠
在 最远的距离 中回复
imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E6%90%93%E5%A4%B4.gif"alt="emotion_编程猫_搓头"
2022-05-08T15:28:57 点赞:0
在 我想要代码大全 中回复
//旋转动画
async function loopRotateEntityZ(entityName, time = 30, angle = -Math.PI / 36) { //loopRotateEntity=90度类型
const entity = world.querySelector(`#${entityName}`)
while (1) {
await sleep(time)//数越小越快
entity.meshOrientation = entity.meshOrientation.rotateZ(angle)//PI=180度
}
}
async function loopRotateEntityX(entityName, time = 30, angle = -Math.PI / 36) { //loopRotateEntity=90度类型
const entity = world.querySelector(`#${entityName}`)
while (1) {
await sleep(time)//数越小越快
entity.meshOrientation = entity.meshOrientation.rotateZ(angle)//PI=180度
}
}
world.querySelectorAll('*').forEach(e => {
if (e.id.startsWith('模型名')) {
loopRotateEntityX(e.id, 30, Math.PI / 36)
}
}
这是我的旋转动画代码
2022-09-12T14:23:23 点赞:0