File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ <h1>Animation</h1>
54
54
< label > < input type ="radio " id ="animation_walk " name ="animation " value ="walk " /> Walk</ label >
55
55
< label > < input type ="radio " id ="animation_run " name ="animation " value ="run " /> Run</ label >
56
56
< label > < input type ="radio " id ="animation_fly " name ="animation " value ="fly " /> Fly</ label >
57
+ < label > < input type ="radio " id ="animation_wave " name ="animation " value ="wave " /> Wave</ label >
57
58
</ div >
58
59
< label class ="control "> Speed: < input id ="animation_speed " type ="number " value ="1 " step ="0.1 " size ="3 " /> </ label >
59
60
< button id ="animation_pause_resume " type ="button " class ="control "> Pause / Resume</ button >
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const availableAnimations = {
8
8
walk : new skinview3d . WalkingAnimation ( ) ,
9
9
run : new skinview3d . RunningAnimation ( ) ,
10
10
fly : new skinview3d . FlyingAnimation ( ) ,
11
+ wave : new skinview3d . WaveAnimation ( ) ,
11
12
} ;
12
13
13
14
let skinViewer : skinview3d . SkinViewer ;
Original file line number Diff line number Diff line change @@ -190,3 +190,21 @@ export class FlyingAnimation extends PlayerAnimation {
190
190
player . elytra . updateRightWing ( ) ;
191
191
}
192
192
}
193
+
194
+ export class WaveAnimation extends PlayerAnimation {
195
+
196
+ whichArm : string ;
197
+
198
+ constructor ( whichArm : 'left' | 'right' = 'left' ) {
199
+ super ( ) ;
200
+ this . whichArm = whichArm ;
201
+ }
202
+
203
+ protected animate ( player : PlayerObject ) : void {
204
+ const t = this . progress * 2 * Math . PI * 0.5 ;
205
+
206
+ const targetArm = this . whichArm === 'left' ? player . skin . leftArm : player . skin . rightArm ;
207
+ targetArm . rotation . x = 180
208
+ targetArm . rotation . z = Math . sin ( t ) * 0.5 ;
209
+ }
210
+ }
You can’t perform that action at this time.
0 commit comments