wgge 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import AnimationController from "./AnimationController";
|
|
2
|
+
import {EASING_FLAT} from "../animation/ProgressValue";
|
|
3
|
+
import AnimatedRotation from "../animation/AnimatedRotation";
|
|
4
|
+
|
|
5
|
+
export default class AnimationRotationVector2Controller extends AnimationController {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @type Vector2
|
|
9
|
+
*/
|
|
10
|
+
model;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type AnimatedRotation
|
|
14
|
+
*/
|
|
15
|
+
animated;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param game GameModel
|
|
20
|
+
* @param model Rotation
|
|
21
|
+
* @param target Rotation
|
|
22
|
+
* @param duration Number
|
|
23
|
+
* @param easing (float) => float
|
|
24
|
+
* @param elapsed Number
|
|
25
|
+
*/
|
|
26
|
+
constructor(game, model, target, duration, easing = EASING_FLAT, elapsed = 0) {
|
|
27
|
+
super(game, model);
|
|
28
|
+
this.model = model;
|
|
29
|
+
this.animated = new AnimatedRotation(model.x, target.x, duration, easing, elapsed);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
updateInternal(delta) {
|
|
33
|
+
this.model.set(this.animated.get(delta));
|
|
34
|
+
if (this.animated.isFinished()) {
|
|
35
|
+
this.finished();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|