Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//rotation tweening
var navballTweenProperties = {
pitch: this.pitch,
roll: this.roll,
heading: this.heading
}
var navballTween = new TWEEN.Tween(navballTweenProperties).to({
// add normalized delta values to current values
pitch: this.pitch + this.wrapDegDelta(data['n.pitch'] - this.pitch),
roll: this.roll + this.wrapDegDelta(data['n.roll'] - this.roll),
heading: this.heading + this.wrapDegDelta(data['n.heading'] - this.heading)
}, this.datalink.rate)
this.pitch = data['n.pitch']
this.roll = data['n.roll']
this.heading = data['n.heading']
navballTween.onUpdate(function(){
this.navballMesh.rotation.order = "ZXY"
this.navballMesh.rotation.z = Math.toRadians(-navballTweenProperties.roll)
this.navballMesh.rotation.x = Math.toRadians(navballTweenProperties.pitch)
this.navballMesh.rotation.y = Math.toRadians(270 - navballTweenProperties.heading)
}.bind(this))
this.headingContainer.update(this.heading.toFixed(1) + "°")
navballTween.start()
},
update: function(data){
//rotation tweening
var navballTweenProperties = {
pitch: this.pitch,
roll: this.roll,
heading: this.heading
}
var navballTween = new TWEEN.Tween(navballTweenProperties).to({
// add normalized delta values to current values
pitch: this.pitch + this.wrapDegDelta(data['n.pitch'] - this.pitch),
roll: this.roll + this.wrapDegDelta(data['n.roll'] - this.roll),
heading: this.heading + this.wrapDegDelta(data['n.heading'] - this.heading)
}, this.datalink.rate)
this.pitch = data['n.pitch']
this.roll = data['n.roll']
this.heading = data['n.heading']
navballTween.onUpdate(function(){
this.navballMesh.rotation.order = "ZXY"
this.navballMesh.rotation.z = Math.toRadians(-navballTweenProperties.roll)
this.navballMesh.rotation.x = Math.toRadians(navballTweenProperties.pitch)
this.navballMesh.rotation.y = Math.toRadians(270 - navballTweenProperties.heading)
}.bind(this))
this.headingContainer.update(this.heading.toFixed(1) + "°")
//rotation tweening
var navballTweenProperties = {
pitch: this.pitch,
roll: this.roll,
heading: this.heading
}
var navballTween = new TWEEN.Tween(navballTweenProperties).to({
// add normalized delta values to current values
pitch: this.pitch + this.wrapDegDelta(data['n.pitch'] - this.pitch),
roll: this.roll + this.wrapDegDelta(data['n.roll'] - this.roll),
heading: this.heading + this.wrapDegDelta(data['n.heading'] - this.heading)
}, this.datalink.rate)
this.pitch = data['n.pitch']
this.roll = data['n.roll']
this.heading = data['n.heading']
navballTween.onUpdate(function(){
this.navballMesh.rotation.order = "ZXY"
this.navballMesh.rotation.z = Math.toRadians(-navballTweenProperties.roll)
this.navballMesh.rotation.x = Math.toRadians(navballTweenProperties.pitch)
this.navballMesh.rotation.y = Math.toRadians(270 - navballTweenProperties.heading)
}.bind(this))
this.headingContainer.update(this.heading.toFixed(1) + "°")
navballTween.start()
},
update: function(data){
//rotation tweening
var navballTweenProperties = {
pitch: this.pitch,
roll: this.roll,
heading: this.heading
}
var navballTween = new TWEEN.Tween(navballTweenProperties).to({
// add normalized delta values to current values
pitch: this.pitch + this.wrapDegDelta(data['n.pitch'] - this.pitch),
roll: this.roll + this.wrapDegDelta(data['n.roll'] - this.roll),
heading: this.heading + this.wrapDegDelta(data['n.heading'] - this.heading)
}, this.datalink.rate)
this.pitch = data['n.pitch']
this.roll = data['n.roll']
this.heading = data['n.heading']
navballTween.onUpdate(function(){
this.navballMesh.rotation.order = "ZXY"
this.navballMesh.rotation.z = Math.toRadians(-navballTweenProperties.roll)
this.navballMesh.rotation.x = Math.toRadians(navballTweenProperties.pitch)
this.navballMesh.rotation.y = Math.toRadians(270 - navballTweenProperties.heading)
}.bind(this))
this.headingContainer.update(this.heading.toFixed(1) + "°")