修改动画开始时机

master
夜笙歌 6 months ago
parent 97aeade5a2
commit 733bd264f9

2
hw-ui/.gitignore vendored

@ -22,4 +22,4 @@ selenium-debug.log
package-lock.json
yarn.lock
vue.config.js

@ -1,7 +1,7 @@
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader'
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
import * as THREE from 'three'
import { camera, labelRenderer, renderer, scene } from '@/views/board/model/setThree'
import { camera, labelRenderer, renderer, scene,isLoading } from '@/views/board/model/setThree'
import * as TWEEN from '@tweenjs/tween.js'
let timeOrSpeed = true
@ -436,6 +436,8 @@ const AGVAnimation = (e, item, type, newLocation = 0, time = 2000) => {
}
setInterval(() => {
if (isLoading) {
let num1_1 = Math.random()
let num1_2 = Math.random()
let num1_3 = Math.random()
@ -481,6 +483,7 @@ setInterval(() => {
let num2 = Math.random() * 100
AGVAnimation('5CTU', '5CTU', 'z', num2)
}
}
}, 1000)
export {

@ -1,6 +1,7 @@
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader'
import {
isLoading,
tuopanLocation,
tishengjiLocation, keyidongModel, storeyHeight, tuopanModel, animationLine, storeyWidth
} from './setThree'
@ -136,25 +137,6 @@ const tuopanYAnimation = (model, floor, newLocation = 0, time = 2000) => {
})
}
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 {
@ -188,6 +170,28 @@ const addtuopan = (params) => {
}
setInterval(() => {
if (isLoading) {
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)
export {
tuopanInishengji,
tishengjiAnimation,

@ -142,6 +142,7 @@ export default {
loadF(['tishengji', 'AGVchongdianzhuang002', 'AGVchongdianzhuang003', 'changfang002', 'changfang003', 'quanzidongchaibaojizhaungpeixian003', 'tishengji_keyidongbufen', 'tishengji_tuopan', 'AGVchongdianzhuang005', 'changfang005', 'liku005'])
// loadF(['changfang002', 'changfang003', 'changfang005'])
// CSS2DObject
// const label = this.$refs.demo
// const labelObject = new CSS2DObject(label)

@ -5,6 +5,7 @@ import * as TWEEN from '@tweenjs/tween.js'
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader'
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
let isLoading = false
let isAnimation = false
let animationLine = []
let keyidongModel
@ -118,13 +119,17 @@ animate()
let a = 0
const loadingManager = new THREE.LoadingManager();
loadingManager.onLoad = function() {
isLoading = true
};
const loadF = (e) => {
e.forEach(v => {
let mtlLoader = new MTLLoader()
mtlLoader.load(`/model/${v}/${v}.mtl`,
materials => {
materials.preload()
let loader = new OBJLoader()
let loader = new OBJLoader(loadingManager)
loader.setMaterials(materials)
loader.load(
`/model/${v}/${v}.obj`,
@ -179,6 +184,7 @@ let tuopanLocation = {
}
export {
isLoading,
keyidongModel,
tuopanModel,
scene,

Loading…
Cancel
Save