修改AGV动画

master
夜笙歌 4 months ago
parent e5bbeb7ac4
commit 68dc0ea64a

@ -275,12 +275,14 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => {
resolve()
}
let distance = location - agvData[AGVLocationData].x
const tween = new TWEEN.Tween(agvData[group].position)
let tween = new TWEEN.Tween(agvData[group].position)
.to({ x: location }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1)持续1000毫秒
.onComplete(() => {
agvData[group].position.x = location
agvData[AGVLocationData].x = location
resolve()
tween.stop()
tween = null
})
.start() // 立即开始动画
// let time1 = setInterval(() => {
@ -332,12 +334,14 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => {
}
let distance = location - agvData[AGVLocationData].z
const tween = new TWEEN.Tween(agvData[group].position)
let tween = new TWEEN.Tween(agvData[group].position)
.to({ z: location }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1)持续1000毫秒
.onComplete(() => {
agvData[group].position.z = location
agvData[AGVLocationData].z = location
resolve()
tween.stop()
tween = null
})
.start()
// let time1 = setInterval(() => {
@ -388,11 +392,13 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => {
let endRotateNum = nowRotateNum + (distance * (Math.PI / 180))
let bool = (nowRotateNum - endRotateNum) > 0
const tween = new TWEEN.Tween(agvData[group].rotation)
let tween = new TWEEN.Tween(agvData[group].rotation)
.to({ y: newLocation * (Math.PI / 180) }, 500) // 移动到(1, 1, 1)持续1000毫秒
.onComplete(() => {
agvData[group].rotation.y = (newLocation * (Math.PI / 180))
resolve()
tween.stop()
tween = null
})
.start()
// let time1 = setInterval(() => {

@ -20,12 +20,14 @@ const tishengjiAnimation = (model, floor, newLocation = 0, time = 2000) => {
}
let distance = newLocation - tishengjiLocation.y
const tween = new TWEEN.Tween(model.position)
let tween = new TWEEN.Tween(model.position)
.to({ y: newLocation }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1)持续1000毫秒
.onComplete(() => {
model.position.y = newLocation
tishengjiLocation.y = newLocation
resolve()
tween.stop()
tween = null
})
.start()
@ -60,12 +62,14 @@ const tuopanXAnimation = (model, newLocation = 0, time = 2000) => {
tuopanInishengji = newLocation === 0
let distance = newLocation - tuopanLocation.x
const tween = new TWEEN.Tween(model.position)
let tween = new TWEEN.Tween(model.position)
.to({ x: newLocation }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1)持续1000毫秒
.onComplete(() => {
model.position.x = newLocation
tuopanLocation.x = newLocation
resolve()
tween.stop()
tween = null
})
.start()
@ -99,12 +103,14 @@ const tuopanYAnimation = (model, floor, newLocation = 0, time = 2000) => {
resolve()
}
let distance = newLocation - tuopanLocation.y
const tween = new TWEEN.Tween(model.position)
let tween = new TWEEN.Tween(model.position)
.to({ y: newLocation }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1)持续1000毫秒
.onComplete(() => {
model.position.y = newLocation
tuopanLocation.y = newLocation
resolve()
tween.stop()
tween = null
})
.start()

Loading…
Cancel
Save