diff --git a/hw-ui/src/views/board/model/agv.js b/hw-ui/src/views/board/model/agv.js index 640ae23..29bc5b8 100644 --- a/hw-ui/src/views/board/model/agv.js +++ b/hw-ui/src/views/board/model/agv.js @@ -6,18 +6,32 @@ import * as TWEEN from '@tweenjs/tween.js' let timeOrSpeed = true -let isAGVAnimation = false -let AGVanimationLine = [] +let isAGVAnimation = { + '2AGV': false, + '3AGV': false, + '5CCAGV': false, + '5BFAGV': false, + '5CTU': false +} +let AGVanimationLine = { + '2AGV': [], + '3AGV': [], + '5CCAGV': [], + '5BFAGV': [], + '5CTU': [] +} + +let animationEnum = ['2AGV', '3AGV', '5CCAGV', '5BFAGV', '5CTU'] -const AGVanimation = async() => { +const AGVanimation = async(e) => { try { - if (AGVanimationLine.length > 0) { - await AGVanimationLine[0]() - AGVanimationLine.shift() - if (AGVanimationLine.length > 0) { - AGVanimation(AGVanimationLine) + if (AGVanimationLine[e].length > 0) { + await AGVanimationLine[e][0]() + AGVanimationLine[e].shift() + if (AGVanimationLine[e].length > 0) { + AGVanimation(e) } else { - isAGVAnimation = false + isAGVAnimation[e] = false } } } catch (e) { @@ -26,14 +40,13 @@ const AGVanimation = async() => { } function AGVanimate() { - if (AGVanimationLine.length > 0 && isAGVAnimation === false) { - isAGVAnimation = true - AGVanimation(AGVanimationLine) - } + animationEnum.forEach(e => { + if (AGVanimationLine[e].length > 0 && isAGVAnimation[e] === false) { + isAGVAnimation[e] = true + AGVanimation(e) + } + }) requestAnimationFrame(AGVanimate) - TWEEN.update() - renderer.render(scene, camera) - labelRenderer.render(scene, camera) } AGVanimate() @@ -62,6 +75,7 @@ let agvData = { rotate: 0 }, floor2AGVGroupLocation: {}, + floor3AGVGroup: null, floor3AGV: null, floor3AGVData: { @@ -70,6 +84,7 @@ let agvData = { rotate: 0 }, floor3AGVGroupLocation: {}, + floor5CCAGVGroup: null, floor5CCAGV: null, floor5CCAGVGroupLocation: {}, @@ -78,6 +93,7 @@ let agvData = { y: 0, rotate: 0 }, + floor5BFAGVGroup: null, floor5BFAGV: null, floor5BFAGVGroupLocation: {}, @@ -86,6 +102,7 @@ let agvData = { y: 0, rotate: 0 }, + floor5CTUGroup: null, floor5CTU: null, floor5CTUGroupLocation: {}, @@ -93,7 +110,7 @@ let agvData = { x: 0, y: 0, rotate: 0 - }, + } } let loadAGVEnum = { @@ -101,46 +118,49 @@ let loadAGVEnum = { 'chacheshiAGV005': 'floor5CCAGV', 'CTU005': 'floor5CTU', 'chacheshiAGV002': 'floor2AGV', - 'chacheshiAGV003': 'floor3AGV', + 'chacheshiAGV003': 'floor3AGV' } let loadAGVGroupEnum = { 'beifushiAGV005': 'floor5BFAGVGroup', 'chacheshiAGV005': 'floor5CCAGVGroup', 'CTU005': 'floor5CTUGroup', 'chacheshiAGV002': 'floor2AGVGroup', - 'chacheshiAGV003': 'floor3AGVGroup', + 'chacheshiAGV003': 'floor3AGVGroup' } let LoadAGVDataEnum = { 'beifushiAGV005': 'floor5BFAGVData', 'chacheshiAGV005': 'floor5CCAGVData', 'CTU005': 'floor5CTUData', 'chacheshiAGV002': 'floor2AGVData', - 'chacheshiAGV003': 'floor3AGVData', + 'chacheshiAGV003': 'floor3AGVData' } let LoadAGVLocationEnum = { 'beifushiAGV005': 'floor5BFAGVGroupLocation', 'chacheshiAGV005': 'floor5CCAGVGroupLocation', 'CTU005': 'floor5CTUGroupLocation', 'chacheshiAGV002': 'floor2AGVGroupLocation', - 'chacheshiAGV003': 'floor3AGVGroupLocation', + 'chacheshiAGV003': 'floor3AGVGroupLocation' } let axisEnum = { - 'beifushiAGV005':{ - z : 11.6 - }, 'chacheshiAGV002': { - // z : 11.6 + x: 9, + z: 15 }, 'chacheshiAGV003': { - // z : 11.6 + x: 9, + z: 20.5 + }, + 'beifushiAGV005': { + z: 11.6 }, 'chacheshiAGV005': { - // z : 11.6 + x: 9, + z: 22 }, 'CTU005': { - x:-5, - z : -20 - }, + x: -3.5, + z: -20 + } } const loadAGV = (r) => { r.forEach(e => { @@ -164,10 +184,9 @@ const loadAGV = (r) => { axis.applyMatrix4(object.children[0].matrixWorld) agvData[agvGroupName] = new THREE.Group() - console.log(object) agvData[agvGroupName].add(object) let axisDis = axisEnum[e] - Object.keys(axisDis || {}).forEach(v=>{ + Object.keys(axisDis || {}).forEach(v => { axis[v] += axisDis[v] }) agvData[agvGroupName].position.set(axis.x, axis.y, axis.z) @@ -188,36 +207,36 @@ const loadAGV = (r) => { }) }) } -// loadAGV(['chacheshiAGV002','chacheshiAGV003','chacheshiAGV005','beifushiAGV005','CTU005']) -loadAGV(['CTU005']) +loadAGV(['chacheshiAGV002', 'chacheshiAGV003', 'chacheshiAGV005', 'beifushiAGV005', 'CTU005']) +// loadAGV(['chacheshiAGV003']) let AGVGroupEnum = { '5BFAGV': 'floor5BFAGVGroupLocation', '5CCAGV': 'floor5CCAGVGroupLocation', '5CTU': 'floor5CTUGroupLocation', '2AGV': 'floor2AGVGroupLocation', - '3AGV': 'floor3AGVGroupLocation', + '3AGV': 'floor3AGVGroupLocation' } let AGVDataEnum = { '5BFAGV': 'floor5BFAGVData', '5CCAGV': 'floor5CCAGVData', '5CTU': 'floor5CTUData', '2AGV': 'floor2AGVData', - '3AGV': 'floor3AGVData', + '3AGV': 'floor3AGVData' } let groupEnum = { '5BFAGV': 'floor5BFAGVGroup', '5CCAGV': 'floor5CCAGVGroup', '5CTU': 'floor5CTUGroup', '2AGV': 'floor2AGVGroup', - '3AGV': 'floor3AGVGroup', + '3AGV': 'floor3AGVGroup' } let floorEnum = { '5BFAGV': 'floor5Data', '5CCAGV': 'floor5Data', '5CTU': 'floor5Data', '2AGV': 'floor2Data', - '3AGV': 'floor3Data', + '3AGV': 'floor3Data' } let rotateF = (e) => { e %= 360 @@ -233,10 +252,10 @@ let rotateF = (e) => { const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => { let s = 1 newLocation %= 360 - if((item === '2AGV' || item === '3AGV'|| item === '5CCAGV') && type === 'rotate'){ + if ((item === '2AGV' || item === '3AGV' || item === '5CCAGV') && type === 'rotate') { newLocation -= 90 } - if((item === '5CTU' ) && type === 'rotate'){ + if ((item === '5CTU') && type === 'rotate') { newLocation += 90 } let AGVGroupLocationData = AGVGroupEnum[item] @@ -256,41 +275,48 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => { resolve() } let distance = location - agvData[AGVLocationData].x - - let time1 = setInterval(() => { - if ((distance > 0 && agvData[group].position.x >= location) || (distance < 0 && agvData[group].position.x <= location)) { + const 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() - clearInterval(time1) - clearTimeout(time3) - } else { - if (timeOrSpeed) { - if ((agvData[group].position.x - location) < 0) { - agvData[group].position.x += s - } else { - agvData[group].position.x -= s - } - } else { - agvData[group].position.x += distance / (time / 16) - } - - agvData[AGVLocationData].x = agvData[group].position.x - } - }, 16) - let intervalTime - if (timeOrSpeed) { - intervalTime = (distance / ((((agvData[group].position.x - location) < 0) ? 1 : -1) * s) * 16) + 1000 - } else { - intervalTime = time + 1000 - } - let time3 = setTimeout(() => { - agvData[group].position.x = location - agvData[AGVLocationData].x = location - resolve() - clearInterval(time1) - clearTimeout(time3) - }, intervalTime) + }) + .start() // 立即开始动画 + // let time1 = setInterval(() => { + // if ((distance > 0 && agvData[group].position.x >= location) || (distance < 0 && agvData[group].position.x <= location)) { + // agvData[group].position.x = location + // agvData[AGVLocationData].x = location + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // } else { + // if (timeOrSpeed) { + // if ((agvData[group].position.x - location) < 0) { + // agvData[group].position.x += s + // } else { + // agvData[group].position.x -= s + // } + // } else { + // agvData[group].position.x += distance / (time / 16) + // } + // + // agvData[AGVLocationData].x = agvData[group].position.x + // } + // }, 16) + // let intervalTime + // if (timeOrSpeed) { + // intervalTime = (distance / ((((agvData[group].position.x - location) < 0) ? 1 : -1) * s) * 16) + 1000 + // } else { + // intervalTime = time + 1000 + // } + // let time3 = setTimeout(() => { + // agvData[group].position.x = location + // agvData[AGVLocationData].x = location + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // }, intervalTime) }) } case 'z': { @@ -306,41 +332,49 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => { } let distance = location - agvData[AGVLocationData].z - let time1 = setInterval(() => { - if ((distance > 0 && agvData[group].position.z >= location) || (distance < 0 && agvData[group].position.z <= location)) { + const 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() - clearInterval(time1) - clearTimeout(time3) - } else { - - if (timeOrSpeed) { - if ((agvData[group].position.z - location) < 0) { - agvData[group].position.z += s - } else { - agvData[group].position.z -= s - } - } else { - agvData[group].position.z += distance / (time / 16) - } - - agvData[AGVLocationData].z = agvData[group].position.z - } - }, 16) - let intervalTime - if (timeOrSpeed) { - intervalTime = (distance / ((((agvData[group].position.z - location) < 0) ? 1 : -1) * s) * 16) + 1000 - } else { - intervalTime = time + 1000 - } - let time3 = setTimeout(() => { - agvData[group].position.z = location - agvData[AGVLocationData].z = location - resolve() - clearInterval(time1) - clearTimeout(time3) - }, intervalTime) + }) + .start() + // let time1 = setInterval(() => { + // if ((distance > 0 && agvData[group].position.z >= location) || (distance < 0 && agvData[group].position.z <= location)) { + // agvData[group].position.z = location + // agvData[AGVLocationData].z = location + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // } else { + // + // if (timeOrSpeed) { + // if ((agvData[group].position.z - location) < 0) { + // agvData[group].position.z += s + // } else { + // agvData[group].position.z -= s + // } + // } else { + // agvData[group].position.z += distance / (time / 16) + // } + // + // agvData[AGVLocationData].z = agvData[group].position.z + // } + // }, 16) + // let intervalTime + // if (timeOrSpeed) { + // intervalTime = (distance / ((((agvData[group].position.z - location) < 0) ? 1 : -1) * s) * 16) + 1000 + // } else { + // intervalTime = time + 1000 + // } + // let time3 = setTimeout(() => { + // agvData[group].position.z = location + // agvData[AGVLocationData].z = location + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // }, intervalTime) }) } case 'rotate': { @@ -354,23 +388,30 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => { let endRotateNum = nowRotateNum + (distance * (Math.PI / 180)) let bool = (nowRotateNum - endRotateNum) > 0 - let time1 = setInterval(() => { - if ((bool && nowRotateNum < endRotateNum) || (!bool && nowRotateNum > endRotateNum)) { + const 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() - clearInterval(time1) - clearTimeout(time2) - } else { - agvData[group].rotation.y += ((distance / (500 / 16)) * (Math.PI / 180)) - nowRotateNum += ((distance / (500 / 16)) * (Math.PI / 180)) - } - }, 16) - let time2 = setTimeout(() => { - agvData[group].rotation.y = (newLocation * (Math.PI / 180)) - resolve() - clearInterval(time1) - clearTimeout(time2) - }, 500 + 1000) + }) + .start() + // let time1 = setInterval(() => { + // if ((bool && nowRotateNum < endRotateNum) || (!bool && nowRotateNum > endRotateNum)) { + // agvData[group].rotation.y = (newLocation * (Math.PI / 180)) + // resolve() + // clearInterval(time1) + // clearTimeout(time2) + // } else { + // agvData[group].rotation.y += ((distance / (500 / 16)) * (Math.PI / 180)) + // nowRotateNum += ((distance / (500 / 16)) * (Math.PI / 180)) + // } + // }, 16) + // let time2 = setTimeout(() => { + // agvData[group].rotation.y = (newLocation * (Math.PI / 180)) + // resolve() + // clearInterval(time1) + // clearTimeout(time2) + // }, 500 + 1000) }) } @@ -382,82 +423,59 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => { } } -const AGVAnimation = (item, type, newLocation = 0, time = 2000) => { - AGVanimationLine.push(() => AGVAnimationF(item, type, newLocation, time)) +const AGVAnimation = (e, item, type, newLocation = 0, time = 2000) => { + if (agvData[groupEnum[e]] && AGVanimationLine[e].length < 10) { + AGVanimationLine[e].push(() => AGVAnimationF(item, type, newLocation, time)) + } } + setInterval(() => { - if (agvData.floor5BFAGVGroup) { - } -}, 1000) -setTimeout(() =>{ + let num1_1 = Math.random() + let num1_2 = Math.random() + let num1_3 = Math.random() + let num1_4 = Math.random() + let num1_5 = Math.random() - setInterval(() => { - let num1 = Math.random() - // let num1 = 0.6 - // let num1 = 0.4 - if (num1 > 0.5) { - let num2 = Math.random() * 100 - AGVAnimation('5BFAGV', 'x', num2) - } else { - let num2 = Math.random() * 100 - AGVAnimation('5BFAGV', 'z', num2) - } - }, 1000) + if (num1_1 > 0.5) { + let num2 = Math.random() * 100 + AGVAnimation('2AGV', '2AGV', 'x', num2) + } else { + let num2 = Math.random() * 100 + AGVAnimation('2AGV', '2AGV', 'z', num2) + } - setInterval(() => { - let num1 = Math.random() - // let num1 = 0.6 - // let num1 = 0.4 - if (num1 > 0.5) { - let num2 = Math.random() * 100 - AGVAnimation('3AGV', 'x', num2) - } else { - let num2 = Math.random() * 100 - AGVAnimation('3AGV', 'z', num2) - } - }, 1000) - setInterval(() => { - let num1 = Math.random() - // let num1 = 0.6 - // let num1 = 0.4 - if (num1 > 0.5) { - let num2 = Math.random() * 100 - AGVAnimation('2AGV', 'x', num2) - } else { - let num2 = Math.random() * 100 - AGVAnimation('2AGV', 'z', num2) - } - }, 1000) - setInterval(() => { - let num1 = Math.random() - // let num1 = 0.6 - // let num1 = 0.4 - if (num1 > 0.5) { - let num2 = Math.random() * 100 - AGVAnimation('5CCAGV', 'x', num2) - } else { - let num2 = Math.random() * 100 - AGVAnimation('5CCAGV', 'z', num2) - } - }, 1000) -},200000000) + if (num1_2 > 0.5) { + let num2 = Math.random() * 100 + AGVAnimation('3AGV', '3AGV', 'x', num2) + } else { + let num2 = Math.random() * 100 + AGVAnimation('3AGV', '3AGV', 'z', num2) + } + if (num1_3 > 0.5) { + let num2 = Math.random() * 100 + AGVAnimation('5CCAGV', '5CCAGV', 'x', num2) + } else { + let num2 = Math.random() * 100 + AGVAnimation('5CCAGV', '5CCAGV', 'z', num2) + } -setTimeout(() =>{ + if (num1_4 > 0.5) { + let num2 = Math.random() * 100 + AGVAnimation('5BFAGV', '5BFAGV', 'x', num2) + } else { + let num2 = Math.random() * 100 + AGVAnimation('5BFAGV', '5BFAGV', 'z', num2) + } - setInterval(() => { - let num1 = Math.random() - // let num1 = 0.6 - // let num1 = 0.4 - if (num1 > 0.5) { - let num2 = Math.random() * 100 - AGVAnimation('5CTU', 'x', num2) - } else { - let num2 = Math.random() * 100 - AGVAnimation('5CTU', 'z', num2) - } - }, 1000) -},20000000) + if (num1_5 > 0.5) { + let num2 = Math.random() * 100 + AGVAnimation('5CTU', '5CTU', 'x', num2) + } else { + let num2 = Math.random() * 100 + AGVAnimation('5CTU', '5CTU', 'z', num2) + } +}, 1000) export { agvData, diff --git a/hw-ui/src/views/board/model/animation.js b/hw-ui/src/views/board/model/animation.js index 850c77e..45f86cc 100644 --- a/hw-ui/src/views/board/model/animation.js +++ b/hw-ui/src/views/board/model/animation.js @@ -1,11 +1,15 @@ import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader' import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader' import { - tuopanInishengji, tuopanLocation, - tishengjiLocation + tishengjiLocation, keyidongModel, storeyHeight, tuopanModel, animationLine, storeyWidth } from './setThree' +import * as TWEEN from '@tweenjs/tween.js' +import { agvData } from '@/views/board/model/agv' + +let tuopanInishengji = true +let s = 1 const tishengjiAnimation = (model, floor, newLocation = 0, time = 2000) => { @@ -15,25 +19,35 @@ const tishengjiAnimation = (model, floor, newLocation = 0, time = 2000) => { resolve() } let distance = newLocation - tishengjiLocation.y - let time1 = setInterval(() => { - if ((distance > 0 && model.position.y >= newLocation) || (distance < 0 && model.position.y <= newLocation)) { + + const 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() - clearInterval(time1) - clearTimeout(time3) - } else { - model.position.y += distance / (time / 16) - tishengjiLocation.y = model.position.y - } - }, 16) - let time3 = setTimeout(() => { - model.position.y = newLocation - tishengjiLocation.y = newLocation - resolve() - clearInterval(time1) - clearTimeout(time3) - }, time + 1000) + }) + .start() + + // let time1 = setInterval(() => { + // if ((distance > 0 && model.position.y >= newLocation) || (distance < 0 && model.position.y <= newLocation)) { + // model.position.y = newLocation + // tishengjiLocation.y = newLocation + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // } else { + // model.position.y += distance / (s / 16) + // tishengjiLocation.y = model.position.y + // } + // }, 16) + // let time3 = setTimeout(() => { + // model.position.y = newLocation + // tishengjiLocation.y = newLocation + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // }, time + 1000) }) } @@ -44,26 +58,36 @@ const tuopanXAnimation = (model, newLocation = 0, time = 2000) => { resolve() } else { tuopanInishengji = newLocation === 0 + let distance = newLocation - tuopanLocation.x - let time1 = setInterval(() => { - if ((distance > 0 && model.position.x >= newLocation) || (distance < 0 && model.position.x <= newLocation)) { + const 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() - clearInterval(time1) - clearTimeout(time3) - } else { - model.position.x += distance / (time / 16) - tuopanLocation.x = model.position.x - } - }, 16) - let time3 = setTimeout(() => { - model.position.x = newLocation - tuopanLocation.x = newLocation - resolve(0) - clearInterval(time1) - clearTimeout(time3) - }, time + 1000) + }) + .start() + + // let time1 = setInterval(() => { + // if ((distance > 0 && model.position.x >= newLocation) || (distance < 0 && model.position.x <= newLocation)) { + // model.position.x = newLocation + // tuopanLocation.x = newLocation + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // } else { + // model.position.x += distance / (time / 16) + // tuopanLocation.x = model.position.x + // } + // }, 16) + // let time3 = setTimeout(() => { + // model.position.x = newLocation + // tuopanLocation.x = newLocation + // resolve(0) + // clearInterval(time1) + // clearTimeout(time3) + // }, time + 1000) } }) } @@ -75,28 +99,56 @@ const tuopanYAnimation = (model, floor, newLocation = 0, time = 2000) => { resolve() } let distance = newLocation - tuopanLocation.y - let time1 = setInterval(() => { - if ((distance > 0 && model.position.y >= newLocation) || (distance < 0 && model.position.y <= newLocation)) { + const 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() - clearInterval(time1) - clearTimeout(time3) - } else { - model.position.y += distance / (time / 16) - tuopanLocation.y = model.position.y - } - }, 16) - let time3 = setTimeout(() => { - model.position.y = newLocation - tuopanLocation.y = newLocation - resolve() - clearInterval(time1) - clearTimeout(time3) - }, time + 1000) + }) + .start() + + // let time1 = setInterval(() => { + // if ((distance > 0 && model.position.y >= newLocation) || (distance < 0 && model.position.y <= newLocation)) { + // model.position.y = newLocation + // tuopanLocation.y = newLocation + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // } else { + // model.position.y += distance / (time / 16) + // tuopanLocation.y = model.position.y + // } + // }, 16) + // let time3 = setTimeout(() => { + // model.position.y = newLocation + // tuopanLocation.y = newLocation + // resolve() + // clearInterval(time1) + // clearTimeout(time3) + // }, time + 1000) }) } +setInterval(() => { + if (animationLine.length < 5) { + + let floor = Math.ceil(Math.random() * 5) + + animationLine.push(() => { + if (tuopanInishengji) { + return Promise.all([tishengjiAnimation(keyidongModel, floor, storeyHeight[floor]), tuopanYAnimation(tuopanModel, floor, storeyHeight[floor])]) + } else { + animationLine.push(() => tishengjiAnimation(keyidongModel, floor, storeyHeight[floor])) + } + }) + if (Math.random() > 0.5) { + animationLine.push(() => tuopanXAnimation(tuopanModel, storeyWidth[floor])) + animationLine.push(() => tuopanXAnimation(tuopanModel, 0)) + } + } +}, 1800) + const addtuopan = (params) => { return new Promise((resolve, reject) => { try { @@ -131,6 +183,7 @@ const addtuopan = (params) => { } export { + tuopanInishengji, tishengjiAnimation, tuopanXAnimation, tuopanYAnimation, diff --git a/hw-ui/src/views/board/model/index.vue b/hw-ui/src/views/board/model/index.vue index 3081b75..5dc0cc0 100644 --- a/hw-ui/src/views/board/model/index.vue +++ b/hw-ui/src/views/board/model/index.vue @@ -94,6 +94,7 @@ import { CSS2DObject, CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRe import Demo from '@/components/model/demo.vue' import { + tuopanInishengji, tishengjiAnimation, tuopanXAnimation, tuopanYAnimation, @@ -109,7 +110,6 @@ import { loadF, storeyHeight, storeyWidth, - tuopanInishengji, tuopanLocation, animationLine } from './setThree' @@ -125,7 +125,7 @@ export default { data() { return { num: -60, - num1: 10, + num1: 90, floor: 1, tuopanFloor: 1, fx:'', @@ -139,8 +139,8 @@ export default { // controls.enableZoom = false // loadF([ 'tishengji_tuopan']) - // loadF(['tishengji', 'AGVchongdianzhuang002', 'AGVchongdianzhuang003', 'changfang002', 'changfang003', 'quanzidongchaibaojizhaungpeixian003', 'tishengji_keyidongbufen', 'tishengji_tuopan', 'AGVchongdianzhuang005', 'changfang005', 'liku005']) - loadF(['changfang002', 'changfang003', 'changfang005']) + loadF(['tishengji', 'AGVchongdianzhuang002', 'AGVchongdianzhuang003', 'changfang002', 'changfang003', 'quanzidongchaibaojizhaungpeixian003', 'tishengji_keyidongbufen', 'tishengji_tuopan', 'AGVchongdianzhuang005', 'changfang005', 'liku005']) + // loadF(['changfang002', 'changfang003', 'changfang005']) // 创建CSS2DObject // const label = this.$refs.demo @@ -150,9 +150,6 @@ export default { // 渲染循环 - setInterval(() => { - - }, 1000 * 10) }, methods: { @@ -192,7 +189,7 @@ export default { }, agvAn() { this.rotate -=this.num1 - AGVAnimation('5BFAGV','rotate',this.rotate,) + AGVAnimation('3AGV','rotate',this.rotate,) } } } diff --git a/hw-ui/src/views/board/model/setThree.js b/hw-ui/src/views/board/model/setThree.js index 3b4c851..f0ab149 100644 --- a/hw-ui/src/views/board/model/setThree.js +++ b/hw-ui/src/views/board/model/setThree.js @@ -105,7 +105,6 @@ const animation = async() => { function animate() { if (animationLine.length > 0 && isAnimation === false) { - console.log('动画') isAnimation = true animation(animationLine) } @@ -152,7 +151,6 @@ const loadF = (e) => { }) } -let tuopanInishengji = true let storeyHeight = { 1: 0, 2: 261.9, @@ -189,7 +187,6 @@ export { loadF, animationLine, labelRenderer, - tuopanInishengji, storeyHeight, storeyWidth, tuopanLocation,