Skip to content

Commit

Permalink
chore(deps): bump @tweenjs/tween.js from 23.1.2 to 25.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jailln committed Sep 24, 2024
1 parent 4d034b5 commit 63e2194
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
14 changes: 10 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@mapbox/mapbox-gl-style-spec": "^13.28.0",
"@mapbox/vector-tile": "^2.0.3",
"@tmcw/togeojson": "^5.8.1",
"@tweenjs/tween.js": "^23.1.2",
"@tweenjs/tween.js": "^25.0.0",
"3d-tiles-renderer": "^0.3.37",
"brotli-compress": "^1.3.3",
"copc": "^0.0.6",
Expand Down
9 changes: 7 additions & 2 deletions src/Controls/StreetControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class StreetControls extends FirstPersonControls {
startQuaternion.copy(this.camera.quaternion);
this.end.copy(this.camera);
this.end.lookAt(position);
this.tween = new TWEEN.Tween({ t: 0 }, this.tweenGroup).to({ t: 1 }, time)
this.tween = new TWEEN.Tween({ t: 0 }).to({ t: 1 }, time)
.easing(TWEEN.Easing.Quadratic.Out)
.onComplete(() => {
this.stopAnimations();
Expand All @@ -310,6 +310,8 @@ class StreetControls extends FirstPersonControls {
})
.start();

this.tweenGroup.add(this.tween);

this.animationFrameRequester = () => {
this.tweenGroup.update();
// call reset from super class FirsPersonControls to make mouse rotation managed by FirstPersonControl still aligned
Expand Down Expand Up @@ -340,7 +342,7 @@ class StreetControls extends FirstPersonControls {

this.stopAnimations();

this.tween = new TWEEN.Tween(this.camera.position, this.tweenGroup) // Create a new tween that modifies camera position
this.tween = new TWEEN.Tween(this.camera.position) // Create a new tween that modifies camera position
.to(position.clone(), time)
.easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
.onComplete(() => {
Expand All @@ -349,6 +351,8 @@ class StreetControls extends FirstPersonControls {
})
.start();

this.tweenGroup.add(this.tween);

this.animationFrameRequester = () => {
this.tweenGroup.update();
this.view.notifyChange(this.camera);
Expand All @@ -364,6 +368,7 @@ class StreetControls extends FirstPersonControls {
if (this.tween) {
this.tween.stop();
this.tween = undefined;
this.tweenGroup.removeAll();
}
if (this.animationFrameRequester) {
this.view.removeFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.animationFrameRequester);
Expand Down
10 changes: 6 additions & 4 deletions src/Utils/CameraUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class CameraRig extends THREE.Object3D {
this.end.target.rotation.z = this.start.target.rotation.z + difference - Math.sign(difference) * 2 * Math.PI;
}

animations.push(new TWEEN.Tween(factor, tweenGroup).to({ t: 1 }, time)
animations.push(new TWEEN.Tween(factor).to({ t: 1 }, time)
.easing(params.easing)
.onUpdate((d) => {
// rotate to coord destination in geocentric projection
Expand All @@ -251,21 +251,23 @@ class CameraRig extends THREE.Object3D {

// translate to coordinate destination in planar projection
if (view.referenceCrs != 'EPSG:4978') {
animations.push(new TWEEN.Tween(this.position, tweenGroup)
animations.push(new TWEEN.Tween(this.position)
.to(this.end.position, time)
.easing(params.easing));
}

// translate to altitude zero
animations.push(new TWEEN.Tween(this.seaLevel.position, tweenGroup)
animations.push(new TWEEN.Tween(this.seaLevel.position)
.to(this.end.seaLevel.position, time)
.easing(params.easing));

// translate camera position
animations.push(new TWEEN.Tween(this.camera.position, tweenGroup)
animations.push(new TWEEN.Tween(this.camera.position)
.to(this.end.camera.position, time)
.easing(params.easing));

tweenGroup.add(...animations);

// update animations, transformation and view
this.animationFrameRequester = () => {
tweenGroup.update();
Expand Down

0 comments on commit 63e2194

Please sign in to comment.