轨迹运动增加反向

This commit is contained in:
takeshita
2025-11-28 18:11:33 +08:00
parent d6b0ed8bc3
commit d0b58f378b
7 changed files with 83 additions and 17 deletions

View File

@ -95,6 +95,7 @@ class TrajectoryMotion extends Base {
this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false
this.positions_smooth = []
this.options.ground = options.ground || false
this.options.reverse = options.reverse || false
this.options.state = (options.state || options.state === false) ? options.state : true
this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true
this.keyPoints = []
@ -618,13 +619,23 @@ class TrajectoryMotion extends Base {
set delay(v) {
this.options.delay = v
if (this.TweenAnimate && this.TweenAnimate._isPlaying) {
this.TweenAnimate.delay(this.delay)
this.TweenAnimate.delay(this.delay*1000)
}
this._elms.delay && this._elms.delay.forEach((item) => {
item.value = v
})
}
get reverse() {
return this.options.reverse
}
set reverse(v) {
this.lineEdit = false
this.options.reverse = v
this.smooth = this.smooth
}
get state() {
return this.options.state
}
@ -646,10 +657,10 @@ class TrajectoryMotion extends Base {
if (this.TweenAnimate.isPlaying()) {
this.TweenAnimate.timeout = setTimeout(() => {
this.TweenAnimate.resume()
}, this.options.delay);
}, this.options.delay*1000);
}
else {
this.TweenAnimate.delay(this.delay).start()
this.TweenAnimate.delay(this.delay*1000).start()
}
this.speed = this.speed
}
@ -1513,7 +1524,7 @@ class TrajectoryMotion extends Base {
let HeadingPitchRoll2
let previous = {}
let m = 0
this.TweenAnimate = new TWEEN.Tween({ distance: startDistance }).to({ distance: this.distance }, (totalTime - time) * 1000).delay(this.delay).easing(TWEEN.Easing.Linear.None).repeat(this.options.loop ? Infinity : 0).onRepeat(() => {
this.TweenAnimate = new TWEEN.Tween({ distance: startDistance }).to({ distance: this.distance }, (totalTime - time) * 1000).delay(this.delay*1000).easing(TWEEN.Easing.Linear.None).repeat(this.options.loop ? Infinity : 0).onRepeat(() => {
if (time || startDistance) {
this.modelMove(positions)
}
@ -2457,10 +2468,13 @@ class TrajectoryMotion extends Base {
// 更新坐标
renewLinePositions(pos) {
let positions = pos
let positions = [...pos]
if (this.noseToTail) {
positions = [...pos, pos[0]]
}
if(this.reverse) {
positions.reverse()
}
let fromDegreesArrayHeights = []
let time = []
let positions_smooth = []