Skip to content

Commit

Permalink
Added wave animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknowncall authored Sep 18, 2024
1 parent 802a1de commit 48dc20e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 48dc20e

Please sign in to comment.