Skip to content

Commit

Permalink
scale scene scales now (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
ydcjeff authored Dec 19, 2023
1 parent df75f8d commit 9a25e17
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/scenes/scale-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const green = () => new Color(0, 255, 0);
const blue = () => new Color(0, 0, 255);

export class ScaleScene extends Scene {
count = 0;
cube1?: Object3D;
cube2?: Object3D;
cube3?: Object3D;
Expand Down Expand Up @@ -122,27 +123,35 @@ export class ScaleScene extends Scene {

onBeforeUpdate(): void {
{
const scale = this.cube2?.scale;
const scale = this.cube2?.scale.clone();
if (scale) {
if (scale.z > 300) {
scale.z--;
} else if (scale.z < 100) {
scale.z++;
if (this.count < 200) {
scale.y++;
this.count++;
} else if (this.count < 400) {
scale.y--;
this.count++;
} else {
this.count = 0;
}
this.cube2?.setScale(scale);
}
}
{
const scale = this.cube3?.scale;
const scale = this.cube3?.scale.clone();
if (scale) {
if (scale.x > 300) {
scale.x--;
scale.y--;
scale.z--;
} else if (scale.x < 100) {
if (this.count < 200) {
scale.x++;
scale.y++;
scale.z++;
this.count++;
} else if (this.count < 400) {
scale.x--;
scale.y--;
scale.z--;
this.count++;
} else {
this.count = 0;
}
this.cube3?.setScale(scale);
}
Expand Down

0 comments on commit 9a25e17

Please sign in to comment.