wgge 0.1.35 → 1.0.0

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.
Files changed (121) hide show
  1. package/README.MD +9 -9
  2. package/bin/deploy.cmd +1 -1
  3. package/core/ActivatedTreeNode.js +187 -187
  4. package/core/Collection.js +156 -156
  5. package/core/Dictionary.js +83 -83
  6. package/core/animation/AnimatedRotation.js +44 -44
  7. package/core/animation/AnimatedValue.js +33 -33
  8. package/core/animation/AnimatedVector2.js +35 -35
  9. package/core/animation/ProgressRotation.js +40 -40
  10. package/core/animation/ProgressValue.js +30 -30
  11. package/core/animation/ProgressVector2.js +23 -23
  12. package/core/audio/AudioModel.js +36 -36
  13. package/core/audio/AudioRenderer.js +120 -120
  14. package/core/audio/global/GlobalAudioModel.js +88 -88
  15. package/core/audio/global/GlobalAudioRenderer.js +108 -108
  16. package/core/controller/AnimationController.js +37 -37
  17. package/core/controller/AnimationDelayController.js +56 -56
  18. package/core/controller/AnimationFloatController.js +39 -39
  19. package/core/controller/AnimationRotationVector2Controller.js +45 -45
  20. package/core/controller/AnimationVector2Controller.js +39 -39
  21. package/core/controller/CollectionController.js +47 -47
  22. package/core/controller/ConditionalNodeController.js +51 -51
  23. package/core/controller/ControllerBase.js +64 -64
  24. package/core/controller/ControllerWithSaveGame.js +27 -27
  25. package/core/controller/ControllerWithTimeout.js +10 -10
  26. package/core/controller/NullableNodeController.js +35 -35
  27. package/core/controller/TimeoutController.js +26 -26
  28. package/core/helper/ArrayHelper.js +19 -19
  29. package/core/helper/DOMHelper.js +167 -167
  30. package/core/helper/HttpHelper.js +41 -41
  31. package/core/helper/ImageHelper.js +36 -36
  32. package/core/helper/NumberHelper.js +28 -28
  33. package/core/helper/ObjectHelper.js +10 -10
  34. package/core/helper/StringHelper.js +59 -59
  35. package/core/model/ModelBase.js +99 -99
  36. package/core/model/ObjectModel.js +100 -100
  37. package/core/model/collection/ModelNodeCollection.js +238 -238
  38. package/core/model/collection/table/IdentifiedModelNode.js +24 -24
  39. package/core/model/collection/table/ModelNodeTable.js +53 -53
  40. package/core/model/event/ChangeEvent.js +24 -24
  41. package/core/model/event/NodeWithEvents.js +37 -37
  42. package/core/model/template/TemplateNode.js +45 -45
  43. package/core/model/value/BoolValue.js +17 -17
  44. package/core/model/value/CapacityValue.js +49 -49
  45. package/core/model/value/DirtyValue.js +66 -66
  46. package/core/model/value/FloatValue.js +12 -12
  47. package/core/model/value/IntValue.js +32 -32
  48. package/core/model/value/NullableNode.js +71 -71
  49. package/core/model/vector/Quaternion.js +86 -86
  50. package/core/model/vector/Rotation.js +61 -61
  51. package/core/model/vector/Vector2.js +178 -178
  52. package/core/renderer/RendererBase.js +46 -46
  53. package/core/renderer/canvas/CanvasRenderer.js +132 -132
  54. package/core/renderer/canvas/ImageCanvasRenderer.js +59 -59
  55. package/core/renderer/canvas/ImageViewRenderer.js +42 -42
  56. package/core/renderer/dom/DirtyValueRenderer.js +36 -36
  57. package/core/renderer/dom/DomRenderer.js +32 -32
  58. package/core/renderer/dom/ImageDomRenderer.js +41 -41
  59. package/core/renderer/dom/Vector2Renderer.js +36 -36
  60. package/core/renderer/generic/CollectionRenderer.js +50 -50
  61. package/core/renderer/generic/ConditionalNodeRenderer.js +57 -57
  62. package/core/renderer/generic/NullableNodeRenderer.js +43 -43
  63. package/core/renderer/generic/SwitchController.js +34 -34
  64. package/core/renderer/generic/SwitchRenderer.js +34 -34
  65. package/editor/EditorController.js +134 -134
  66. package/editor/EditorModel.js +38 -38
  67. package/editor/EditorRenderer.js +116 -116
  68. package/editor/form/NodeFormRenderer.js +180 -180
  69. package/editor/material/MaterialPreviewRenderer.js +136 -136
  70. package/editor/table/TableRenderer.js +123 -123
  71. package/editor/table/lookup/TableLookupRenderer.js +120 -120
  72. package/editor/table/row/TableRowRenderer.js +98 -98
  73. package/game/GameController.js +136 -136
  74. package/game/GameModel.js +73 -73
  75. package/game/GameRenderer.js +108 -108
  76. package/game/controls/ControlsController.js +92 -92
  77. package/game/controls/ControlsModel.js +64 -64
  78. package/game/menu/MainMenuRenderer.js +37 -37
  79. package/game/menu/MenuModel.js +25 -25
  80. package/game/menu/MenuRenderer.js +34 -34
  81. package/game/menu/item/MenuItemModel.js +31 -31
  82. package/game/menu/item/MenuItemRenderer.js +48 -48
  83. package/game/resources/ResourcesModel.js +26 -26
  84. package/game/resources/assets/AssetCache.js +203 -203
  85. package/game/resources/assets/loader/AssetLoader.js +56 -56
  86. package/game/resources/assets/loader/AudioLoader.js +15 -15
  87. package/game/resources/assets/loader/GlbLoader.js +16 -16
  88. package/game/resources/assets/loader/ImageLoader.js +15 -15
  89. package/game/resources/assets/loader/MaterialLoader.js +50 -50
  90. package/game/resources/assets/loader/Model3dAnimationLoader.js +28 -28
  91. package/game/resources/assets/loader/Model3dLoader.js +26 -26
  92. package/game/resources/assets/loader/SpriteLoader.js +40 -40
  93. package/game/resources/image/DualImageModel.js +34 -34
  94. package/game/resources/image/ImageModel.js +24 -24
  95. package/game/resources/image/ImageViewModel.js +106 -106
  96. package/game/resources/material/MaterialModel.js +69 -69
  97. package/game/save/SaveGameController.js +21 -21
  98. package/game/save/SaveGameModel.js +5 -5
  99. package/game/save/SaveGameRenderer.js +17 -17
  100. package/game/save/editor/SaveGameEditorRenderer.js +17 -17
  101. package/index.html +42 -42
  102. package/index.js +72 -73
  103. package/package.json +28 -35
  104. package/style/basic/editor.less +290 -290
  105. package/style/basic/game.less +171 -171
  106. package/style/style.less +3 -3
  107. package/webpack.config.js +29 -29
  108. package/core/animation/3d/AnimatedVector3.js +0 -35
  109. package/core/animation/3d/AnimationHelper.js +0 -103
  110. package/core/animation/3d/ProgressVector3.js +0 -26
  111. package/core/helper/GUIHelper.js +0 -53
  112. package/core/model/vector/Vector3.js +0 -107
  113. package/core/particles/ParticleController.js +0 -35
  114. package/core/particles/ParticleModel.js +0 -68
  115. package/core/particles/ParticleRenderer.js +0 -53
  116. package/core/particles/generator/ParticleGeneratorController.js +0 -70
  117. package/core/particles/generator/ParticleGeneratorModel.js +0 -76
  118. package/core/particles/generator/ParticleGeneratorRenderer.js +0 -27
  119. package/core/renderer/svg/SvgRenderer.js +0 -139
  120. package/core/renderer/three/ThreeRenderer.js +0 -17
  121. package/game/resources/3d/3DModel.js +0 -30
