修改AGV动画

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

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

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

Loading…
Cancel
Save