bard-legends-framework 0.9.4 → 0.9.5
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/game-entities/attachable/attachable.spec.d.ts +1 -0
- package/dist/game-entities/attachable/attachable.spec.js +136 -0
- package/dist/game-entities/controller/controller.spec.d.ts +1 -0
- package/dist/game-entities/controller/controller.spec.js +128 -0
- package/dist/game-entities/entity/entity.spec.d.ts +1 -0
- package/dist/game-entities/entity/entity.spec.js +301 -0
- package/dist/game-entities/scene/scene.spec.d.ts +1 -0
- package/dist/game-entities/scene/scene.spec.js +231 -0
- package/dist/game-entities/service/service.spec.d.ts +1 -0
- package/dist/game-entities/service/service.spec.js +245 -0
- package/dist/game-entities/view/view.spec.d.ts +1 -0
- package/dist/game-entities/view/view.spec.js +514 -0
- package/dist/lib/animator/animator.spec.d.ts +1 -0
- package/dist/lib/animator/animator.spec.js +615 -0
- package/dist/lib/libraries/animator/animator.spec.d.ts +1 -0
- package/dist/lib/libraries/animator/animator.spec.js +615 -0
- package/dist/physics/helpers/closest-available-space.helper.spec.d.ts +1 -0
- package/dist/physics/helpers/closest-available-space.helper.spec.js +71 -0
- package/dist/utilities/libraries/animator/animator.spec.d.ts +1 -0
- package/dist/utilities/libraries/animator/animator.spec.js +670 -0
- package/dist/utilities/libraries/data-structures/grid/grid.spec.d.ts +1 -0
- package/dist/utilities/libraries/data-structures/grid/grid.spec.js +140 -0
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.d.ts +1 -0
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.js +70 -0
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.d.ts +1 -0
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.js +164 -0
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.d.ts +1 -0
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.js +232 -0
- package/dist/utilities/libraries/path-finder/path-finder.spec.d.ts +1 -0
- package/dist/utilities/libraries/path-finder/path-finder.spec.js +133 -0
- package/package.json +6 -1
- package/.cursorignore +0 -4
- package/.eslintrc.js +0 -212
- package/.vscode/launch.json +0 -15
- package/.vscode/settings.json +0 -22
- package/dist/_interfaces/index.js.map +0 -1
- package/dist/game-entities/attachable/attachable.js.map +0 -1
- package/dist/game-entities/attachable/attachable.spec.js.map +0 -1
- package/dist/game-entities/attachable/attachable.store.js.map +0 -1
- package/dist/game-entities/attachable/attachable.test.js.map +0 -1
- package/dist/game-entities/attachable/destroyable.js.map +0 -1
- package/dist/game-entities/attachable/helpers/decorate-actions-lib.js.map +0 -1
- package/dist/game-entities/attachable/helpers/referance-variable.js.map +0 -1
- package/dist/game-entities/attachable/interfaces.js.map +0 -1
- package/dist/game-entities/base/attachable.js.map +0 -1
- package/dist/game-entities/base/attachable.test.js.map +0 -1
- package/dist/game-entities/base/destroyable.js.map +0 -1
- package/dist/game-entities/base/helpers/attachable.store.js.map +0 -1
- package/dist/game-entities/base/helpers/decorate-actions-lib.js.map +0 -1
- package/dist/game-entities/base/helpers/referance-variable.js.map +0 -1
- package/dist/game-entities/base/interfaces.js.map +0 -1
- package/dist/game-entities/controller/controller.js.map +0 -1
- package/dist/game-entities/controller/controller.spec.js.map +0 -1
- package/dist/game-entities/controller/controller.test.js.map +0 -1
- package/dist/game-entities/entity/entity.js.map +0 -1
- package/dist/game-entities/entity/entity.spec.js.map +0 -1
- package/dist/game-entities/entity/entity.test.js.map +0 -1
- package/dist/game-entities/entity/helpers/entity-store.helper.js.map +0 -1
- package/dist/game-entities/entity/helpers/entity-views.helper.js.map +0 -1
- package/dist/game-entities/entity/helpers/view-creation.helper.js.map +0 -1
- package/dist/game-entities/entity/singleton-entity.js.map +0 -1
- package/dist/game-entities/entity/singleton-entity.test.js.map +0 -1
- package/dist/game-entities/index.js.map +0 -1
- package/dist/game-entities/scene/scene.js.map +0 -1
- package/dist/game-entities/scene/scene.spec.js.map +0 -1
- package/dist/game-entities/scene/scene.test.js.map +0 -1
- package/dist/game-entities/service/service.js.map +0 -1
- package/dist/game-entities/service/service.spec.js.map +0 -1
- package/dist/game-entities/service/service.test.js.map +0 -1
- package/dist/game-entities/update-cycle.js.map +0 -1
- package/dist/game-entities/update-loop.js.map +0 -1
- package/dist/game-entities/view/view.js.map +0 -1
- package/dist/game-entities/view/view.spec.js.map +0 -1
- package/dist/game-entities/view/view.test.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/animator/animations.js.map +0 -1
- package/dist/lib/animator/animator.js.map +0 -1
- package/dist/lib/animator/animator.spec.js.map +0 -1
- package/dist/lib/animator/index.js.map +0 -1
- package/dist/lib/libraries/animator/animations.js.map +0 -1
- package/dist/lib/libraries/animator/animator.js.map +0 -1
- package/dist/lib/libraries/animator/animator.spec.js.map +0 -1
- package/dist/lib/libraries/animator/index.js.map +0 -1
- package/dist/lib/libraries/path-finder/path-finder.js.map +0 -1
- package/dist/lib/path-finder/path-finder.js.map +0 -1
- package/dist/lib/services/keyboard/keyboard.js.map +0 -1
- package/dist/lib/services/mouse/mouse.service.js.map +0 -1
- package/dist/lib/services/mouse/mouser-target-focus.service.js.map +0 -1
- package/dist/lib/update-loop.js.map +0 -1
- package/dist/physics/entitity-types/immovable-physics-entity.js.map +0 -1
- package/dist/physics/entitity-types/movable-entity.js.map +0 -1
- package/dist/physics/entitity-types/movable-physics-entity.js.map +0 -1
- package/dist/physics/entitity-types/physics-entity.js.map +0 -1
- package/dist/physics/entity-types/immovable-physics-entity.js.map +0 -1
- package/dist/physics/entity-types/movable-entity.js.map +0 -1
- package/dist/physics/entity-types/movable-physics-entity.js.map +0 -1
- package/dist/physics/entity-types/physics-entity.js.map +0 -1
- package/dist/physics/helpers/closest-available-space.helper.js.map +0 -1
- package/dist/physics/helpers/closest-available-space.helper.spec.js.map +0 -1
- package/dist/physics/helpers/p2js.helper.js.map +0 -1
- package/dist/physics/helpers/shape-factory.js.map +0 -1
- package/dist/physics/index.js.map +0 -1
- package/dist/physics/interfaces.js.map +0 -1
- package/dist/physics/libs/p2js.helper.js.map +0 -1
- package/dist/physics/libs/physics-body-groups.js.map +0 -1
- package/dist/physics/libs/position-to-grid-position-converter.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/responses.dto.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/shared-interfaces.dto.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/index.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/availability-grid.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/border.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/collisions.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/creation/border.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/creation/materials.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/debug-visuals.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/explosions/explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/impact/impact.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/materials.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/path-finder.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/physics-world.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/ray-casting.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/shape-creation.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js.map +0 -1
- package/dist/physics/module//360/237/247/212entities/border.entity.js.map +0 -1
- package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.js.map +0 -1
- package/dist/physics/module//360/237/247/212entities/physics-world.entity.js.map +0 -1
- package/dist/physics/physics-world.js.map +0 -1
- package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.js.map +0 -1
- package/dist/physics/sub-elements/available-spaces/physics-availability-grid.js.map +0 -1
- package/dist/physics/sub-elements/available-spaces/physics-available-spaces.js.map +0 -1
- package/dist/physics/sub-elements/collisions/contact-equation-orginiser.js.map +0 -1
- package/dist/physics/sub-elements/collisions/physics-collision.js.map +0 -1
- package/dist/physics/sub-elements/elements/physics-body-groups.js.map +0 -1
- package/dist/physics/sub-elements/elements/physics-materials.js.map +0 -1
- package/dist/physics/sub-elements/elements/physics-world-borders.js.map +0 -1
- package/dist/physics/sub-elements/physics-body-groups.js.map +0 -1
- package/dist/physics/sub-elements/physics-collision.js.map +0 -1
- package/dist/physics/sub-elements/physics-materials.js.map +0 -1
- package/dist/physics/sub-elements/physics-world-borders.js.map +0 -1
- package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.js.map +0 -1
- package/dist/physics/sub-elements/raycasting/physics-explosion.js.map +0 -1
- package/dist/physics/sub-elements/raycasting/ray-cast.js.map +0 -1
- package/dist/pixi/components/display-object-array.js.map +0 -1
- package/dist/pixi/components/helpers/smooth-scroller.js.map +0 -1
- package/dist/pixi/components/helpers/smooth-scroller.test.js.map +0 -1
- package/dist/pixi/components/mouse-wheel-listener.ui.js.map +0 -1
- package/dist/pixi/components/scroll-area.ui.js.map +0 -1
- package/dist/pixi/components/scroll-mask.ui.js.map +0 -1
- package/dist/pixi/display-object/components/filters.js.map +0 -1
- package/dist/pixi/display-object/components/glow-effect.js.map +0 -1
- package/dist/pixi/display-object/components/glow-filter.js.map +0 -1
- package/dist/pixi/display-object/container-attributes.js.map +0 -1
- package/dist/pixi/display-object/container.js.map +0 -1
- package/dist/pixi/display-object/display-object-attributes.js.map +0 -1
- package/dist/pixi/display-object/display-object.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/contrast-filter.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.js.map +0 -1
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.js.map +0 -1
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js.map +0 -1
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.test.js.map +0 -1
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js.map +0 -1
- package/dist/pixi/display-object/filters/templates/plane.template.js.map +0 -1
- package/dist/pixi/display-object/filters.js.map +0 -1
- package/dist/pixi/display-object/index.js.map +0 -1
- package/dist/pixi/display-object/objects/components/filters.js.map +0 -1
- package/dist/pixi/display-object/objects/container.js.map +0 -1
- package/dist/pixi/display-object/objects/graphics/graphics.js.map +0 -1
- package/dist/pixi/display-object/objects/graphics/helpers/dashed-line.helper.js.map +0 -1
- package/dist/pixi/display-object/objects/graphics.js.map +0 -1
- package/dist/pixi/display-object/objects/helpers/filters.js.map +0 -1
- package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.js.map +0 -1
- package/dist/pixi/display-object/objects/placeholder.js.map +0 -1
- package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.js.map +0 -1
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js.map +0 -1
- package/dist/pixi/display-object/objects/sprite/sprite.js.map +0 -1
- package/dist/pixi/display-object/objects/sprite.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/index.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/rich-text.js.map +0 -1
- package/dist/pixi/display-object/objects/text/text.js.map +0 -1
- package/dist/pixi/display-object/objects/text.js.map +0 -1
- package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.js.map +0 -1
- package/dist/pixi/game.js.map +0 -1
- package/dist/pixi/helpers/game-assets.js.map +0 -1
- package/dist/pixi/helpers/glow-sprite-generator.js.map +0 -1
- package/dist/pixi/helpers/pixi-container.helper.js.map +0 -1
- package/dist/pixi/helpers/position-conversion.helper.js.map +0 -1
- package/dist/pixi/helpers/position-conversion.helper.test.js.map +0 -1
- package/dist/pixi/helpers/screen-position-to-stage.helper.js.map +0 -1
- package/dist/pixi/helpers/screen-position-to-stage.helper.test.js.map +0 -1
- package/dist/pixi/index.js.map +0 -1
- package/dist/pixi/modules/CAMERA/camera.js.map +0 -1
- package/dist/pixi/modules/CAMERA/index.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera.gateway.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/index.js.map +0 -1
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js.map +0 -1
- package/dist/pixi/modules/CAMERA//360/237/247/212entities/camera.entity.js.map +0 -1
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js.map +0 -1
- package/dist/pixi/services/keyboard/keyboard.js.map +0 -1
- package/dist/pixi/services/mouse/mouse-target-focus.service.js.map +0 -1
- package/dist/pixi/services/mouse/mouse.service.js.map +0 -1
- package/dist/services/keyboard/keyboard.js.map +0 -1
- package/dist/services/mouse/mouse.service.js.map +0 -1
- package/dist/services/mouse/mouser-target-focus.service.js.map +0 -1
- package/dist/utilities/index.js.map +0 -1
- package/dist/utilities/libraries/animator/animating-content/fade-in-content.js.map +0 -1
- package/dist/utilities/libraries/animator/animating-content/slide-in-content.js.map +0 -1
- package/dist/utilities/libraries/animator/animating-content/state-animation.js.map +0 -1
- package/dist/utilities/libraries/animator/animating-content/state-animation.test.js.map +0 -1
- package/dist/utilities/libraries/animator/animations.js.map +0 -1
- package/dist/utilities/libraries/animator/animator.js.map +0 -1
- package/dist/utilities/libraries/animator/animator.spec.js.map +0 -1
- package/dist/utilities/libraries/animator/animator.test.js.map +0 -1
- package/dist/utilities/libraries/animator/index.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.test.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/state-animation.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/state-animation.test.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.test.js.map +0 -1
- package/dist/utilities/libraries/binary-heap/binary-heap.js.map +0 -1
- package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.js.map +0 -1
- package/dist/utilities/libraries/data-structures/grid/grid.js.map +0 -1
- package/dist/utilities/libraries/data-structures/grid/grid.spec.js.map +0 -1
- package/dist/utilities/libraries/data-structures/grid/grid.test.js.map +0 -1
- package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.js.map +0 -1
- package/dist/utilities/libraries/data-structures/queue/queue.js.map +0 -1
- package/dist/utilities/libraries/data-structures/queue/queue.test.js.map +0 -1
- package/dist/utilities/libraries/data-structures/vector-set/vector-set.js.map +0 -1
- package/dist/utilities/libraries/delta-time/delta-time.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.test.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.test.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/position-to-grid-position-converter.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js.map +0 -1
- package/dist/utilities/libraries/path-finder/path-finder.js.map +0 -1
- package/dist/utilities/libraries/path-finder/path-finder.spec.js.map +0 -1
- package/dist/utilities/services/keyboard/keyboard.js.map +0 -1
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.js.map +0 -1
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.test.js.map +0 -1
- package/dist/utilities/services/mouse/mouse-target-focus.service.js.map +0 -1
- package/dist/utilities/services/mouse/mouse.service.js.map +0 -1
- package/dist/utilities/services/mouse/mouser-target-focus.service.js.map +0 -1
- package/package.json.bak +0 -60
- package/scripts/prepare-package-json.ts +0 -23
- package/tsconfig.json +0 -24
- package/vitest.config.ts +0 -27
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const helpers_lib_1 = require("helpers-lib");
|
|
4
|
+
const animator_1 = require("./animator");
|
|
5
|
+
const animations_1 = require("./animations");
|
|
6
|
+
describe('ANIMATOR', () => {
|
|
7
|
+
describe('Setup', () => {
|
|
8
|
+
test('constructor should throw error if target is not an object', () => {
|
|
9
|
+
let obj = 'string';
|
|
10
|
+
expect(() => {
|
|
11
|
+
new animator_1.Animator(obj, 'x');
|
|
12
|
+
}).toThrow();
|
|
13
|
+
});
|
|
14
|
+
test('constructor should throw error if target does not have all target properties', () => {
|
|
15
|
+
let obj = { x: 1, y: 2, z: 3 };
|
|
16
|
+
expect(() => {
|
|
17
|
+
new animator_1.Animator(obj, ['x', 't']);
|
|
18
|
+
}).toThrow();
|
|
19
|
+
});
|
|
20
|
+
test('constructor should throw error if target property is not a number', () => {
|
|
21
|
+
let obj = { x: 'fail' };
|
|
22
|
+
expect(() => {
|
|
23
|
+
new animator_1.Animator(obj, ['x']);
|
|
24
|
+
}).toThrow();
|
|
25
|
+
});
|
|
26
|
+
test('animate should throw error if non effected property tried to animate', () => {
|
|
27
|
+
expect(() => {
|
|
28
|
+
let obj = { x: 0, y: 0 };
|
|
29
|
+
let animator = new animator_1.Animator(obj, ['x', 't']);
|
|
30
|
+
animator.animate({ x: 5, y: 5 });
|
|
31
|
+
}).toThrow();
|
|
32
|
+
});
|
|
33
|
+
test('should throw error if multiple animators decorate the same object', () => {
|
|
34
|
+
expect(() => {
|
|
35
|
+
let obj = { x: 0 };
|
|
36
|
+
new animator_1.Animator(obj, 'x');
|
|
37
|
+
new animator_1.Animator(obj, 'x');
|
|
38
|
+
}).toThrow();
|
|
39
|
+
});
|
|
40
|
+
test('setting multiple update callbacks should throw error', () => {
|
|
41
|
+
expect(() => {
|
|
42
|
+
let obj = { x: 0 };
|
|
43
|
+
new animator_1.Animator(obj, 'x').onChange(() => { }).onChange(() => { });
|
|
44
|
+
}).toThrow();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('Animate', () => {
|
|
48
|
+
test('animate should not change the value before the update ticks', () => {
|
|
49
|
+
let obj = { x: 0 };
|
|
50
|
+
let animator = new animator_1.Animator(obj, 'x');
|
|
51
|
+
animator.animate({ x: 5 });
|
|
52
|
+
expect(obj.x).toEqual(0);
|
|
53
|
+
});
|
|
54
|
+
test('animate to target in lineer', () => {
|
|
55
|
+
let obj = { x: 0 };
|
|
56
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 4, animation: new animations_1.AnimationLineer() });
|
|
57
|
+
animator.animate({ x: 4 });
|
|
58
|
+
animator['update'](1);
|
|
59
|
+
expect(obj.x).toEqual(1);
|
|
60
|
+
animator['update'](1);
|
|
61
|
+
expect(obj.x).toEqual(2);
|
|
62
|
+
animator['update'](1);
|
|
63
|
+
expect(obj.x).toEqual(3);
|
|
64
|
+
animator['update'](1);
|
|
65
|
+
expect(obj.x).toEqual(4);
|
|
66
|
+
});
|
|
67
|
+
test('animate only one property should not effect the other', () => {
|
|
68
|
+
let obj = { x: 0, y: 0 };
|
|
69
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 4, animation: new animations_1.AnimationLineer() });
|
|
70
|
+
animator.animate({ x: 4 });
|
|
71
|
+
animator['update'](1);
|
|
72
|
+
expect(obj).toEqual({ x: 1, y: 0 });
|
|
73
|
+
animator['update'](1);
|
|
74
|
+
expect(obj).toEqual({ x: 2, y: 0 });
|
|
75
|
+
animator['update'](1);
|
|
76
|
+
expect(obj).toEqual({ x: 3, y: 0 });
|
|
77
|
+
animator['update'](1);
|
|
78
|
+
expect(obj).toEqual({ x: 4, y: 0 });
|
|
79
|
+
});
|
|
80
|
+
test('animate with custom values should override the default settings', () => {
|
|
81
|
+
let obj = { x: 0 };
|
|
82
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 10, animation: new animations_1.AnimationLineer() });
|
|
83
|
+
animator.animate({ x: 10 }, { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
84
|
+
animator['update'](1);
|
|
85
|
+
expect(obj).toEqual({ x: 1.25 });
|
|
86
|
+
animator['update'](1);
|
|
87
|
+
expect(obj).toEqual({ x: 5 });
|
|
88
|
+
animator['update'](1);
|
|
89
|
+
expect(obj).toEqual({ x: 8.75 });
|
|
90
|
+
animator['update'](1);
|
|
91
|
+
expect(obj).toEqual({ x: 10 });
|
|
92
|
+
});
|
|
93
|
+
test('animate to target in easeInOut starting from zero', () => {
|
|
94
|
+
let obj = { x: 0 };
|
|
95
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
96
|
+
animator.animate({ x: 10 });
|
|
97
|
+
animator['update'](1);
|
|
98
|
+
expect(obj.x).toEqual(1.25);
|
|
99
|
+
animator['update'](1);
|
|
100
|
+
expect(obj.x).toEqual(5);
|
|
101
|
+
animator['update'](1);
|
|
102
|
+
expect(obj.x).toEqual(8.75);
|
|
103
|
+
animator['update'](1);
|
|
104
|
+
expect(obj.x).toEqual(10);
|
|
105
|
+
});
|
|
106
|
+
test('animate to target in easeInOut starting from different value than zero', () => {
|
|
107
|
+
let obj = { x: 10 };
|
|
108
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
109
|
+
animator.animate({ x: 20 });
|
|
110
|
+
animator['update'](1);
|
|
111
|
+
expect(obj.x).toEqual(11.25);
|
|
112
|
+
animator['update'](1);
|
|
113
|
+
expect(obj.x).toEqual(15);
|
|
114
|
+
animator['update'](1);
|
|
115
|
+
expect(obj.x).toEqual(18.75);
|
|
116
|
+
animator['update'](1);
|
|
117
|
+
expect(obj.x).toEqual(20);
|
|
118
|
+
});
|
|
119
|
+
test('animate to target and return back', () => {
|
|
120
|
+
let obj = { x: 0 };
|
|
121
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 1, animation: new animations_1.AnimationLineer() });
|
|
122
|
+
animator.animate({ x: 4 });
|
|
123
|
+
animator['update'](1);
|
|
124
|
+
animator.animate({ x: 0 });
|
|
125
|
+
animator['update'](1);
|
|
126
|
+
expect(obj.x).toEqual(0);
|
|
127
|
+
});
|
|
128
|
+
test('animate onChange callbacks', () => {
|
|
129
|
+
let obj = { x: 0 };
|
|
130
|
+
let valueFromOnStep = 0;
|
|
131
|
+
let onStepCallCount = 0;
|
|
132
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 4, animation: new animations_1.AnimationEaseInOut() }).onChange(item => {
|
|
133
|
+
valueFromOnStep = item.x;
|
|
134
|
+
onStepCallCount++;
|
|
135
|
+
});
|
|
136
|
+
animator.animate({ x: 10 });
|
|
137
|
+
expect(valueFromOnStep).toEqual(0);
|
|
138
|
+
expect(onStepCallCount).toEqual(0);
|
|
139
|
+
animator['update'](1);
|
|
140
|
+
expect(onStepCallCount).toEqual(1);
|
|
141
|
+
expect(valueFromOnStep).toEqual(1.25);
|
|
142
|
+
animator['update'](1);
|
|
143
|
+
expect(onStepCallCount).toEqual(2);
|
|
144
|
+
expect(valueFromOnStep).toEqual(5);
|
|
145
|
+
animator['update'](1);
|
|
146
|
+
expect(onStepCallCount).toEqual(3);
|
|
147
|
+
expect(valueFromOnStep).toEqual(8.75);
|
|
148
|
+
animator['update'](1);
|
|
149
|
+
expect(onStepCallCount).toEqual(4);
|
|
150
|
+
expect(valueFromOnStep).toEqual(10);
|
|
151
|
+
animator['update'](1);
|
|
152
|
+
animator['update'](1);
|
|
153
|
+
animator['update'](1);
|
|
154
|
+
expect(onStepCallCount).toEqual(4);
|
|
155
|
+
});
|
|
156
|
+
test('animate onChange should not be triggered before starting the animation', () => {
|
|
157
|
+
let onStepCallCount = 0;
|
|
158
|
+
let animator = new animator_1.Animator({ x: 0 }, 'x', { duration: 4, animation: new animations_1.AnimationEaseInOut() }).onChange(() => {
|
|
159
|
+
onStepCallCount++;
|
|
160
|
+
});
|
|
161
|
+
animator['update'](1);
|
|
162
|
+
expect(onStepCallCount).toEqual(0);
|
|
163
|
+
});
|
|
164
|
+
test('animation complete promise', async () => {
|
|
165
|
+
let obj = { x: 0 };
|
|
166
|
+
let completed = false;
|
|
167
|
+
let animator = new animator_1.Animator(obj, 'x');
|
|
168
|
+
animator.animate({ x: 1 }, { duration: 2 }).then(() => {
|
|
169
|
+
completed = true;
|
|
170
|
+
});
|
|
171
|
+
expect(completed).toBeFalsy();
|
|
172
|
+
animator['update'](1);
|
|
173
|
+
expect(completed).toBeFalsy();
|
|
174
|
+
animator['update'](1);
|
|
175
|
+
await (0, helpers_lib_1.Wait)();
|
|
176
|
+
expect(completed).toBeTruthy();
|
|
177
|
+
});
|
|
178
|
+
test('animate getter/setter property', () => {
|
|
179
|
+
class Foo {
|
|
180
|
+
constructor() {
|
|
181
|
+
this._x = 10;
|
|
182
|
+
}
|
|
183
|
+
get x() {
|
|
184
|
+
return this._x;
|
|
185
|
+
}
|
|
186
|
+
set x(value) {
|
|
187
|
+
this._x = value;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
let obj = new Foo();
|
|
191
|
+
let animator = new animator_1.Animator(obj, ['x'], { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
192
|
+
animator.animate({ x: 20 });
|
|
193
|
+
animator['update'](1);
|
|
194
|
+
expect(obj.x).toEqual(11.25);
|
|
195
|
+
animator['update'](1);
|
|
196
|
+
expect(obj.x).toEqual(15);
|
|
197
|
+
animator['update'](1);
|
|
198
|
+
expect(obj.x).toEqual(18.75);
|
|
199
|
+
animator['update'](1);
|
|
200
|
+
expect(obj.x).toEqual(20);
|
|
201
|
+
});
|
|
202
|
+
test('is animating should return true if it is animating', () => {
|
|
203
|
+
let animator = new animator_1.Animator({ x: 0 }, 'x', { duration: 1, animation: new animations_1.AnimationLineer() });
|
|
204
|
+
animator.animate({ x: 1 });
|
|
205
|
+
expect(animator.isAnimating).toBeTruthy();
|
|
206
|
+
});
|
|
207
|
+
test('is animating should return false if it is not animating', () => {
|
|
208
|
+
let obj = { x: 0 };
|
|
209
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 1, animation: new animations_1.AnimationLineer() });
|
|
210
|
+
expect(animator.isAnimating).toBeFalsy();
|
|
211
|
+
animator.animate({ x: 1 });
|
|
212
|
+
animator['update'](1);
|
|
213
|
+
expect(animator.isAnimating).toBeFalsy();
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
describe('Animation Cycle Changes', () => {
|
|
217
|
+
test('pause animations should halt the progress', async () => {
|
|
218
|
+
let obj = { x: 0 };
|
|
219
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 4, animation: new animations_1.AnimationLineer() });
|
|
220
|
+
animator.animate({ x: 4 });
|
|
221
|
+
animator['update'](1);
|
|
222
|
+
expect(obj).toEqual({ x: 1 });
|
|
223
|
+
animator['update'](1);
|
|
224
|
+
expect(obj).toEqual({ x: 2 });
|
|
225
|
+
animator.pauseAnimations();
|
|
226
|
+
animator['update'](1);
|
|
227
|
+
expect(obj).toEqual({ x: 2 });
|
|
228
|
+
animator['update'](1);
|
|
229
|
+
expect(obj).toEqual({ x: 2 });
|
|
230
|
+
animator.resumeAnimations();
|
|
231
|
+
animator['update'](1);
|
|
232
|
+
expect(obj).toEqual({ x: 3 });
|
|
233
|
+
animator['update'](1);
|
|
234
|
+
expect(obj).toEqual({ x: 4 });
|
|
235
|
+
});
|
|
236
|
+
test('new animations should not proceed while the animations are paused', async () => {
|
|
237
|
+
let obj = { x: 0 };
|
|
238
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 2, animation: new animations_1.AnimationLineer() });
|
|
239
|
+
animator.pauseAnimations();
|
|
240
|
+
animator.animate({ x: 2 });
|
|
241
|
+
animator['update'](1);
|
|
242
|
+
expect(obj).toEqual({ x: 0 });
|
|
243
|
+
animator['update'](1);
|
|
244
|
+
expect(obj).toEqual({ x: 0 });
|
|
245
|
+
animator.resumeAnimations();
|
|
246
|
+
animator['update'](1);
|
|
247
|
+
expect(obj).toEqual({ x: 1 });
|
|
248
|
+
animator['update'](1);
|
|
249
|
+
expect(obj).toEqual({ x: 2 });
|
|
250
|
+
});
|
|
251
|
+
test('animation loop', async () => {
|
|
252
|
+
let obj = { x: 0 };
|
|
253
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 2, animation: new animations_1.AnimationLineer(), loop: true });
|
|
254
|
+
animator.animate({ x: 2 }, { duration: 2 });
|
|
255
|
+
animator['update'](1);
|
|
256
|
+
expect(obj.x).toEqual(1);
|
|
257
|
+
animator['update'](1);
|
|
258
|
+
expect(obj.x).toEqual(0);
|
|
259
|
+
animator['update'](1);
|
|
260
|
+
expect(obj.x).toEqual(1);
|
|
261
|
+
animator['update'](0.8);
|
|
262
|
+
expect(obj.x).toEqual(1.8);
|
|
263
|
+
animator['update'](0.7);
|
|
264
|
+
expect(obj.x).toEqual(0.5);
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
describe('Animation Type Switch', () => {
|
|
268
|
+
test('re-animation handling option throw error should throw error', () => {
|
|
269
|
+
let obj = { x: 0 };
|
|
270
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 4, reAnimateHandling: animator_1.ReAnimateHandlingType.throwError });
|
|
271
|
+
animator.animate({ x: 1 });
|
|
272
|
+
expect(async () => await animator.animate({ x: 0 })).rejects.toThrow();
|
|
273
|
+
animator['update'](1);
|
|
274
|
+
expect(async () => await animator.animate({ x: 0 })).rejects.toThrow();
|
|
275
|
+
});
|
|
276
|
+
test('re-animation handling option ignore should ignore new animation', () => {
|
|
277
|
+
let obj = { x: 0 };
|
|
278
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 1, reAnimateHandling: animator_1.ReAnimateHandlingType.ignore });
|
|
279
|
+
animator.animate({ x: 1 });
|
|
280
|
+
animator.animate({ x: 2 });
|
|
281
|
+
animator['update'](1);
|
|
282
|
+
expect(obj.x).toEqual(1);
|
|
283
|
+
});
|
|
284
|
+
test('re-animation handling option ignore should ignore multiple property animation', () => {
|
|
285
|
+
let obj = { x: 0, y: 0 };
|
|
286
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 1, reAnimateHandling: animator_1.ReAnimateHandlingType.ignore });
|
|
287
|
+
animator.animate({ x: 1 });
|
|
288
|
+
animator.animate({ x: 2, y: 1 });
|
|
289
|
+
animator['update'](1);
|
|
290
|
+
expect(obj).toEqual({ x: 1, y: 1 });
|
|
291
|
+
});
|
|
292
|
+
test('animate switch after finishes to a different animation type should not throw error', () => {
|
|
293
|
+
let obj = { x: 1 };
|
|
294
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 1 });
|
|
295
|
+
animator.animate({ x: 0 }, { animation: new animations_1.AnimationLineer() });
|
|
296
|
+
animator['update'](1);
|
|
297
|
+
expect(obj.x).toEqual(0);
|
|
298
|
+
animator.animate({ x: 10 }, { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
299
|
+
animator['update'](1);
|
|
300
|
+
expect(obj.x).toEqual(1.25);
|
|
301
|
+
animator['update'](1);
|
|
302
|
+
expect(obj.x).toEqual(5);
|
|
303
|
+
animator['update'](1);
|
|
304
|
+
expect(obj.x).toEqual(8.75);
|
|
305
|
+
animator['update'](1);
|
|
306
|
+
expect(obj.x).toEqual(10);
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
describe('Set', () => {
|
|
310
|
+
test('it should throw error if it is animating', () => {
|
|
311
|
+
let animator = new animator_1.Animator({ x: 0 }, 'x', { duration: 1 });
|
|
312
|
+
animator.animate({ x: 1 });
|
|
313
|
+
expect(() => {
|
|
314
|
+
animator.set({ x: 0 });
|
|
315
|
+
}).toThrow();
|
|
316
|
+
});
|
|
317
|
+
test('it should throw error if the property is not valid', () => {
|
|
318
|
+
let animator = new animator_1.Animator({ x: 0 }, 'x');
|
|
319
|
+
expect(() => {
|
|
320
|
+
animator.set({ t: 0 });
|
|
321
|
+
}).toThrow();
|
|
322
|
+
});
|
|
323
|
+
test('it should change the original value', () => {
|
|
324
|
+
let obj = { x: 0, y: 1, z: 2 };
|
|
325
|
+
let animator = new animator_1.Animator(obj, ['x', 'y', 'z']);
|
|
326
|
+
animator.set({ x: 3, y: 4 });
|
|
327
|
+
expect(obj).toEqual({ x: 3, y: 4, z: 2 });
|
|
328
|
+
});
|
|
329
|
+
test('it should trigger onChange', () => {
|
|
330
|
+
let obj = { x: 0 };
|
|
331
|
+
let valueFromOnStep = 0;
|
|
332
|
+
let onStepCallCount = 0;
|
|
333
|
+
let animator = new animator_1.Animator(obj, 'x').onChange(item => {
|
|
334
|
+
valueFromOnStep = item.x;
|
|
335
|
+
onStepCallCount++;
|
|
336
|
+
});
|
|
337
|
+
animator.set({ x: 1 });
|
|
338
|
+
expect(valueFromOnStep).toEqual(1);
|
|
339
|
+
expect(onStepCallCount).toEqual(1);
|
|
340
|
+
});
|
|
341
|
+
test('it should not trigger onChange if the value is the same', () => {
|
|
342
|
+
let obj = { x: 0 };
|
|
343
|
+
let onStepCallCount = 0;
|
|
344
|
+
let animator = new animator_1.Animator(obj, 'x').onChange(() => {
|
|
345
|
+
onStepCallCount++;
|
|
346
|
+
});
|
|
347
|
+
animator.set({ x: 0 });
|
|
348
|
+
expect(onStepCallCount).toEqual(0);
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
describe('Complete Animations', () => {
|
|
352
|
+
test('when animation is done it should respect the complete animaitons option', () => {
|
|
353
|
+
let obj = { x: 0 };
|
|
354
|
+
let animator = new animator_1.Animator(obj, 'x', {
|
|
355
|
+
duration: 1,
|
|
356
|
+
animation: new animations_1.AnimationLineer(),
|
|
357
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.returnToOriginal
|
|
358
|
+
});
|
|
359
|
+
animator.animate({ x: 1 });
|
|
360
|
+
animator['update'](1);
|
|
361
|
+
expect(obj.x).toEqual(0);
|
|
362
|
+
});
|
|
363
|
+
test('complete animations should finalize the ongoing animation', async () => {
|
|
364
|
+
let obj = { x: 0 };
|
|
365
|
+
let completed = false;
|
|
366
|
+
let animator = new animator_1.Animator(obj, 'x');
|
|
367
|
+
animator.animate({ x: 1 }, { duration: 4 }).then(() => {
|
|
368
|
+
completed = true;
|
|
369
|
+
});
|
|
370
|
+
animator['update'](1);
|
|
371
|
+
await (0, helpers_lib_1.Wait)();
|
|
372
|
+
expect(completed).toBeFalsy();
|
|
373
|
+
animator.completeAnimations();
|
|
374
|
+
await (0, helpers_lib_1.Wait)();
|
|
375
|
+
expect(completed).toBeTruthy();
|
|
376
|
+
});
|
|
377
|
+
test('complete animations should finalize the all ongoing animations', async () => {
|
|
378
|
+
let completed1 = false;
|
|
379
|
+
let completed2 = false;
|
|
380
|
+
let obj = { x: 0, y: 0 };
|
|
381
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
382
|
+
animator.animate({ y: 10 }, { loop: true }).then(() => {
|
|
383
|
+
completed1 = true;
|
|
384
|
+
});
|
|
385
|
+
animator['update'](1);
|
|
386
|
+
animator.animate({ x: 10 }).then(() => {
|
|
387
|
+
completed2 = true;
|
|
388
|
+
});
|
|
389
|
+
animator['update'](1);
|
|
390
|
+
await (0, helpers_lib_1.Wait)();
|
|
391
|
+
expect(completed1).toBeFalsy();
|
|
392
|
+
expect(completed2).toBeFalsy();
|
|
393
|
+
animator.completeAnimations();
|
|
394
|
+
await (0, helpers_lib_1.Wait)();
|
|
395
|
+
expect(completed1).toBeTruthy();
|
|
396
|
+
expect(completed2).toBeTruthy();
|
|
397
|
+
});
|
|
398
|
+
test('complete animations stay in current state', async () => {
|
|
399
|
+
let obj = { x: 0 };
|
|
400
|
+
let animator = new animator_1.Animator(obj, 'x');
|
|
401
|
+
animator.animate({ x: 4 }, {
|
|
402
|
+
duration: 4,
|
|
403
|
+
animation: new animations_1.AnimationLineer(),
|
|
404
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.stayInCurrentState
|
|
405
|
+
});
|
|
406
|
+
animator['update'](1);
|
|
407
|
+
await (0, helpers_lib_1.Wait)();
|
|
408
|
+
expect(obj.x).toEqual(1);
|
|
409
|
+
animator.completeAnimations();
|
|
410
|
+
animator['update'](1);
|
|
411
|
+
await (0, helpers_lib_1.Wait)();
|
|
412
|
+
expect(obj.x).toEqual(1);
|
|
413
|
+
});
|
|
414
|
+
test('complete animations jump to end', async () => {
|
|
415
|
+
let obj = { x: 0 };
|
|
416
|
+
let animator = new animator_1.Animator(obj, 'x');
|
|
417
|
+
animator.animate({ x: 4 }, {
|
|
418
|
+
duration: 4,
|
|
419
|
+
animation: new animations_1.AnimationLineer(),
|
|
420
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.jumpToEnd
|
|
421
|
+
});
|
|
422
|
+
animator['update'](1);
|
|
423
|
+
await (0, helpers_lib_1.Wait)();
|
|
424
|
+
expect(obj.x).toEqual(1);
|
|
425
|
+
animator.completeAnimations();
|
|
426
|
+
animator['update'](1);
|
|
427
|
+
await (0, helpers_lib_1.Wait)();
|
|
428
|
+
expect(obj.x).toEqual(4);
|
|
429
|
+
});
|
|
430
|
+
test('complete animations return to original', async () => {
|
|
431
|
+
let obj = { x: 0 };
|
|
432
|
+
let animator = new animator_1.Animator(obj, 'x');
|
|
433
|
+
animator.animate({ x: 4 }, {
|
|
434
|
+
duration: 4,
|
|
435
|
+
animation: new animations_1.AnimationLineer(),
|
|
436
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.returnToOriginal
|
|
437
|
+
});
|
|
438
|
+
animator['update'](1);
|
|
439
|
+
await (0, helpers_lib_1.Wait)();
|
|
440
|
+
expect(obj.x).toEqual(1);
|
|
441
|
+
animator.completeAnimations();
|
|
442
|
+
animator['update'](1);
|
|
443
|
+
await (0, helpers_lib_1.Wait)();
|
|
444
|
+
expect(obj.x).toEqual(0);
|
|
445
|
+
});
|
|
446
|
+
test('complete animations options overriden in animate', async () => {
|
|
447
|
+
let obj = { x: 0 };
|
|
448
|
+
let animator = new animator_1.Animator(obj, 'x', {
|
|
449
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.returnToOriginal
|
|
450
|
+
});
|
|
451
|
+
animator.animate({ x: 4 }, {
|
|
452
|
+
duration: 4,
|
|
453
|
+
animation: new animations_1.AnimationLineer(),
|
|
454
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.jumpToEnd
|
|
455
|
+
});
|
|
456
|
+
animator['update'](1);
|
|
457
|
+
await (0, helpers_lib_1.Wait)();
|
|
458
|
+
expect(obj.x).toEqual(1);
|
|
459
|
+
animator.completeAnimations();
|
|
460
|
+
animator['update'](1);
|
|
461
|
+
await (0, helpers_lib_1.Wait)();
|
|
462
|
+
expect(obj.x).toEqual(4);
|
|
463
|
+
});
|
|
464
|
+
test('complete animations options overriden in complete animations funciton', async () => {
|
|
465
|
+
let obj = { x: 0 };
|
|
466
|
+
let animator = new animator_1.Animator(obj, 'x', {
|
|
467
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.returnToOriginal
|
|
468
|
+
});
|
|
469
|
+
animator.animate({ x: 4 }, {
|
|
470
|
+
duration: 4,
|
|
471
|
+
animation: new animations_1.AnimationLineer(),
|
|
472
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.jumpToEnd
|
|
473
|
+
});
|
|
474
|
+
animator['update'](1);
|
|
475
|
+
await (0, helpers_lib_1.Wait)();
|
|
476
|
+
expect(obj.x).toEqual(1);
|
|
477
|
+
animator.completeAnimations(animator_1.CompleteAnimationsHandlingType.stayInCurrentState);
|
|
478
|
+
animator['update'](1);
|
|
479
|
+
await (0, helpers_lib_1.Wait)();
|
|
480
|
+
expect(obj.x).toEqual(1);
|
|
481
|
+
});
|
|
482
|
+
test('complete animations should trigger onChange', async () => {
|
|
483
|
+
let obj = { x: 0 };
|
|
484
|
+
let completed = false;
|
|
485
|
+
let animator = new animator_1.Animator(obj, 'x', { duration: 1 }).onChange(() => {
|
|
486
|
+
completed = true;
|
|
487
|
+
});
|
|
488
|
+
animator.animate({ x: 1 });
|
|
489
|
+
animator.completeAnimations();
|
|
490
|
+
await (0, helpers_lib_1.Wait)();
|
|
491
|
+
expect(completed).toBeTruthy();
|
|
492
|
+
});
|
|
493
|
+
test('complete animations should not trigger on change if it is not animating', async () => {
|
|
494
|
+
let completed = false;
|
|
495
|
+
let animator = new animator_1.Animator({ x: 0 }, 'x').onChange(() => {
|
|
496
|
+
completed = true;
|
|
497
|
+
});
|
|
498
|
+
animator.completeAnimations();
|
|
499
|
+
await (0, helpers_lib_1.Wait)();
|
|
500
|
+
expect(completed).toBeFalsy();
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
describe('Mixing Different Configurations', () => {
|
|
504
|
+
test('animate multiple properties without mixing animation type', () => {
|
|
505
|
+
let obj = { x: 0, y: 10 };
|
|
506
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
507
|
+
animator.animate({ x: 10, y: 0 });
|
|
508
|
+
animator['update'](1);
|
|
509
|
+
expect(obj).toEqual({ x: 1.25, y: 8.75 });
|
|
510
|
+
animator['update'](1);
|
|
511
|
+
expect(obj).toEqual({ x: 5, y: 5 });
|
|
512
|
+
animator['update'](1);
|
|
513
|
+
expect(obj).toEqual({ x: 8.75, y: 1.25 });
|
|
514
|
+
animator['update'](1);
|
|
515
|
+
expect(obj).toEqual({ x: 10, y: 0 });
|
|
516
|
+
});
|
|
517
|
+
test('animate multiple properties with mixing animation type', () => {
|
|
518
|
+
let obj = { x: 0, y: 4 };
|
|
519
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 4 });
|
|
520
|
+
animator.animate({ x: 10 }, { animation: new animations_1.AnimationEaseInOut() });
|
|
521
|
+
animator.animate({ y: 0 }, { animation: new animations_1.AnimationLineer() });
|
|
522
|
+
animator['update'](1);
|
|
523
|
+
expect(obj).toEqual({ x: 1.25, y: 3 });
|
|
524
|
+
animator['update'](1);
|
|
525
|
+
expect(obj).toEqual({ x: 5, y: 2 });
|
|
526
|
+
animator['update'](1);
|
|
527
|
+
expect(obj).toEqual({ x: 8.75, y: 1 });
|
|
528
|
+
animator['update'](1);
|
|
529
|
+
expect(obj).toEqual({ x: 10, y: 0 });
|
|
530
|
+
});
|
|
531
|
+
test('animate multiple properties async', () => {
|
|
532
|
+
let obj = { x: 0, y: 0 };
|
|
533
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
534
|
+
animator.animate({ y: 10 });
|
|
535
|
+
animator['update'](1);
|
|
536
|
+
expect(obj).toEqual({ x: 0, y: 1.25 });
|
|
537
|
+
animator.animate({ x: 10 });
|
|
538
|
+
animator['update'](1);
|
|
539
|
+
expect(obj).toEqual({ x: 1.25, y: 5 });
|
|
540
|
+
animator['update'](1);
|
|
541
|
+
expect(obj).toEqual({ x: 5, y: 8.75 });
|
|
542
|
+
animator['update'](1);
|
|
543
|
+
expect(obj).toEqual({ x: 8.75, y: 10 });
|
|
544
|
+
animator['update'](1);
|
|
545
|
+
expect(obj).toEqual({ x: 10, y: 10 });
|
|
546
|
+
});
|
|
547
|
+
test('animate multiple properties mixed with loop', () => {
|
|
548
|
+
let obj = { x: 0, y: 0 };
|
|
549
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 4, animation: new animations_1.AnimationEaseInOut() });
|
|
550
|
+
animator.animate({ y: 10 }, { loop: true });
|
|
551
|
+
animator['update'](1);
|
|
552
|
+
expect(obj).toEqual({ x: 0, y: 1.25 });
|
|
553
|
+
animator.animate({ x: 10 });
|
|
554
|
+
animator['update'](1);
|
|
555
|
+
expect(obj).toEqual({ x: 1.25, y: 5 });
|
|
556
|
+
animator['update'](1);
|
|
557
|
+
expect(obj).toEqual({ x: 5, y: 8.75 });
|
|
558
|
+
animator['update'](1);
|
|
559
|
+
expect(obj).toEqual({ x: 8.75, y: 0 });
|
|
560
|
+
animator['update'](1);
|
|
561
|
+
expect(obj).toEqual({ x: 10, y: 1.25 });
|
|
562
|
+
animator['update'](1);
|
|
563
|
+
expect(obj).toEqual({ x: 10, y: 5 });
|
|
564
|
+
});
|
|
565
|
+
test('animate multiple properties complete promise', async () => {
|
|
566
|
+
let completed1 = false;
|
|
567
|
+
let completed2 = false;
|
|
568
|
+
let obj = { x: 0, y: 0 };
|
|
569
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 4 });
|
|
570
|
+
animator.animate({ y: 10 }).then(() => {
|
|
571
|
+
completed1 = true;
|
|
572
|
+
});
|
|
573
|
+
animator['update'](1);
|
|
574
|
+
animator.animate({ x: 10 }).then(() => {
|
|
575
|
+
completed2 = true;
|
|
576
|
+
});
|
|
577
|
+
animator['update'](2);
|
|
578
|
+
await (0, helpers_lib_1.Wait)();
|
|
579
|
+
expect(completed1).toBeFalsy();
|
|
580
|
+
expect(completed2).toBeFalsy();
|
|
581
|
+
animator['update'](1);
|
|
582
|
+
await (0, helpers_lib_1.Wait)();
|
|
583
|
+
expect(completed1).toBeTruthy();
|
|
584
|
+
expect(completed2).toBeFalsy();
|
|
585
|
+
animator['update'](1);
|
|
586
|
+
await (0, helpers_lib_1.Wait)();
|
|
587
|
+
expect(completed1).toBeTruthy();
|
|
588
|
+
expect(completed2).toBeTruthy();
|
|
589
|
+
});
|
|
590
|
+
test('pause animations with mixed commands', async () => {
|
|
591
|
+
let obj = { x: 0, y: 0 };
|
|
592
|
+
let animator = new animator_1.Animator(obj, ['x', 'y'], { duration: 4, animation: new animations_1.AnimationLineer() });
|
|
593
|
+
animator.resumeAnimations();
|
|
594
|
+
animator.animate({ x: 4 });
|
|
595
|
+
animator['update'](1);
|
|
596
|
+
expect(obj).toEqual({ x: 1, y: 0 });
|
|
597
|
+
animator['update'](1);
|
|
598
|
+
expect(obj).toEqual({ x: 2, y: 0 });
|
|
599
|
+
animator.pauseAnimations();
|
|
600
|
+
animator['update'](1);
|
|
601
|
+
expect(obj).toEqual({ x: 2, y: 0 });
|
|
602
|
+
animator.pauseAnimations();
|
|
603
|
+
animator.animate({ y: 4 });
|
|
604
|
+
animator['update'](1);
|
|
605
|
+
expect(obj).toEqual({ x: 2, y: 0 });
|
|
606
|
+
animator.resumeAnimations();
|
|
607
|
+
animator['update'](1);
|
|
608
|
+
expect(obj).toEqual({ x: 3, y: 1 });
|
|
609
|
+
animator.resumeAnimations();
|
|
610
|
+
animator['update'](1);
|
|
611
|
+
expect(obj).toEqual({ x: 4, y: 2 });
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
});
|
|
615
|
+
//# sourceMappingURL=animator.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|