@@ -1,88 +1,88 @@
1
- import ObjectModel from "../../model/ObjectModel";
2
- import FloatValue from "../../model/value/FloatValue";
3
- import BoolValue from "../../model/value/BoolValue";
4
- import ModelNodeCollection from "../../model/collection/ModelNodeCollection";
5
- import AudioModel from "../AudioModel";
6
-
7
- export default class GlobalAudioModel extends ObjectModel {
8
-
9
- /**
10
- * @type BoolValue
11
- */
12
- audioOn;
13
-
14
- /**
15
- * @type FloatValue
16
- */
17
- masterVolume;
18
-
19
- /**
20
- * @type BoolValue
21
- */
22
- musicOn;
23
-
24
- /**
25
- * @type BoolValue
26
- */
27
- paused;
28
-
29
- /**
30
- * @type FloatValue
31
- */
32
- musicVolume;
33
-
34
- /**
35
- * @type BoolValue
36
- */
37
- soundsOn;
38
-
39
- /**
40
- * @type FloatValue
41
- */
42
- soundsVolume;
43
-
44
- /**
45
- * @type ModelNodeCollection<AudioModel>
46
- */
47
- music;
48
-
49
- /**
50
- * @type ModelNodeCollection<AudioModel>
51
- */
52
- sounds;
53
-
54
- constructor(persistent = true) {
55
- super(persistent);
56
-
57
- this.audioOn = this.addProperty('audioOn', new BoolValue(true));
58
- this.masterVolume = this.addProperty('masterVolume', new FloatValue(1));
59
- this.paused = this.addProperty('paused', new BoolValue(false));
60
-
61
- this.musicOn = this.addProperty('musicOn', new BoolValue(true));
62
- this.musicVolume = this.addProperty('musicVolume', new FloatValue(1));
63
-
64
- this.soundsOn = this.addProperty('soundsOn', new BoolValue(true));
65
- this.soundsVolume = this.addProperty('soundsVolume', new FloatValue(1));
66
-
67
- this.music = this.addProperty('music', new ModelNodeCollection(null, false));
68
- this.sounds = this.addProperty('sounds', new ModelNodeCollection(null, false));
69
- }
70
-
71
- playSound(url, loop = false) {
72
- const sound = new AudioModel();
73
- sound.url.set(url);
74
- sound.loop.set(loop);
75
- sound.playing.set(true);
76
- this.sounds.add(sound);
77
- return sound;
78
- }
79
-
80
- removeSound(audio) {
81
- this.sounds.remove(audio);
82
- }
83
-
84
- changeMusic(audio) {
85
- this.music.reset();
86
- this.music.add(audio);
87
- }
88
- }
1
+ import ObjectModel from "../../model/ObjectModel";
2
+ import FloatValue from "../../model/value/FloatValue";
3
+ import BoolValue from "../../model/value/BoolValue";
4
+ import ModelNodeCollection from "../../model/collection/ModelNodeCollection";
5
+ import AudioModel from "../AudioModel";
6
+
7
+ export default class GlobalAudioModel extends ObjectModel {
8
+
9
+ /**
10
+ * @type BoolValue
11
+ */
12
+ audioOn;
13
+
14
+ /**
15
+ * @type FloatValue
16
+ */
17
+ masterVolume;
18
+
19
+ /**
20
+ * @type BoolValue
21
+ */
22
+ musicOn;
23
+
24
+ /**
25
+ * @type BoolValue
26
+ */
27
+ paused;
28
+
29
+ /**
30
+ * @type FloatValue
31
+ */
32
+ musicVolume;
33
+
34
+ /**
35
+ * @type BoolValue
36
+ */
37
+ soundsOn;
38
+
39
+ /**
40
+ * @type FloatValue
41
+ */
42
+ soundsVolume;
43
+
44
+ /**
45
+ * @type ModelNodeCollection<AudioModel>
46
+ */
47
+ music;
48
+
49
+ /**
50
+ * @type ModelNodeCollection<AudioModel>
51
+ */
52
+ sounds;
53
+
54
+ constructor(persistent = true) {
55
+ super(persistent);
56
+
57
+ this.audioOn = this.addProperty('audioOn', new BoolValue(true));
58
+ this.masterVolume = this.addProperty('masterVolume', new FloatValue(1));
59
+ this.paused = this.addProperty('paused', new BoolValue(false));
60
+
61
+ this.musicOn = this.addProperty('musicOn', new BoolValue(true));
62
+ this.musicVolume = this.addProperty('musicVolume', new FloatValue(1));
63
+
64
+ this.soundsOn = this.addProperty('soundsOn', new BoolValue(true));
65
+ this.soundsVolume = this.addProperty('soundsVolume', new FloatValue(1));
66
+
67
+ this.music = this.addProperty('music', new ModelNodeCollection(null, false));
68
+ this.sounds = this.addProperty('sounds', new ModelNodeCollection(null, false));
69
+ }
70
+
71
+ playSound(url, loop = false) {
72
+ const sound = new AudioModel();
73
+ sound.url.set(url);
74
+ sound.loop.set(loop);
75
+ sound.playing.set(true);
76
+ this.sounds.add(sound);
77
+ return sound;
78
+ }
79
+
80
+ removeSound(audio) {
81
+ this.sounds.remove(audio);
82
+ }
83
+
84
+ changeMusic(audio) {
85
+ this.music.reset();
86
+ this.music.add(audio);
87
+ }
88
+ }
@@ -1,108 +1,108 @@
1
- import CollectionRenderer from "../../renderer/generic/CollectionRenderer";
2
- import AudioRenderer from "../AudioRenderer";
3
- import RendererBase from "../../renderer/RendererBase";
4
- import ConditionalNodeRenderer from "../../renderer/generic/ConditionalNodeRenderer";
5
-
6
- export default class GlobalAudioRenderer extends RendererBase {
7
-
8
- /**
9
- * @type GlobalAudioModel
10
- */
11
- model;
12
-
13
- /**
14
- * @type AudioContext
15
- */
16
- audioContext;
17
-
18
- constructor(game, model) {
19
- super(game, model);
20
-
21
- this.model = model;
22
-
23
- this.addChild(
24
- new ConditionalNodeRenderer(
25
- this.game,
26
- this.model.musicOn,
27
- () => this.model.musicOn.get(),
28
- () => {
29
- return new CollectionRenderer(
30
- this.game,
31
- this.model.music,
32
- (m) => new AudioRenderer(this.game, m, this.audioContext, this.musicGainNode)
33
- )
34
- }
35
- )
36
- );
37
-
38
- this.addChild(
39
- new ConditionalNodeRenderer(
40
- this.game,
41
- this.model.soundsOn,
42
- () => this.model.soundsOn.get(),
43
- () => {
44
- return new CollectionRenderer(
45
- this.game,
46
- this.model.sounds,
47
- (m) => new AudioRenderer(this.game, m, this.audioContext, this.soundsGainNode)
48
- )
49
- }
50
- )
51
- );
52
- }
53
-
54
- activateInternal() {
55
- this.audioContext = new AudioContext();
56
-
57
- this.masterGainNode = this.audioContext.createGain();
58
- this.musicGainNode = this.audioContext.createGain();
59
- this.soundsGainNode = this.audioContext.createGain();
60
-
61
- this.musicGainNode.connect(this.masterGainNode);
62
- this.soundsGainNode.connect(this.masterGainNode);
63
- this.masterGainNode.connect(this.audioContext.destination);
64
-
65
- this.updateMasterVolume();
66
- this.updateSoundsVolume();
67
- this.updateMusicVolume();
68
- }
69
-
70
- deactivateInternal() {
71
-
72
- this.masterGainNode.disconnect();
73
- this.soundsGainNode.disconnect();
74
- this.musicGainNode.disconnect();
75
-
76
- this.masterGainNode = null;
77
- this.soundsGainNode = null;
78
- this.musicGainNode = null;
79
- this.audioContext = null;
80
- }
81
-
82
- renderInternal() {
83
- if (this.audioContext.state === "suspended") {
84
- this.audioContext.resume();
85
- }
86
- if (this.model.masterVolume.isDirty) {
87
- this.updateMasterVolume();
88
- }
89
- if (this.model.musicVolume.isDirty) {
90
- this.updateMusicVolume();
91
- }
92
- if (this.model.soundsVolume.isDirty) {
93
- this.updateSoundsVolume();
94
- }
95
- }
96
-
97
- updateMasterVolume() {
98
- this.masterGainNode.gain.value = this.model.masterVolume.get();
99
- }
100
-
101
- updateMusicVolume() {
102
- this.musicGainNode.gain.value = this.model.musicVolume.get();
103
- }
104
-
105
- updateSoundsVolume() {
106
- this.soundsGainNode.gain.value = this.model.soundsVolume.get();
107
- }
108
- }
1
+ import CollectionRenderer from "../../renderer/generic/CollectionRenderer";
2
+ import AudioRenderer from "../AudioRenderer";
3
+ import RendererBase from "../../renderer/RendererBase";
4
+ import ConditionalNodeRenderer from "../../renderer/generic/ConditionalNodeRenderer";
5
+
6
+ export default class GlobalAudioRenderer extends RendererBase {
7
+
8
+ /**
9
+ * @type GlobalAudioModel
10
+ */
11
+ model;
12
+
13
+ /**
14
+ * @type AudioContext
15
+ */
16
+ audioContext;
17
+
18
+ constructor(game, model) {
19
+ super(game, model);
20
+
21
+ this.model = model;
22
+
23
+ this.addChild(
24
+ new ConditionalNodeRenderer(
25
+ this.game,
26
+ this.model.musicOn,
27
+ () => this.model.musicOn.get(),
28
+ () => {
29
+ return new CollectionRenderer(
30
+ this.game,
31
+ this.model.music,
32
+ (m) => new AudioRenderer(this.game, m, this.audioContext, this.musicGainNode)
33
+ )
34
+ }
35
+ )
36
+ );
37
+
38
+ this.addChild(
39
+ new ConditionalNodeRenderer(
40
+ this.game,
41
+ this.model.soundsOn,
42
+ () => this.model.soundsOn.get(),
43
+ () => {
44
+ return new CollectionRenderer(
45
+ this.game,
46
+ this.model.sounds,
47
+ (m) => new AudioRenderer(this.game, m, this.audioContext, this.soundsGainNode)
48
+ )
49
+ }
50
+ )
51
+ );
52
+ }
53
+
54
+ activateInternal() {
55
+ this.audioContext = new AudioContext();
56
+
57
+ this.masterGainNode = this.audioContext.createGain();
58
+ this.musicGainNode = this.audioContext.createGain();
59
+ this.soundsGainNode = this.audioContext.createGain();
60
+
61
+ this.musicGainNode.connect(this.masterGainNode);
62
+ this.soundsGainNode.connect(this.masterGainNode);
63
+ this.masterGainNode.connect(this.audioContext.destination);
64
+
65
+ this.updateMasterVolume();
66
+ this.updateSoundsVolume();
67
+ this.updateMusicVolume();
68
+ }
69
+
70
+ deactivateInternal() {
71
+
72
+ this.masterGainNode.disconnect();
73
+ this.soundsGainNode.disconnect();
74
+ this.musicGainNode.disconnect();
75
+
76
+ this.masterGainNode = null;
77
+ this.soundsGainNode = null;
78
+ this.musicGainNode = null;
79
+ this.audioContext = null;
80
+ }
81
+
82
+ renderInternal() {
83
+ if (this.audioContext.state === "suspended") {
84
+ this.audioContext.resume();
85
+ }
86
+ if (this.model.masterVolume.isDirty) {
87
+ this.updateMasterVolume();
88
+ }
89
+ if (this.model.musicVolume.isDirty) {
90
+ this.updateMusicVolume();
91
+ }
92
+ if (this.model.soundsVolume.isDirty) {
93
+ this.updateSoundsVolume();
94
+ }
95
+ }
96
+
97
+ updateMasterVolume() {
98
+ this.masterGainNode.gain.value = this.model.masterVolume.get();
99
+ }
100
+
101
+ updateMusicVolume() {
102
+ this.musicGainNode.gain.value = this.model.musicVolume.get();
103
+ }
104
+
105
+ updateSoundsVolume() {
106
+ this.soundsGainNode.gain.value = this.model.soundsVolume.get();
107
+ }
108
+ }
@@ -1,37 +1,37 @@
1
- import ControllerBase from "./ControllerBase";
2
-
3
- export default class AnimationController extends ControllerBase {
4
-
5
- /**
6
- * @type () => any|null
7
- */
8
- onFinishedHandler;
9
-
10
- /**
11
- *
12
- * @param game GameModel
13
- * @param model DirtyValue
14
- * @param onFinished () => any|null
15
- */
16
- constructor(game, model, onFinished = null) {
17
- super(game, model);
18
-
19
- this.onFinishedHandler = onFinished;
20
- }
21
-
22
- /**
23
- *
24
- * @param func () => any
25
- * @returns {AnimationController}
26
- */
27
- onFinished(func) {
28
- this.onFinishedHandler = func;
29
- return this;
30
- }
31
-
32
- finished() {
33
- this.removeMyself();
34
- if (this.onFinishedHandler) this.onFinishedHandler();
35
- }
36
-
37
- }
1
+ import ControllerBase from "./ControllerBase";
2
+
3
+ export default class AnimationController extends ControllerBase {
4
+
5
+ /**
6
+ * @type () => any|null
7
+ */
8
+ onFinishedHandler;
9
+
10
+ /**
11
+ *
12
+ * @param game GameModel
13
+ * @param model DirtyValue
14
+ * @param onFinished () => any|null
15
+ */
16
+ constructor(game, model, onFinished = null) {
17
+ super(game, model);
18
+
19
+ this.onFinishedHandler = onFinished;
20
+ }
21
+
22
+ /**
23
+ *
24
+ * @param func () => any
25
+ * @returns {AnimationController}
26
+ */
27
+ onFinished(func) {
28
+ this.onFinishedHandler = func;
29
+ return this;
30
+ }
31
+
32
+ finished() {
33
+ this.removeMyself();
34
+ if (this.onFinishedHandler) this.onFinishedHandler();
35
+ }
36
+
37
+ }
@@ -1,56 +1,56 @@
1
- import AnimationController from "./AnimationController";
2
-
3
- export default class AnimationDelayController extends AnimationController {
4
-
5
- /**
6
- * @type FloatValue
7
- */
8
- model;
9
-
10
- /**
11
- * @type Number
12
- */
13
- duration;
14
-
15
- /**
16
- * @type Number
17
- */
18
- remaining;
19
-
20
- /**
21
- * @type boolean
22
- */
23
- repeat;
24
-
25
- /**
26
- *
27
- * @param game GameModel
28
- * @param model DirtyValue
29
- * @param duration Number
30
- * @param repeat boolean
31
- */
32
- constructor(game, model, duration, repeat = false) {
33
- super(game, model);
34
- this.model = model;
35
- this.duration = duration;
36
- this.remaining = duration;
37
- this.repeat = repeat;
38
- }
39
-
40
- updateInternal(delta) {
41
- this.remaining -= delta;
42
- if (this.remaining <= 0) {
43
- this.finished();
44
- }
45
- }
46
-
47
- finished() {
48
- if (this.onFinishedHandler) this.onFinishedHandler();
49
- if (this.repeat) {
50
- this.remaining += this.duration;
51
- } else {
52
- this.removeMyself();
53
- }
54
- }
55
-
56
- }
1
+ import AnimationController from "./AnimationController";
2
+
3
+ export default class AnimationDelayController extends AnimationController {
4
+
5
+ /**
6
+ * @type FloatValue
7
+ */
8
+ model;
9
+
10
+ /**
11
+ * @type Number
12
+ */
13
+ duration;
14
+
15
+ /**
16
+ * @type Number
17
+ */
18
+ remaining;
19
+
20
+ /**
21
+ * @type boolean
22
+ */
23
+ repeat;
24
+
25
+ /**
26
+ *
27
+ * @param game GameModel
28
+ * @param model DirtyValue
29
+ * @param duration Number
30
+ * @param repeat boolean
31
+ */
32
+ constructor(game, model, duration, repeat = false) {
33
+ super(game, model);
34
+ this.model = model;
35
+ this.duration = duration;
36
+ this.remaining = duration;
37
+ this.repeat = repeat;
38
+ }
39
+
40
+ updateInternal(delta) {
41
+ this.remaining -= delta;
42
+ if (this.remaining <= 0) {
43
+ this.finished();
44
+ }
45
+ }
46
+
47
+ finished() {
48
+ if (this.onFinishedHandler) this.onFinishedHandler();
49
+ if (this.repeat) {
50
+ this.remaining += this.duration;
51
+ } else {
52
+ this.removeMyself();
53
+ }
54
+ }
55
+
56
+ }
@@ -1,39 +1,39 @@
1
- import AnimationController from "./AnimationController";
2
- import {EASING_FLAT} from "../animation/ProgressValue";
3
- import AnimatedValue from "../animation/AnimatedValue";
4
-
5
- export default class AnimationFloatController extends AnimationController {
6
-
7
- /**
8
- * @type FloatValue
9
- */
10
- model;
11
-
12
- /**
13
- * @type AnimatedValue
14
- */
15
- animated;
16
-
17
- /**
18
- *
19
- * @param game GameModel
20
- * @param model DirtyValue
21
- * @param target Number
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 AnimatedValue(model.get(), target, 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
- }
1
+ import AnimationController from "./AnimationController";
2
+ import {EASING_FLAT} from "../animation/ProgressValue";
3
+ import AnimatedValue from "../animation/AnimatedValue";
4
+
5
+ export default class AnimationFloatController extends AnimationController {
6
+
7
+ /**
8
+ * @type FloatValue
9
+ */
10
+ model;
11
+
12
+ /**
13
+ * @type AnimatedValue
14
+ */
15
+ animated;
16
+
17
+ /**
18
+ *
19
+ * @param game GameModel
20
+ * @param model DirtyValue
21
+ * @param target Number
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 AnimatedValue(model.get(), target, 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
+ }