From 68dc0ea64ac860afb5e882dda8bb5d8da6f0a253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Wed, 17 Jul 2024 18:23:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9AGV=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw-ui/src/views/board/model/agv.js | 12 +++++++++--- hw-ui/src/views/board/model/animation.js | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/hw-ui/src/views/board/model/agv.js b/hw-ui/src/views/board/model/agv.js index 29bc5b8..d57d7fd 100644 --- a/hw-ui/src/views/board/model/agv.js +++ b/hw-ui/src/views/board/model/agv.js @@ -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(() => { diff --git a/hw-ui/src/views/board/model/animation.js b/hw-ui/src/views/board/model/animation.js index 45f86cc..30367d7 100644 --- a/hw-ui/src/views/board/model/animation.js +++ b/hw-ui/src/views/board/model/animation.js @@ -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()