bard-legends-framework 0.9.5 → 0.9.7
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.
- package/dist/_interfaces/index.d.ts +2 -2
- package/dist/_interfaces/index.js +2 -3
- package/dist/game-entities/attachable/attachable.d.ts +6 -6
- package/dist/game-entities/attachable/attachable.js +28 -30
- package/dist/game-entities/attachable/attachable.spec.js +129 -128
- package/dist/game-entities/attachable/attachable.store.d.ts +5 -5
- package/dist/game-entities/attachable/attachable.store.js +34 -32
- package/dist/game-entities/attachable/attachable.test.js +132 -131
- package/dist/game-entities/attachable/destroyable.d.ts +13 -13
- package/dist/game-entities/attachable/destroyable.js +64 -69
- package/dist/game-entities/attachable/helpers/decorate-actions-lib.d.ts +15 -15
- package/dist/game-entities/attachable/helpers/decorate-actions-lib.js +125 -116
- package/dist/game-entities/attachable/helpers/referance-variable.d.ts +15 -15
- package/dist/game-entities/attachable/helpers/referance-variable.js +47 -48
- package/dist/game-entities/attachable/interfaces.d.ts +6 -6
- package/dist/game-entities/attachable/interfaces.js +2 -3
- package/dist/game-entities/base/helpers/decorate-actions-lib.js +0 -1
- package/dist/game-entities/controller/controller.js +0 -1
- package/dist/game-entities/controller/controller.spec.js +128 -125
- package/dist/game-entities/entity/entity.spec.js +263 -293
- package/dist/game-entities/entity/helpers/view-creation.helper.d.ts +7 -7
- package/dist/game-entities/entity/helpers/view-creation.helper.js +48 -48
- package/dist/game-entities/scene/scene.spec.js +219 -223
- package/dist/game-entities/service/service.js +0 -4
- package/dist/game-entities/service/service.spec.js +265 -237
- package/dist/game-entities/service/service.test.js +4 -2
- package/dist/game-entities/update-loop.d.ts +18 -18
- package/dist/game-entities/update-loop.js +46 -28
- package/dist/game-entities/view/view.js +1 -1
- package/dist/game-entities/view/view.spec.js +490 -506
- package/dist/game-entities/view/view.test.js +1 -1
- package/dist/lib/animator/animations.d.ts +13 -13
- package/dist/lib/animator/animations.js +43 -40
- package/dist/lib/animator/animator.d.ts +41 -41
- package/dist/lib/animator/animator.js +194 -197
- package/dist/lib/animator/animator.spec.js +699 -612
- package/dist/lib/animator/index.js +24 -19
- package/dist/lib/libraries/animator/animations.d.ts +13 -13
- package/dist/lib/libraries/animator/animations.js +43 -40
- package/dist/lib/libraries/animator/animator.d.ts +41 -41
- package/dist/lib/libraries/animator/animator.js +194 -197
- package/dist/lib/libraries/animator/animator.spec.js +699 -612
- package/dist/lib/libraries/animator/index.js +24 -19
- package/dist/lib/libraries/path-finder/path-finder.d.ts +2 -2
- package/dist/lib/libraries/path-finder/path-finder.js +19 -20
- package/dist/lib/path-finder/path-finder.d.ts +2 -2
- package/dist/lib/path-finder/path-finder.js +19 -20
- package/dist/lib/services/keyboard/keyboard.d.ts +4 -4
- package/dist/lib/services/keyboard/keyboard.js +39 -31
- package/dist/lib/services/mouse/mouse.service.d.ts +8 -8
- package/dist/lib/services/mouse/mouse.service.js +65 -53
- package/dist/lib/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/lib/services/mouse/mouser-target-focus.service.js +83 -81
- package/dist/lib/update-loop.d.ts +10 -10
- package/dist/lib/update-loop.js +35 -27
- package/dist/physics/entitity-types/immovable-physics-entity.d.ts +6 -6
- package/dist/physics/entitity-types/immovable-physics-entity.js +23 -24
- package/dist/physics/entitity-types/movable-entity.d.ts +6 -6
- package/dist/physics/entitity-types/movable-entity.js +21 -22
- package/dist/physics/entitity-types/movable-physics-entity.d.ts +14 -14
- package/dist/physics/entitity-types/movable-physics-entity.js +83 -88
- package/dist/physics/entitity-types/physics-entity.d.ts +23 -23
- package/dist/physics/entitity-types/physics-entity.js +97 -88
- package/dist/physics/helpers/closest-available-space.helper.d.ts +16 -16
- package/dist/physics/helpers/closest-available-space.helper.js +98 -96
- package/dist/physics/helpers/closest-available-space.helper.spec.js +115 -68
- package/dist/physics/helpers/p2js.helper.d.ts +3 -3
- package/dist/physics/helpers/p2js.helper.js +21 -22
- package/dist/physics/helpers/shape-factory.d.ts +9 -4
- package/dist/physics/helpers/shape-factory.js +99 -75
- package/dist/physics/libs/p2js.helper.js +1 -1
- package/dist/physics/libs/position-to-grid-position-converter.d.ts +3 -3
- package/dist/physics/libs/position-to-grid-position-converter.js +15 -13
- package/dist/physics/module//360/237/223/220services/availability-grid.service.d.ts +10 -5
- package/dist/physics/module//360/237/223/220services/availability-grid.service.js +77 -57
- package/dist/physics/module//360/237/223/220services/border.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/border.service.js +57 -37
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/collisions.service.d.ts +7 -7
- package/dist/physics/module//360/237/223/220services/collisions.service.js +110 -98
- package/dist/physics/module//360/237/223/220services/debug-visuals.service.d.ts +28 -6
- package/dist/physics/module//360/237/223/220services/debug-visuals.service.js +121 -89
- package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.d.ts +15 -7
- package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.js +117 -93
- package/dist/physics/module//360/237/223/220services/explosion.service.d.ts +14 -7
- package/dist/physics/module//360/237/223/220services/explosion.service.js +102 -77
- package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.d.ts +15 -7
- package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.js +117 -93
- package/dist/physics/module//360/237/223/220services/explosions/explosion.service.d.ts +14 -7
- package/dist/physics/module//360/237/223/220services/explosions/explosion.service.js +102 -77
- package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.js +71 -67
- package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.js +71 -67
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/materials.service.d.ts +16 -11
- package/dist/physics/module//360/237/223/220services/materials.service.js +118 -108
- package/dist/physics/module//360/237/223/220services/path-finder.service.d.ts +19 -8
- package/dist/physics/module//360/237/223/220services/path-finder.service.js +121 -82
- package/dist/physics/module//360/237/223/220services/physics-world.service.d.ts +30 -15
- package/dist/physics/module//360/237/223/220services/physics-world.service.js +122 -100
- package/dist/physics/module//360/237/223/220services/ray-casting.service.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/ray-casting.service.js +87 -86
- package/dist/physics/module//360/237/223/220services/shape-creation.service.d.ts +9 -4
- package/dist/physics/module//360/237/223/220services/shape-creation.service.js +113 -84
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +2 -1
- package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.d.ts +8 -8
- package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.js +32 -33
- package/dist/physics/physics-world.d.ts +50 -34
- package/dist/physics/physics-world.js +142 -133
- package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.d.ts +3 -3
- package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.js +15 -13
- package/dist/physics/sub-elements/available-spaces/physics-availability-grid.d.ts +9 -9
- package/dist/physics/sub-elements/available-spaces/physics-availability-grid.js +82 -77
- package/dist/physics/sub-elements/available-spaces/physics-available-spaces.d.ts +18 -14
- package/dist/physics/sub-elements/available-spaces/physics-available-spaces.js +91 -79
- package/dist/physics/sub-elements/collisions/contact-equation-orginiser.d.ts +11 -11
- package/dist/physics/sub-elements/collisions/contact-equation-orginiser.js +84 -76
- package/dist/physics/sub-elements/collisions/physics-collision.d.ts +7 -7
- package/dist/physics/sub-elements/collisions/physics-collision.js +43 -44
- package/dist/physics/sub-elements/elements/physics-body-groups.d.ts +11 -11
- package/dist/physics/sub-elements/elements/physics-body-groups.js +54 -54
- package/dist/physics/sub-elements/elements/physics-materials.d.ts +15 -10
- package/dist/physics/sub-elements/elements/physics-materials.js +101 -100
- package/dist/physics/sub-elements/elements/physics-world-borders.d.ts +3 -3
- package/dist/physics/sub-elements/elements/physics-world-borders.js +69 -45
- package/dist/physics/sub-elements/physics-body-groups.d.ts +8 -8
- package/dist/physics/sub-elements/physics-body-groups.js +41 -42
- package/dist/physics/sub-elements/physics-collision.d.ts +16 -16
- package/dist/physics/sub-elements/physics-collision.js +141 -121
- package/dist/physics/sub-elements/physics-materials.d.ts +15 -10
- package/dist/physics/sub-elements/physics-materials.js +101 -100
- package/dist/physics/sub-elements/physics-world-borders.d.ts +2 -2
- package/dist/physics/sub-elements/physics-world-borders.js +25 -26
- package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.d.ts +15 -11
- package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.js +59 -59
- package/dist/physics/sub-elements/raycasting/physics-explosion.d.ts +13 -6
- package/dist/physics/sub-elements/raycasting/physics-explosion.js +108 -73
- package/dist/physics/sub-elements/raycasting/ray-cast.d.ts +19 -19
- package/dist/physics/sub-elements/raycasting/ray-cast.js +93 -98
- package/dist/pixi/display-object/components/filters.d.ts +18 -18
- package/dist/pixi/display-object/components/filters.js +106 -81
- package/dist/pixi/display-object/components/glow-effect.d.ts +8 -8
- package/dist/pixi/display-object/components/glow-effect.js +33 -36
- package/dist/pixi/display-object/components/glow-filter.d.ts +8 -8
- package/dist/pixi/display-object/components/glow-filter.js +33 -36
- package/dist/pixi/display-object/container-attributes.js +1 -1
- package/dist/pixi/display-object/display-object-attributes.d.ts +41 -41
- package/dist/pixi/display-object/display-object-attributes.js +148 -150
- package/dist/pixi/display-object/display-object.d.ts +17 -17
- package/dist/pixi/display-object/display-object.js +79 -75
- package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.d.ts +9 -4
- package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.js +89 -77
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js +30 -30
- package/dist/pixi/display-object/filters/base-filters/contrast-filter.d.ts +9 -4
- package/dist/pixi/display-object/filters/base-filters/contrast-filter.js +62 -53
- package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.d.ts +10 -5
- package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.js +93 -81
- package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.d.ts +12 -7
- package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.js +120 -109
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.d.ts +10 -5
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +32 -32
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.js +92 -85
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +28 -28
- package/dist/pixi/display-object/filters/templates/plane.template.js +20 -20
- package/dist/pixi/display-object/filters.js +20 -4
- package/dist/pixi/display-object/objects/components/filters.d.ts +18 -18
- package/dist/pixi/display-object/objects/components/filters.js +106 -81
- package/dist/pixi/display-object/objects/container.d.ts +2 -2
- package/dist/pixi/display-object/objects/container.js +39 -30
- package/dist/pixi/display-object/objects/graphics.d.ts +28 -28
- package/dist/pixi/display-object/objects/graphics.js +218 -202
- package/dist/pixi/display-object/objects/helpers/filters.d.ts +25 -25
- package/dist/pixi/display-object/objects/helpers/filters.js +150 -124
- package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.d.ts +7 -7
- package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.js +114 -95
- package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.d.ts +5 -5
- package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.js +81 -57
- package/dist/pixi/display-object/objects/sprite.d.ts +43 -43
- package/dist/pixi/display-object/objects/sprite.js +248 -233
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +1 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +9 -9
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +1 -1
- package/dist/pixi/display-object/objects/text.d.ts +25 -25
- package/dist/pixi/display-object/objects/text.js +111 -102
- package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.d.ts +13 -9
- package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.js +96 -67
- package/dist/pixi/game.d.ts +1 -1
- package/dist/pixi/game.js +2 -2
- package/dist/pixi/helpers/glow-sprite-generator.d.ts +6 -6
- package/dist/pixi/helpers/glow-sprite-generator.js +99 -84
- package/dist/pixi/helpers/pixi-container.helper.d.ts +1 -1
- package/dist/pixi/helpers/pixi-container.helper.js +10 -8
- package/dist/pixi/helpers/screen-position-to-stage.helper.d.ts +1 -1
- package/dist/pixi/helpers/screen-position-to-stage.helper.js +12 -12
- package/dist/pixi/helpers/screen-position-to-stage.helper.test.js +174 -79
- package/dist/pixi/modules/CAMERA/index.d.ts +1 -1
- package/dist/pixi/modules/CAMERA/index.js +3 -3
- package/dist/services/keyboard/keyboard.d.ts +4 -4
- package/dist/services/keyboard/keyboard.js +39 -31
- package/dist/services/mouse/mouse.service.d.ts +8 -8
- package/dist/services/mouse/mouse.service.js +65 -53
- package/dist/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/services/mouse/mouser-target-focus.service.js +83 -81
- package/dist/utilities/libraries/animator/animating-content/state-animation.d.ts +29 -26
- package/dist/utilities/libraries/animator/animating-content/state-animation.js +159 -165
- package/dist/utilities/libraries/animator/animating-content/state-animation.test.js +386 -375
- package/dist/utilities/libraries/animator/animator.spec.js +765 -656
- package/dist/utilities/libraries/binary-heap/binary-heap.d.ts +11 -11
- package/dist/utilities/libraries/binary-heap/binary-heap.js +79 -81
- package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.d.ts +11 -11
- package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.js +79 -81
- package/dist/utilities/libraries/data-structures/grid/grid.d.ts +35 -31
- package/dist/utilities/libraries/data-structures/grid/grid.js +128 -117
- package/dist/utilities/libraries/data-structures/grid/grid.spec.js +176 -138
- package/dist/utilities/libraries/data-structures/grid/grid.test.js +218 -141
- package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.d.ts +3 -3
- package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.js +15 -13
- package/dist/utilities/libraries/data-structures/queue/queue.d.ts +21 -21
- package/dist/utilities/libraries/data-structures/queue/queue.js +63 -66
- package/dist/utilities/libraries/data-structures/queue/queue.test.js +54 -55
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.js +122 -68
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.js +140 -135
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.js +293 -229
- package/dist/utilities/libraries/path-finder/path-finder.d.ts +7 -7
- package/dist/utilities/libraries/path-finder/path-finder.js +113 -109
- package/dist/utilities/libraries/path-finder/path-finder.spec.js +131 -106
- package/dist/utilities/services/keyboard/keyboard.d.ts +4 -4
- package/dist/utilities/services/keyboard/keyboard.js +42 -34
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.d.ts +1 -1
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.js +12 -12
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.test.js +168 -73
- package/dist/utilities/services/mouse/mouse-target-focus.service.d.ts +15 -15
- package/dist/utilities/services/mouse/mouse-target-focus.service.js +79 -76
- package/dist/utilities/services/mouse/mouse.service.d.ts +9 -9
- package/dist/utilities/services/mouse/mouse.service.js +86 -72
- package/dist/utilities/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/utilities/services/mouse/mouser-target-focus.service.js +83 -81
- package/package.json +6 -12
|
@@ -32,8 +32,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
32
32
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const actions_lib_1 = require("actions-lib");
|
|
36
35
|
const ActionsLib = __importStar(require("actions-lib"));
|
|
36
|
+
const actions_lib_1 = require("actions-lib");
|
|
37
37
|
const helpers_lib_1 = require("helpers-lib");
|
|
38
38
|
const vitest_1 = require("vitest");
|
|
39
39
|
const decorate_actions_lib_1 = require("../base/helpers/decorate-actions-lib");
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
export interface AnimatorAnimation {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
start(): void;
|
|
3
|
+
multiplierFunction(t: number): number;
|
|
4
4
|
}
|
|
5
5
|
export declare class AnimationLineer implements AnimatorAnimation {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
start(): void;
|
|
7
|
+
multiplierFunction(t: number): number;
|
|
8
8
|
}
|
|
9
9
|
export declare class AnimationEaseInOut implements AnimatorAnimation {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
start(): void;
|
|
11
|
+
multiplierFunction(t: number): number;
|
|
12
12
|
}
|
|
13
13
|
export declare class AnimationEaseIn implements AnimatorAnimation {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
start(): void;
|
|
15
|
+
multiplierFunction(t: number): number;
|
|
16
16
|
}
|
|
17
17
|
export declare class AnimationEaseOut implements AnimatorAnimation {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
start(): void;
|
|
19
|
+
multiplierFunction(t: number): number;
|
|
20
20
|
}
|
|
21
21
|
export declare class AnimationFlicker implements AnimatorAnimation {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
private timeGrid;
|
|
23
|
+
start(): void;
|
|
24
|
+
multiplierFunction(t: number): number;
|
|
25
25
|
}
|
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
exports.AnimationFlicker =
|
|
3
|
+
exports.AnimationEaseOut =
|
|
4
|
+
exports.AnimationEaseIn =
|
|
5
|
+
exports.AnimationEaseInOut =
|
|
6
|
+
exports.AnimationLineer =
|
|
7
|
+
void 0;
|
|
8
|
+
const helpers_lib_1 = require('helpers-lib');
|
|
5
9
|
class AnimationLineer {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
start() {}
|
|
11
|
+
multiplierFunction(t) {
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
10
14
|
}
|
|
11
15
|
exports.AnimationLineer = AnimationLineer;
|
|
12
16
|
class AnimationEaseInOut {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return -0.5 * (--t * (t - 2) - 1);
|
|
20
|
-
}
|
|
17
|
+
start() {}
|
|
18
|
+
multiplierFunction(t) {
|
|
19
|
+
if ((t *= 2) < 1) {
|
|
20
|
+
return 0.5 * t * t;
|
|
21
|
+
} else {
|
|
22
|
+
return -0.5 * (--t * (t - 2) - 1);
|
|
21
23
|
}
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
exports.AnimationEaseInOut = AnimationEaseInOut;
|
|
24
27
|
class AnimationEaseIn {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
start() {}
|
|
29
|
+
multiplierFunction(t) {
|
|
30
|
+
return t ** 2;
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
exports.AnimationEaseIn = AnimationEaseIn;
|
|
31
34
|
class AnimationEaseOut {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
start() {}
|
|
36
|
+
multiplierFunction(t) {
|
|
37
|
+
return 1 - (1 - t) ** 2;
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
exports.AnimationEaseOut = AnimationEaseOut;
|
|
38
41
|
class AnimationFlicker {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
if (Math.random() < 0.2) {
|
|
48
|
-
helpers_lib_1.Random.randomIntegerBetween(0, 9);
|
|
49
|
-
this.timeGrid[helpers_lib_1.Random.randomIntegerBetween(0, 9)] = Math.random();
|
|
50
|
-
}
|
|
42
|
+
start() {
|
|
43
|
+
this.timeGrid = new Array(10).fill(0);
|
|
44
|
+
helpers_lib_1.Random.randomIntegerBetween(0, 9);
|
|
45
|
+
this.timeGrid[helpers_lib_1.Random.randomIntegerBetween(0, 9)] = Math.random();
|
|
46
|
+
if (Math.random() < 0.3) {
|
|
47
|
+
helpers_lib_1.Random.randomIntegerBetween(0, 9);
|
|
48
|
+
this.timeGrid[helpers_lib_1.Random.randomIntegerBetween(0, 9)] = Math.random();
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if (Math.random() < 0.2) {
|
|
51
|
+
helpers_lib_1.Random.randomIntegerBetween(0, 9);
|
|
52
|
+
this.timeGrid[helpers_lib_1.Random.randomIntegerBetween(0, 9)] = Math.random();
|
|
55
53
|
}
|
|
54
|
+
}
|
|
55
|
+
multiplierFunction(t) {
|
|
56
|
+
const index = Math.floor(t * 10);
|
|
57
|
+
return this.timeGrid[index];
|
|
58
|
+
}
|
|
56
59
|
}
|
|
57
60
|
exports.AnimationFlicker = AnimationFlicker;
|
|
58
|
-
//# sourceMappingURL=animations.js.map
|
|
61
|
+
//# sourceMappingURL=animations.js.map
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
import { AnimatorAnimation } from './animations';
|
|
2
2
|
export interface AnimationState {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
duration: number;
|
|
4
|
+
elapsedTime: number;
|
|
5
|
+
startingValue: number;
|
|
6
|
+
targetValue: number;
|
|
7
|
+
loop: boolean;
|
|
8
|
+
completeAnimationsHandling: CompleteAnimationsHandlingType;
|
|
9
9
|
}
|
|
10
10
|
export declare enum ReAnimateHandlingType {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
throwError = 'throwError',
|
|
12
|
+
ignore = 'ignore'
|
|
13
13
|
}
|
|
14
14
|
export declare enum CompleteAnimationsHandlingType {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
returnToOriginal = 'returnToOriginal',
|
|
16
|
+
stayInCurrentState = 'stayInCurrentState',
|
|
17
|
+
jumpToEnd = 'jumpToEnd'
|
|
18
18
|
}
|
|
19
19
|
export interface AnimationOptions<T> {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
duration?: number;
|
|
21
|
+
animation?: AnimatorAnimation;
|
|
22
|
+
loop?: boolean;
|
|
23
|
+
reAnimateHandling?: ReAnimateHandlingType;
|
|
24
|
+
completeAnimationsHandling?: CompleteAnimationsHandlingType;
|
|
25
25
|
}
|
|
26
26
|
export declare class Animator<T> {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
private static animatedObjects;
|
|
28
|
+
readonly targetObject: T;
|
|
29
|
+
private effectOn;
|
|
30
|
+
private defaultDuration;
|
|
31
|
+
private defaultAnimation;
|
|
32
|
+
private defaultLoop;
|
|
33
|
+
private defaultReAnimateHandling;
|
|
34
|
+
private defaultCompleteAnimationsHandling;
|
|
35
|
+
private onChangeCallback?;
|
|
36
|
+
private running;
|
|
37
|
+
private propertyStates;
|
|
38
|
+
private updateCycleSubscription;
|
|
39
|
+
constructor(target: T, effectOn: string | string[], options?: AnimationOptions<T>);
|
|
40
|
+
get isAnimating(): boolean;
|
|
41
|
+
getAnimationStateOfKey(key: string): AnimationState | undefined;
|
|
42
|
+
onChange(callback: (target: T) => void): Animator<T>;
|
|
43
|
+
pauseAnimations(): void;
|
|
44
|
+
resumeAnimations(): void;
|
|
45
|
+
completeAnimations(completeAnimationsHandling?: CompleteAnimationsHandlingType): void;
|
|
46
|
+
set(values: Record<string, any>): void;
|
|
47
|
+
animate(values: Record<string, any>, options?: AnimationOptions<T>): Promise<void>;
|
|
48
|
+
private startAnimate;
|
|
49
|
+
private update;
|
|
50
|
+
private subscribeUpdateCycle;
|
|
51
|
+
private checkPropertyValidity;
|
|
52
52
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.Animator = exports.CompleteAnimationsHandlingType = exports.ReAnimateHandlingType = void 0;
|
|
4
|
-
const helpers_lib_1 = require(
|
|
5
|
-
const update_loop_1 = require(
|
|
6
|
-
const animations_1 = require(
|
|
3
|
+
const helpers_lib_1 = require('helpers-lib');
|
|
4
|
+
const update_loop_1 = require('../update-loop');
|
|
5
|
+
const animations_1 = require('./animations');
|
|
7
6
|
var ReAnimateHandlingType;
|
|
8
|
-
(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
(ReAnimateHandlingType => {
|
|
8
|
+
ReAnimateHandlingType['throwError'] = 'throwError';
|
|
9
|
+
ReAnimateHandlingType['ignore'] = 'ignore';
|
|
10
|
+
// TODO: blendIn
|
|
12
11
|
})(ReAnimateHandlingType || (exports.ReAnimateHandlingType = ReAnimateHandlingType = {}));
|
|
13
12
|
var CompleteAnimationsHandlingType;
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
(CompleteAnimationsHandlingType => {
|
|
14
|
+
CompleteAnimationsHandlingType['returnToOriginal'] = 'returnToOriginal';
|
|
15
|
+
CompleteAnimationsHandlingType['stayInCurrentState'] = 'stayInCurrentState';
|
|
16
|
+
CompleteAnimationsHandlingType['jumpToEnd'] = 'jumpToEnd';
|
|
18
17
|
})(CompleteAnimationsHandlingType || (exports.CompleteAnimationsHandlingType = CompleteAnimationsHandlingType = {}));
|
|
19
18
|
const DEFAULT_DURATION = 200;
|
|
20
19
|
const DEFAULT_ANIMATION = new animations_1.AnimationLineer();
|
|
@@ -22,201 +21,199 @@ const DEFAULT_LOOP = false;
|
|
|
22
21
|
const DEFAULT_RE_ANIMATE_HANDLING = ReAnimateHandlingType.throwError;
|
|
23
22
|
const DEFAULT_COMPLETE_ANIMATIONS_HANDLING = CompleteAnimationsHandlingType.stayInCurrentState;
|
|
24
23
|
class Animator {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
this.targetObject = target;
|
|
40
|
-
this.effectOn = helpers_lib_1.Comparator.isArray(effectOn) ? new Set(effectOn) : new Set([effectOn]);
|
|
41
|
-
this.defaultDuration = options.duration || DEFAULT_DURATION;
|
|
42
|
-
this.defaultAnimation = options.animation || DEFAULT_ANIMATION;
|
|
43
|
-
this.defaultLoop = options.loop || DEFAULT_LOOP;
|
|
44
|
-
this.defaultReAnimateHandling = options.reAnimateHandling || DEFAULT_RE_ANIMATE_HANDLING;
|
|
45
|
-
this.defaultCompleteAnimationsHandling = options.completeAnimationsHandling || DEFAULT_COMPLETE_ANIMATIONS_HANDLING;
|
|
46
|
-
this.effectOn.forEach(key => {
|
|
47
|
-
if (!helpers_lib_1.Comparator.hasProperty(target, key)) {
|
|
48
|
-
throw new Error(`Animator: target does not have target property. Target property: '${key}'`);
|
|
49
|
-
}
|
|
50
|
-
else if (!helpers_lib_1.Comparator.isNumber(target[key])) {
|
|
51
|
-
throw new Error(`Animator: target property is not a number. Target property: '${key}'`);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
24
|
+
static {
|
|
25
|
+
Animator.animatedObjects = new Set();
|
|
26
|
+
}
|
|
27
|
+
constructor(target, effectOn, options = {}) {
|
|
28
|
+
this.effectOn = new Set();
|
|
29
|
+
this.running = true;
|
|
30
|
+
this.propertyStates = new Map();
|
|
31
|
+
if (!helpers_lib_1.Comparator.isObject(target)) {
|
|
32
|
+
throw new Error(`Animator: target is not an object! Target: '${target}'`);
|
|
33
|
+
} else if (Animator.animatedObjects.has(target)) {
|
|
34
|
+
throw new Error(`Animator: target is already animated! Target: '${target}'`);
|
|
35
|
+
} else {
|
|
36
|
+
Animator.animatedObjects.add(target);
|
|
54
37
|
}
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
this.targetObject = target;
|
|
39
|
+
this.effectOn = helpers_lib_1.Comparator.isArray(effectOn) ? new Set(effectOn) : new Set([effectOn]);
|
|
40
|
+
this.defaultDuration = options.duration || DEFAULT_DURATION;
|
|
41
|
+
this.defaultAnimation = options.animation || DEFAULT_ANIMATION;
|
|
42
|
+
this.defaultLoop = options.loop || DEFAULT_LOOP;
|
|
43
|
+
this.defaultReAnimateHandling = options.reAnimateHandling || DEFAULT_RE_ANIMATE_HANDLING;
|
|
44
|
+
this.defaultCompleteAnimationsHandling = options.completeAnimationsHandling || DEFAULT_COMPLETE_ANIMATIONS_HANDLING;
|
|
45
|
+
this.effectOn.forEach(key => {
|
|
46
|
+
if (!helpers_lib_1.Comparator.hasProperty(target, key)) {
|
|
47
|
+
throw new Error(`Animator: target does not have target property. Target property: '${key}'`);
|
|
48
|
+
} else if (!helpers_lib_1.Comparator.isNumber(target[key])) {
|
|
49
|
+
throw new Error(`Animator: target property is not a number. Target property: '${key}'`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
get isAnimating() {
|
|
54
|
+
return this.propertyStates.size > 0;
|
|
55
|
+
}
|
|
56
|
+
getAnimationStateOfKey(key) {
|
|
57
|
+
const propertyState = this.propertyStates.get(key);
|
|
58
|
+
if (propertyState) {
|
|
59
|
+
return {
|
|
60
|
+
duration: propertyState.duration,
|
|
61
|
+
elapsedTime: propertyState.elapsedTime,
|
|
62
|
+
startingValue: propertyState.startingValue,
|
|
63
|
+
targetValue: propertyState.targetValue,
|
|
64
|
+
loop: propertyState.loop,
|
|
65
|
+
completeAnimationsHandling: propertyState.completeAnimationsHandling
|
|
66
|
+
};
|
|
57
67
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
duration: propertyState.duration,
|
|
63
|
-
elapsedTime: propertyState.elapsedTime,
|
|
64
|
-
startingValue: propertyState.startingValue,
|
|
65
|
-
targetValue: propertyState.targetValue,
|
|
66
|
-
loop: propertyState.loop,
|
|
67
|
-
completeAnimationsHandling: propertyState.completeAnimationsHandling
|
|
68
|
-
};
|
|
69
|
-
}
|
|
68
|
+
}
|
|
69
|
+
onChange(callback) {
|
|
70
|
+
if (this.onChangeCallback) {
|
|
71
|
+
throw new Error('Animator: onChangeCallback is already set!');
|
|
70
72
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
this.onChangeCallback = callback;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
pauseAnimations() {
|
|
77
|
+
this.running = false;
|
|
78
|
+
}
|
|
79
|
+
resumeAnimations() {
|
|
80
|
+
this.running = true;
|
|
81
|
+
}
|
|
82
|
+
completeAnimations(completeAnimationsHandling) {
|
|
83
|
+
const triggerOnChange = this.isAnimating;
|
|
84
|
+
this.propertyStates.forEach((value, key) => {
|
|
85
|
+
const completeAnimationsHandlingFinal = completeAnimationsHandling || value.completeAnimationsHandling;
|
|
86
|
+
if (completeAnimationsHandlingFinal === CompleteAnimationsHandlingType.returnToOriginal) {
|
|
87
|
+
this.targetObject[key] = value.startingValue;
|
|
88
|
+
} else if (completeAnimationsHandlingFinal === CompleteAnimationsHandlingType.jumpToEnd) {
|
|
89
|
+
this.targetObject[key] = value.targetValue;
|
|
90
|
+
}
|
|
91
|
+
value.completionCallback();
|
|
92
|
+
this.propertyStates.delete(key);
|
|
93
|
+
});
|
|
94
|
+
triggerOnChange && this.onChangeCallback?.(this.targetObject);
|
|
95
|
+
}
|
|
96
|
+
set(values) {
|
|
97
|
+
Object.keys(values).forEach(key => {
|
|
98
|
+
this.checkPropertyValidity(key);
|
|
99
|
+
if (this.propertyStates.get(key)) {
|
|
100
|
+
throw new Error(`Animator: property is already being animated. Property: '${key}'`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
let triggerOnChange = false;
|
|
104
|
+
Object.keys(values).forEach(key => {
|
|
105
|
+
triggerOnChange = triggerOnChange || this.targetObject[key] !== values[key];
|
|
106
|
+
this.targetObject[key] = values[key];
|
|
107
|
+
});
|
|
108
|
+
triggerOnChange && this.onChangeCallback?.(this.targetObject);
|
|
109
|
+
}
|
|
110
|
+
async animate(values, options = {}) {
|
|
111
|
+
const valueKeys = Object.keys(values);
|
|
112
|
+
valueKeys.forEach(key => {
|
|
113
|
+
this.checkPropertyValidity(key);
|
|
114
|
+
});
|
|
115
|
+
return this.startAnimate(values, options);
|
|
116
|
+
}
|
|
117
|
+
startAnimate(values, options = {}) {
|
|
118
|
+
const reAnimateHandling = options.reAnimateHandling || this.defaultReAnimateHandling;
|
|
119
|
+
Object.keys(values).forEach(key => {
|
|
120
|
+
const previousState = this.propertyStates.get(key);
|
|
121
|
+
if (previousState) {
|
|
122
|
+
if (reAnimateHandling === ReAnimateHandlingType.throwError) {
|
|
123
|
+
throw new Error(`Animator: property is already being animated. Property: '${key}'`);
|
|
124
|
+
} else if (reAnimateHandling === ReAnimateHandlingType.ignore) {
|
|
125
|
+
delete values[key];
|
|
74
126
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return new Promise(resolveAll => {
|
|
130
|
+
Promise.all(
|
|
131
|
+
Object.keys(values).map(
|
|
132
|
+
key =>
|
|
133
|
+
new Promise(resolve => {
|
|
134
|
+
const duration = options.duration || this.defaultDuration;
|
|
135
|
+
const animation = options.animation || this.defaultAnimation;
|
|
136
|
+
const loop = options.loop || this.defaultLoop;
|
|
137
|
+
const completeAnimationsHandling = options.completeAnimationsHandling || this.defaultCompleteAnimationsHandling;
|
|
138
|
+
animation.start();
|
|
139
|
+
try {
|
|
140
|
+
this.propertyStates.set(key, {
|
|
141
|
+
duration,
|
|
142
|
+
animation,
|
|
143
|
+
elapsedTime: 0,
|
|
144
|
+
startingValue: this.targetObject[key],
|
|
145
|
+
targetValue: values[key],
|
|
146
|
+
loop,
|
|
147
|
+
completeAnimationsHandling,
|
|
148
|
+
completionCallback: () => {
|
|
149
|
+
resolve(undefined);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
} catch (e) {
|
|
153
|
+
resolveAll();
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
).then(() => {
|
|
158
|
+
resolveAll();
|
|
159
|
+
});
|
|
160
|
+
this.subscribeUpdateCycle();
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
update(delta) {
|
|
164
|
+
if (this.running) {
|
|
165
|
+
const triggerOnChange = this.propertyStates.size;
|
|
166
|
+
this.propertyStates.forEach((value, key) => {
|
|
167
|
+
value.elapsedTime += delta;
|
|
168
|
+
let animationIsCompete = value.elapsedTime >= value.duration;
|
|
169
|
+
if (animationIsCompete) {
|
|
170
|
+
if (value.loop) {
|
|
171
|
+
value.animation.start();
|
|
172
|
+
value.elapsedTime -= value.duration;
|
|
173
|
+
animationIsCompete = false;
|
|
174
|
+
} else {
|
|
175
|
+
if (value.completeAnimationsHandling === CompleteAnimationsHandlingType.returnToOriginal) {
|
|
176
|
+
this.targetObject[key] = value.startingValue;
|
|
177
|
+
} else {
|
|
178
|
+
this.targetObject[key] = value.targetValue;
|
|
93
179
|
}
|
|
94
180
|
value.completionCallback();
|
|
95
181
|
this.propertyStates.delete(key);
|
|
96
|
-
|
|
97
|
-
triggerOnChange && this.onChangeCallback?.(this.targetObject);
|
|
98
|
-
}
|
|
99
|
-
set(values) {
|
|
100
|
-
Object.keys(values).forEach(key => {
|
|
101
|
-
this.checkPropertyValidity(key);
|
|
102
|
-
if (this.propertyStates.get(key)) {
|
|
103
|
-
throw new Error(`Animator: property is already being animated. Property: '${key}'`);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
let triggerOnChange = false;
|
|
107
|
-
Object.keys(values).forEach(key => {
|
|
108
|
-
triggerOnChange = triggerOnChange || this.targetObject[key] !== values[key];
|
|
109
|
-
this.targetObject[key] = values[key];
|
|
110
|
-
});
|
|
111
|
-
triggerOnChange && this.onChangeCallback?.(this.targetObject);
|
|
112
|
-
}
|
|
113
|
-
async animate(values, options = {}) {
|
|
114
|
-
let valueKeys = Object.keys(values);
|
|
115
|
-
valueKeys.forEach(key => {
|
|
116
|
-
this.checkPropertyValidity(key);
|
|
117
|
-
});
|
|
118
|
-
return this.startAnimate(values, options);
|
|
119
|
-
}
|
|
120
|
-
startAnimate(values, options = {}) {
|
|
121
|
-
let reAnimateHandling = options.reAnimateHandling || this.defaultReAnimateHandling;
|
|
122
|
-
Object.keys(values).forEach(key => {
|
|
123
|
-
let previousState = this.propertyStates.get(key);
|
|
124
|
-
if (previousState) {
|
|
125
|
-
if (reAnimateHandling === ReAnimateHandlingType.throwError) {
|
|
126
|
-
throw new Error(`Animator: property is already being animated. Property: '${key}'`);
|
|
127
|
-
}
|
|
128
|
-
else if (reAnimateHandling === ReAnimateHandlingType.ignore) {
|
|
129
|
-
delete values[key];
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
return new Promise(resolveAll => {
|
|
134
|
-
Promise.all(Object.keys(values).map(key => new Promise(resolve => {
|
|
135
|
-
let duration = options.duration || this.defaultDuration;
|
|
136
|
-
let animation = options.animation || this.defaultAnimation;
|
|
137
|
-
let loop = options.loop || this.defaultLoop;
|
|
138
|
-
let completeAnimationsHandling = options.completeAnimationsHandling || this.defaultCompleteAnimationsHandling;
|
|
139
|
-
animation.start();
|
|
140
|
-
try {
|
|
141
|
-
this.propertyStates.set(key, {
|
|
142
|
-
duration,
|
|
143
|
-
animation,
|
|
144
|
-
elapsedTime: 0,
|
|
145
|
-
startingValue: this.targetObject[key],
|
|
146
|
-
targetValue: values[key],
|
|
147
|
-
loop,
|
|
148
|
-
completeAnimationsHandling,
|
|
149
|
-
completionCallback: () => {
|
|
150
|
-
resolve(undefined);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
catch (e) {
|
|
155
|
-
resolveAll();
|
|
156
|
-
}
|
|
157
|
-
}))).then(() => {
|
|
158
|
-
resolveAll();
|
|
159
|
-
});
|
|
160
|
-
this.subscribeUpdateCycle();
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
update(delta) {
|
|
164
|
-
if (this.running) {
|
|
165
|
-
let triggerOnChange = this.propertyStates.size;
|
|
166
|
-
this.propertyStates.forEach((value, key) => {
|
|
167
|
-
value.elapsedTime += delta;
|
|
168
|
-
let animationIsCompete = value.elapsedTime >= value.duration;
|
|
169
|
-
if (animationIsCompete) {
|
|
170
|
-
if (value.loop) {
|
|
171
|
-
value.animation.start();
|
|
172
|
-
value.elapsedTime -= value.duration;
|
|
173
|
-
animationIsCompete = false;
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
if (value.completeAnimationsHandling === CompleteAnimationsHandlingType.returnToOriginal) {
|
|
177
|
-
this.targetObject[key] = value.startingValue;
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
this.targetObject[key] = value.targetValue;
|
|
181
|
-
}
|
|
182
|
-
value.completionCallback();
|
|
183
|
-
this.propertyStates.delete(key);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (!animationIsCompete) {
|
|
187
|
-
let multiplier = value.animation.multiplierFunction(value.elapsedTime / value.duration);
|
|
188
|
-
let relativeTarget = value.targetValue - value.startingValue;
|
|
189
|
-
this.targetObject[key] = relativeTarget * multiplier + value.startingValue;
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
triggerOnChange && this.onChangeCallback?.(this.targetObject);
|
|
193
|
-
if (this.propertyStates.size <= 0) {
|
|
194
|
-
this.updateCycleSubscription?.unsubscribe();
|
|
195
|
-
}
|
|
182
|
+
}
|
|
196
183
|
}
|
|
197
|
-
|
|
198
|
-
|
|
184
|
+
if (!animationIsCompete) {
|
|
185
|
+
const multiplier = value.animation.multiplierFunction(value.elapsedTime / value.duration);
|
|
186
|
+
const relativeTarget = value.targetValue - value.startingValue;
|
|
187
|
+
this.targetObject[key] = relativeTarget * multiplier + value.startingValue;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
triggerOnChange && this.onChangeCallback?.(this.targetObject);
|
|
191
|
+
if (this.propertyStates.size <= 0) {
|
|
199
192
|
this.updateCycleSubscription?.unsubscribe();
|
|
200
|
-
|
|
201
|
-
.subscribe(update => {
|
|
202
|
-
try {
|
|
203
|
-
this.update(update.delta);
|
|
204
|
-
}
|
|
205
|
-
catch (e) {
|
|
206
|
-
this.propertyStates.forEach(value => {
|
|
207
|
-
value.completionCallback();
|
|
208
|
-
});
|
|
209
|
-
this.propertyStates = new Map();
|
|
210
|
-
this.updateCycleSubscription?.unsubscribe();
|
|
211
|
-
}
|
|
212
|
-
})
|
|
213
|
-
.skipAttachCheck();
|
|
193
|
+
}
|
|
214
194
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
195
|
+
}
|
|
196
|
+
subscribeUpdateCycle() {
|
|
197
|
+
this.updateCycleSubscription?.unsubscribe();
|
|
198
|
+
this.updateCycleSubscription = update_loop_1.UpdateCycle.updateAction
|
|
199
|
+
.subscribe(update => {
|
|
200
|
+
try {
|
|
201
|
+
this.update(update.delta);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
this.propertyStates.forEach(value => {
|
|
204
|
+
value.completionCallback();
|
|
205
|
+
});
|
|
206
|
+
this.propertyStates = new Map();
|
|
207
|
+
this.updateCycleSubscription?.unsubscribe();
|
|
218
208
|
}
|
|
209
|
+
})
|
|
210
|
+
.skipAttachCheck();
|
|
211
|
+
}
|
|
212
|
+
checkPropertyValidity(key) {
|
|
213
|
+
if (!this.effectOn.has(key)) {
|
|
214
|
+
throw new Error(`Animator: not effected property is tried to update. Key: '${key}', EffectOn: '${this.effectOn}'`);
|
|
219
215
|
}
|
|
216
|
+
}
|
|
220
217
|
}
|
|
221
218
|
exports.Animator = Animator;
|
|
222
|
-
//# sourceMappingURL=animator.js.map
|
|
219
|
+
//# sourceMappingURL=animator.js.map
|