From d7b8fc1e5eb66ecee133e87f22338463fca926d2 Mon Sep 17 00:00:00 2001 From: Zachary Harvey Date: Wed, 18 Sep 2024 09:50:51 -0500 Subject: [PATCH 1/2] Added wave animation --- src/animation.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/animation.ts b/src/animation.ts index 6138b85..f9e0cf1 100644 --- a/src/animation.ts +++ b/src/animation.ts @@ -190,3 +190,21 @@ export class FlyingAnimation extends PlayerAnimation { player.elytra.updateRightWing(); } } + +export class WaveAnimation extends PlayerAnimation { + + whichArm: string; + + constructor(whichArm: 'left' | 'right' = 'left') { + super(); + this.whichArm = whichArm; + } + + protected animate(player: PlayerObject): void { + const t = this.progress * 2 * Math.PI * 0.5; + + const targetArm = this.whichArm === 'left' ? player.skin.leftArm : player.skin.rightArm; + targetArm.rotation.x = 180 + targetArm.rotation.z = Math.sin(t) * 0.5; + } +} From 2feb7134b02138dc4e84b95307e815d3fa0c6010 Mon Sep 17 00:00:00 2001 From: Sean Boult <996134+Hacksore@users.noreply.github.com> Date: Sat, 21 Sep 2024 11:15:38 -0500 Subject: [PATCH 2/2] Rebase and add preview --- examples/index.html | 1 + examples/main.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/index.html b/examples/index.html index fa5e3ce..7c29a8c 100644 --- a/examples/index.html +++ b/examples/index.html @@ -54,6 +54,7 @@

Animation

+ diff --git a/examples/main.ts b/examples/main.ts index 0d544ff..72095e5 100644 --- a/examples/main.ts +++ b/examples/main.ts @@ -8,6 +8,7 @@ const availableAnimations = { walk: new skinview3d.WalkingAnimation(), run: new skinview3d.RunningAnimation(), fly: new skinview3d.FlyingAnimation(), + wave: new skinview3d.WaveAnimation(), }; let skinViewer: skinview3d.SkinViewer;