Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/animation/Shrink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Animation } from "./Animation.js";
import * as THREE from "three";

export default class Shrink extends Animation {
constructor(object: THREE.Object3D) {
super(
(elapsedTime) => {
object.scale.set(1 - elapsedTime, 1 - elapsedTime, 1 - elapsedTime);
},
{ object, reveal: true },
);
}
}
2 changes: 1 addition & 1 deletion src/animation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export { default as Wait } from "./Wait.js";
export { default as Emphasize } from "./Emphasize.js";
export { default as Shake } from "./Shake.js";
export { default as Grow } from "./Grow.js";
export { default as Shrink } from "./Shrink.js";
export { default as Stagger } from "./Stagger.js";
export { default as SetStyle } from "./SetStyle.js";
export { default as StaggerFadeIn } from "./StaggerFadeIn.js";

10 changes: 3 additions & 7 deletions userScene/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ export default class Scene implements StudioScene {

this.animations = [
new Animation.Wait(),
new Animation.Animation((t, _) => {
triangle.reshape([
new THREE.Vector3(-1, -1, 0),
new THREE.Vector3(1 + t, 1, 0),
new THREE.Vector3(1, -1, 0),
]);
}),
new Animation.Shrink(triangle),
new Animation.Grow(triangle),

];
}
}