fraxel 0.1.0-alpha.1
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/animation/easing.d.ts +29 -0
- package/dist/animation/easing.d.ts.map +1 -0
- package/dist/animation/easing.js +50 -0
- package/dist/animation/easing.js.map +1 -0
- package/dist/animation/index.d.ts +7 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/animation/index.js +7 -0
- package/dist/animation/index.js.map +1 -0
- package/dist/animation/multiple.d.ts +26 -0
- package/dist/animation/multiple.d.ts.map +1 -0
- package/dist/animation/multiple.js +27 -0
- package/dist/animation/multiple.js.map +1 -0
- package/dist/animation/properties.d.ts +30 -0
- package/dist/animation/properties.d.ts.map +1 -0
- package/dist/animation/properties.js +32 -0
- package/dist/animation/properties.js.map +1 -0
- package/dist/animation/sequences.d.ts +30 -0
- package/dist/animation/sequences.d.ts.map +1 -0
- package/dist/animation/sequences.js +50 -0
- package/dist/animation/sequences.js.map +1 -0
- package/dist/animation/sprite-sheet.d.ts +81 -0
- package/dist/animation/sprite-sheet.d.ts.map +1 -0
- package/dist/animation/sprite-sheet.js +103 -0
- package/dist/animation/sprite-sheet.js.map +1 -0
- package/dist/animation/tween.d.ts +78 -0
- package/dist/animation/tween.d.ts.map +1 -0
- package/dist/animation/tween.js +103 -0
- package/dist/animation/tween.js.map +1 -0
- package/dist/assets/index.d.ts +6 -0
- package/dist/assets/index.d.ts.map +1 -0
- package/dist/assets/index.js +5 -0
- package/dist/assets/index.js.map +1 -0
- package/dist/assets/load-sound.d.ts +17 -0
- package/dist/assets/load-sound.d.ts.map +1 -0
- package/dist/assets/load-sound.js +35 -0
- package/dist/assets/load-sound.js.map +1 -0
- package/dist/assets/load-texture.d.ts +12 -0
- package/dist/assets/load-texture.d.ts.map +1 -0
- package/dist/assets/load-texture.js +40 -0
- package/dist/assets/load-texture.js.map +1 -0
- package/dist/assets/loader.d.ts +59 -0
- package/dist/assets/loader.d.ts.map +1 -0
- package/dist/assets/loader.js +65 -0
- package/dist/assets/loader.js.map +1 -0
- package/dist/assets/texture.d.ts +36 -0
- package/dist/assets/texture.d.ts.map +1 -0
- package/dist/assets/texture.js +49 -0
- package/dist/assets/texture.js.map +1 -0
- package/dist/audio/audio-context.d.ts +14 -0
- package/dist/audio/audio-context.d.ts.map +1 -0
- package/dist/audio/audio-context.js +20 -0
- package/dist/audio/audio-context.js.map +1 -0
- package/dist/audio/index.d.ts +2 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +2 -0
- package/dist/audio/index.js.map +1 -0
- package/dist/collision/broadphase/spatial-hash.d.ts +32 -0
- package/dist/collision/broadphase/spatial-hash.d.ts.map +1 -0
- package/dist/collision/broadphase/spatial-hash.js +87 -0
- package/dist/collision/broadphase/spatial-hash.js.map +1 -0
- package/dist/collision/collision-system.d.ts +52 -0
- package/dist/collision/collision-system.d.ts.map +1 -0
- package/dist/collision/collision-system.js +278 -0
- package/dist/collision/collision-system.js.map +1 -0
- package/dist/collision/events/collision-emitter.d.ts +38 -0
- package/dist/collision/events/collision-emitter.d.ts.map +1 -0
- package/dist/collision/events/collision-emitter.js +47 -0
- package/dist/collision/events/collision-emitter.js.map +1 -0
- package/dist/collision/index.d.ts +13 -0
- package/dist/collision/index.d.ts.map +1 -0
- package/dist/collision/index.js +11 -0
- package/dist/collision/index.js.map +1 -0
- package/dist/collision/narrowphase/detector.d.ts +26 -0
- package/dist/collision/narrowphase/detector.d.ts.map +1 -0
- package/dist/collision/narrowphase/detector.js +70 -0
- package/dist/collision/narrowphase/detector.js.map +1 -0
- package/dist/collision/narrowphase/shapes.d.ts +91 -0
- package/dist/collision/narrowphase/shapes.d.ts.map +1 -0
- package/dist/collision/narrowphase/shapes.js +52 -0
- package/dist/collision/narrowphase/shapes.js.map +1 -0
- package/dist/collision/physics/physics-body.d.ts +38 -0
- package/dist/collision/physics/physics-body.d.ts.map +1 -0
- package/dist/collision/physics/physics-body.js +53 -0
- package/dist/collision/physics/physics-body.js.map +1 -0
- package/dist/collision/physics/physics-system.d.ts +23 -0
- package/dist/collision/physics/physics-system.d.ts.map +1 -0
- package/dist/collision/physics/physics-system.js +86 -0
- package/dist/collision/physics/physics-system.js.map +1 -0
- package/dist/collision/physics/resolver.d.ts +16 -0
- package/dist/collision/physics/resolver.d.ts.map +1 -0
- package/dist/collision/physics/resolver.js +91 -0
- package/dist/collision/physics/resolver.js.map +1 -0
- package/dist/collision/types.d.ts +22 -0
- package/dist/collision/types.d.ts.map +1 -0
- package/dist/collision/types.js +2 -0
- package/dist/collision/types.js.map +1 -0
- package/dist/core/game-config.d.ts +34 -0
- package/dist/core/game-config.d.ts.map +1 -0
- package/dist/core/game-config.js +31 -0
- package/dist/core/game-config.js.map +1 -0
- package/dist/core/game.d.ts +86 -0
- package/dist/core/game.d.ts.map +1 -0
- package/dist/core/game.js +166 -0
- package/dist/core/game.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/scene-manager.d.ts +28 -0
- package/dist/core/scene-manager.d.ts.map +1 -0
- package/dist/core/scene-manager.js +65 -0
- package/dist/core/scene-manager.js.map +1 -0
- package/dist/core/scene.d.ts +43 -0
- package/dist/core/scene.d.ts.map +1 -0
- package/dist/core/scene.js +48 -0
- package/dist/core/scene.js.map +1 -0
- package/dist/core/theme.d.ts +63 -0
- package/dist/core/theme.d.ts.map +1 -0
- package/dist/core/theme.js +59 -0
- package/dist/core/theme.js.map +1 -0
- package/dist/errors/animation.d.ts +24 -0
- package/dist/errors/animation.d.ts.map +1 -0
- package/dist/errors/animation.js +29 -0
- package/dist/errors/animation.js.map +1 -0
- package/dist/errors/assets.d.ts +34 -0
- package/dist/errors/assets.d.ts.map +1 -0
- package/dist/errors/assets.js +41 -0
- package/dist/errors/assets.js.map +1 -0
- package/dist/errors/base.d.ts +12 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +15 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/env.d.ts +24 -0
- package/dist/errors/env.d.ts.map +1 -0
- package/dist/errors/env.js +29 -0
- package/dist/errors/env.js.map +1 -0
- package/dist/errors/hook.d.ts +46 -0
- package/dist/errors/hook.d.ts.map +1 -0
- package/dist/errors/hook.js +55 -0
- package/dist/errors/hook.js.map +1 -0
- package/dist/errors/index.d.ts +11 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +11 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/jsx.d.ts +26 -0
- package/dist/errors/jsx.d.ts.map +1 -0
- package/dist/errors/jsx.js +45 -0
- package/dist/errors/jsx.js.map +1 -0
- package/dist/errors/lifecycle.d.ts +35 -0
- package/dist/errors/lifecycle.d.ts.map +1 -0
- package/dist/errors/lifecycle.js +42 -0
- package/dist/errors/lifecycle.js.map +1 -0
- package/dist/errors/math.d.ts +24 -0
- package/dist/errors/math.d.ts.map +1 -0
- package/dist/errors/math.js +34 -0
- package/dist/errors/math.js.map +1 -0
- package/dist/errors/node.d.ts +68 -0
- package/dist/errors/node.d.ts.map +1 -0
- package/dist/errors/node.js +87 -0
- package/dist/errors/node.js.map +1 -0
- package/dist/errors/scene.d.ts +35 -0
- package/dist/errors/scene.d.ts.map +1 -0
- package/dist/errors/scene.js +42 -0
- package/dist/errors/scene.js.map +1 -0
- package/dist/events/event.d.ts +106 -0
- package/dist/events/event.d.ts.map +1 -0
- package/dist/events/event.js +125 -0
- package/dist/events/event.js.map +1 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +2 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/types.d.ts +20 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +2 -0
- package/dist/events/types.js.map +1 -0
- package/dist/hooks/context.d.ts +15 -0
- package/dist/hooks/context.d.ts.map +1 -0
- package/dist/hooks/context.js +26 -0
- package/dist/hooks/context.js.map +1 -0
- package/dist/hooks/deriveds/by-nodes/index.d.ts +7 -0
- package/dist/hooks/deriveds/by-nodes/index.d.ts.map +1 -0
- package/dist/hooks/deriveds/by-nodes/index.js +7 -0
- package/dist/hooks/deriveds/by-nodes/index.js.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-animation.d.ts +44 -0
- package/dist/hooks/deriveds/by-nodes/use-animation.d.ts.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-animation.js +61 -0
- package/dist/hooks/deriveds/by-nodes/use-animation.js.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-audio.d.ts +33 -0
- package/dist/hooks/deriveds/by-nodes/use-audio.d.ts.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-audio.js +43 -0
- package/dist/hooks/deriveds/by-nodes/use-audio.js.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-clickable.d.ts +32 -0
- package/dist/hooks/deriveds/by-nodes/use-clickable.d.ts.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-clickable.js +43 -0
- package/dist/hooks/deriveds/by-nodes/use-clickable.js.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-collider.d.ts +35 -0
- package/dist/hooks/deriveds/by-nodes/use-collider.d.ts.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-collider.js +55 -0
- package/dist/hooks/deriveds/by-nodes/use-collider.js.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-ray-cast.d.ts +35 -0
- package/dist/hooks/deriveds/by-nodes/use-ray-cast.d.ts.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-ray-cast.js +47 -0
- package/dist/hooks/deriveds/by-nodes/use-ray-cast.js.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-timer.d.ts +34 -0
- package/dist/hooks/deriveds/by-nodes/use-timer.d.ts.map +1 -0
- package/dist/hooks/deriveds/by-nodes/use-timer.js +48 -0
- package/dist/hooks/deriveds/by-nodes/use-timer.js.map +1 -0
- package/dist/hooks/deriveds/index.d.ts +5 -0
- package/dist/hooks/deriveds/index.d.ts.map +1 -0
- package/dist/hooks/deriveds/index.js +5 -0
- package/dist/hooks/deriveds/index.js.map +1 -0
- package/dist/hooks/deriveds/use-condition.d.ts +37 -0
- package/dist/hooks/deriveds/use-condition.d.ts.map +1 -0
- package/dist/hooks/deriveds/use-condition.js +47 -0
- package/dist/hooks/deriveds/use-condition.js.map +1 -0
- package/dist/hooks/deriveds/use-match.d.ts +26 -0
- package/dist/hooks/deriveds/use-match.d.ts.map +1 -0
- package/dist/hooks/deriveds/use-match.js +38 -0
- package/dist/hooks/deriveds/use-match.js.map +1 -0
- package/dist/hooks/deriveds/use-partial-node.d.ts +22 -0
- package/dist/hooks/deriveds/use-partial-node.d.ts.map +1 -0
- package/dist/hooks/deriveds/use-partial-node.js +25 -0
- package/dist/hooks/deriveds/use-partial-node.js.map +1 -0
- package/dist/hooks/deriveds/use-when.d.ts +28 -0
- package/dist/hooks/deriveds/use-when.d.ts.map +1 -0
- package/dist/hooks/deriveds/use-when.js +35 -0
- package/dist/hooks/deriveds/use-when.js.map +1 -0
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +16 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-child.d.ts +24 -0
- package/dist/hooks/use-child.d.ts.map +1 -0
- package/dist/hooks/use-child.js +37 -0
- package/dist/hooks/use-child.js.map +1 -0
- package/dist/hooks/use-computed.d.ts +28 -0
- package/dist/hooks/use-computed.d.ts.map +1 -0
- package/dist/hooks/use-computed.js +41 -0
- package/dist/hooks/use-computed.js.map +1 -0
- package/dist/hooks/use-context.d.ts +58 -0
- package/dist/hooks/use-context.d.ts.map +1 -0
- package/dist/hooks/use-context.js +77 -0
- package/dist/hooks/use-context.js.map +1 -0
- package/dist/hooks/use-effect.d.ts +24 -0
- package/dist/hooks/use-effect.d.ts.map +1 -0
- package/dist/hooks/use-effect.js +63 -0
- package/dist/hooks/use-effect.js.map +1 -0
- package/dist/hooks/use-event.d.ts +29 -0
- package/dist/hooks/use-event.d.ts.map +1 -0
- package/dist/hooks/use-event.js +30 -0
- package/dist/hooks/use-event.js.map +1 -0
- package/dist/hooks/use-game.d.ts +17 -0
- package/dist/hooks/use-game.d.ts.map +1 -0
- package/dist/hooks/use-game.js +35 -0
- package/dist/hooks/use-game.js.map +1 -0
- package/dist/hooks/use-mount.d.ts +21 -0
- package/dist/hooks/use-mount.d.ts.map +1 -0
- package/dist/hooks/use-mount.js +33 -0
- package/dist/hooks/use-mount.js.map +1 -0
- package/dist/hooks/use-node.d.ts +42 -0
- package/dist/hooks/use-node.d.ts.map +1 -0
- package/dist/hooks/use-node.js +63 -0
- package/dist/hooks/use-node.js.map +1 -0
- package/dist/hooks/use-ref.d.ts +27 -0
- package/dist/hooks/use-ref.d.ts.map +1 -0
- package/dist/hooks/use-ref.js +33 -0
- package/dist/hooks/use-ref.js.map +1 -0
- package/dist/hooks/use-script.d.ts +33 -0
- package/dist/hooks/use-script.d.ts.map +1 -0
- package/dist/hooks/use-script.js +40 -0
- package/dist/hooks/use-script.js.map +1 -0
- package/dist/hooks/use-signal.d.ts +25 -0
- package/dist/hooks/use-signal.d.ts.map +1 -0
- package/dist/hooks/use-signal.js +36 -0
- package/dist/hooks/use-signal.js.map +1 -0
- package/dist/hooks/use-spawn.d.ts +27 -0
- package/dist/hooks/use-spawn.d.ts.map +1 -0
- package/dist/hooks/use-spawn.js +39 -0
- package/dist/hooks/use-spawn.js.map +1 -0
- package/dist/hooks/use-trigger.d.ts +51 -0
- package/dist/hooks/use-trigger.d.ts.map +1 -0
- package/dist/hooks/use-trigger.js +68 -0
- package/dist/hooks/use-trigger.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/input/input.d.ts +46 -0
- package/dist/input/input.d.ts.map +1 -0
- package/dist/input/input.js +159 -0
- package/dist/input/input.js.map +1 -0
- package/dist/jsx/components/fragment.d.ts +3 -0
- package/dist/jsx/components/fragment.d.ts.map +1 -0
- package/dist/jsx/components/fragment.js +7 -0
- package/dist/jsx/components/fragment.js.map +1 -0
- package/dist/jsx/components/game.d.ts +21 -0
- package/dist/jsx/components/game.d.ts.map +1 -0
- package/dist/jsx/components/game.js +17 -0
- package/dist/jsx/components/game.js.map +1 -0
- package/dist/jsx/components/index.d.ts +5 -0
- package/dist/jsx/components/index.d.ts.map +1 -0
- package/dist/jsx/components/index.js +5 -0
- package/dist/jsx/components/index.js.map +1 -0
- package/dist/jsx/components/list.d.ts +88 -0
- package/dist/jsx/components/list.d.ts.map +1 -0
- package/dist/jsx/components/list.js +93 -0
- package/dist/jsx/components/list.js.map +1 -0
- package/dist/jsx/components/scene.d.ts +40 -0
- package/dist/jsx/components/scene.d.ts.map +1 -0
- package/dist/jsx/components/scene.js +20 -0
- package/dist/jsx/components/scene.js.map +1 -0
- package/dist/jsx/index.d.ts +5 -0
- package/dist/jsx/index.d.ts.map +1 -0
- package/dist/jsx/index.js +5 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/jsx.d.ts +3 -0
- package/dist/jsx/jsx.d.ts.map +1 -0
- package/dist/jsx/jsx.js +4 -0
- package/dist/jsx/jsx.js.map +1 -0
- package/dist/jsx/render/game.d.ts +41 -0
- package/dist/jsx/render/game.d.ts.map +1 -0
- package/dist/jsx/render/game.js +86 -0
- package/dist/jsx/render/game.js.map +1 -0
- package/dist/jsx/render/index.d.ts +3 -0
- package/dist/jsx/render/index.d.ts.map +1 -0
- package/dist/jsx/render/index.js +3 -0
- package/dist/jsx/render/index.js.map +1 -0
- package/dist/jsx/render/to-nodes.d.ts +10 -0
- package/dist/jsx/render/to-nodes.d.ts.map +1 -0
- package/dist/jsx/render/to-nodes.js +52 -0
- package/dist/jsx/render/to-nodes.js.map +1 -0
- package/dist/jsx/render/types/class-component.d.ts +4 -0
- package/dist/jsx/render/types/class-component.d.ts.map +1 -0
- package/dist/jsx/render/types/class-component.js +8 -0
- package/dist/jsx/render/types/class-component.js.map +1 -0
- package/dist/jsx/render/types/func-components.d.ts +4 -0
- package/dist/jsx/render/types/func-components.d.ts.map +1 -0
- package/dist/jsx/render/types/func-components.js +8 -0
- package/dist/jsx/render/types/func-components.js.map +1 -0
- package/dist/jsx/render/types/instrinsic-elements.d.ts +6 -0
- package/dist/jsx/render/types/instrinsic-elements.d.ts.map +1 -0
- package/dist/jsx/render/types/instrinsic-elements.js +41 -0
- package/dist/jsx/render/types/instrinsic-elements.js.map +1 -0
- package/dist/jsx/types.d.ts +41 -0
- package/dist/jsx/types.d.ts.map +1 -0
- package/dist/jsx/types.js +2 -0
- package/dist/jsx/types.js.map +1 -0
- package/dist/jsx/utils.d.ts +4 -0
- package/dist/jsx/utils.d.ts.map +1 -0
- package/dist/jsx/utils.js +15 -0
- package/dist/jsx/utils.js.map +1 -0
- package/dist/jsx-runtime.d.ts +6 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +6 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/math/index.d.ts +3 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math/index.js +2 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/types.d.ts +13 -0
- package/dist/math/types.d.ts.map +1 -0
- package/dist/math/types.js +2 -0
- package/dist/math/types.js.map +1 -0
- package/dist/math/vector2.d.ts +145 -0
- package/dist/math/vector2.d.ts.map +1 -0
- package/dist/math/vector2.js +164 -0
- package/dist/math/vector2.js.map +1 -0
- package/dist/nodes/_node.d.ts +283 -0
- package/dist/nodes/_node.d.ts.map +1 -0
- package/dist/nodes/_node.js +371 -0
- package/dist/nodes/_node.js.map +1 -0
- package/dist/nodes/animation-player.d.ts +208 -0
- package/dist/nodes/animation-player.d.ts.map +1 -0
- package/dist/nodes/animation-player.js +249 -0
- package/dist/nodes/animation-player.js.map +1 -0
- package/dist/nodes/audio-player.d.ts +128 -0
- package/dist/nodes/audio-player.d.ts.map +1 -0
- package/dist/nodes/audio-player.js +173 -0
- package/dist/nodes/audio-player.js.map +1 -0
- package/dist/nodes/group.d.ts +55 -0
- package/dist/nodes/group.d.ts.map +1 -0
- package/dist/nodes/group.js +54 -0
- package/dist/nodes/group.js.map +1 -0
- package/dist/nodes/index.d.ts +8 -0
- package/dist/nodes/index.d.ts.map +1 -0
- package/dist/nodes/index.js +7 -0
- package/dist/nodes/index.js.map +1 -0
- package/dist/nodes/lib/enum.d.ts +42 -0
- package/dist/nodes/lib/enum.d.ts.map +1 -0
- package/dist/nodes/lib/enum.js +43 -0
- package/dist/nodes/lib/enum.js.map +1 -0
- package/dist/nodes/lib/index.d.ts +5 -0
- package/dist/nodes/lib/index.d.ts.map +1 -0
- package/dist/nodes/lib/index.js +5 -0
- package/dist/nodes/lib/index.js.map +1 -0
- package/dist/nodes/lib/registry.d.ts +43 -0
- package/dist/nodes/lib/registry.d.ts.map +1 -0
- package/dist/nodes/lib/registry.js +46 -0
- package/dist/nodes/lib/registry.js.map +1 -0
- package/dist/nodes/lib/types.d.ts +89 -0
- package/dist/nodes/lib/types.d.ts.map +1 -0
- package/dist/nodes/lib/types.js +2 -0
- package/dist/nodes/lib/types.js.map +1 -0
- package/dist/nodes/lib/utils.d.ts +35 -0
- package/dist/nodes/lib/utils.d.ts.map +1 -0
- package/dist/nodes/lib/utils.js +58 -0
- package/dist/nodes/lib/utils.js.map +1 -0
- package/dist/nodes/node2d/_node2d.d.ts +59 -0
- package/dist/nodes/node2d/_node2d.d.ts.map +1 -0
- package/dist/nodes/node2d/_node2d.js +57 -0
- package/dist/nodes/node2d/_node2d.js.map +1 -0
- package/dist/nodes/node2d/camera.d.ts +64 -0
- package/dist/nodes/node2d/camera.d.ts.map +1 -0
- package/dist/nodes/node2d/camera.js +72 -0
- package/dist/nodes/node2d/camera.js.map +1 -0
- package/dist/nodes/node2d/clickable.d.ts +96 -0
- package/dist/nodes/node2d/clickable.d.ts.map +1 -0
- package/dist/nodes/node2d/clickable.js +117 -0
- package/dist/nodes/node2d/clickable.js.map +1 -0
- package/dist/nodes/node2d/collider.d.ts +96 -0
- package/dist/nodes/node2d/collider.d.ts.map +1 -0
- package/dist/nodes/node2d/collider.js +116 -0
- package/dist/nodes/node2d/collider.js.map +1 -0
- package/dist/nodes/node2d/index.d.ts +12 -0
- package/dist/nodes/node2d/index.d.ts.map +1 -0
- package/dist/nodes/node2d/index.js +11 -0
- package/dist/nodes/node2d/index.js.map +1 -0
- package/dist/nodes/node2d/lib/index.d.ts +2 -0
- package/dist/nodes/node2d/lib/index.d.ts.map +1 -0
- package/dist/nodes/node2d/lib/index.js +2 -0
- package/dist/nodes/node2d/lib/index.js.map +1 -0
- package/dist/nodes/node2d/lib/utils.d.ts +4 -0
- package/dist/nodes/node2d/lib/utils.d.ts.map +1 -0
- package/dist/nodes/node2d/lib/utils.js +14 -0
- package/dist/nodes/node2d/lib/utils.js.map +1 -0
- package/dist/nodes/node2d/ray-cast.d.ts +115 -0
- package/dist/nodes/node2d/ray-cast.d.ts.map +1 -0
- package/dist/nodes/node2d/ray-cast.js +129 -0
- package/dist/nodes/node2d/ray-cast.js.map +1 -0
- package/dist/nodes/node2d/rectangle.d.ts +87 -0
- package/dist/nodes/node2d/rectangle.d.ts.map +1 -0
- package/dist/nodes/node2d/rectangle.js +60 -0
- package/dist/nodes/node2d/rectangle.js.map +1 -0
- package/dist/nodes/node2d/rigid-body.d.ts +65 -0
- package/dist/nodes/node2d/rigid-body.d.ts.map +1 -0
- package/dist/nodes/node2d/rigid-body.js +56 -0
- package/dist/nodes/node2d/rigid-body.js.map +1 -0
- package/dist/nodes/node2d/sprite.d.ts +285 -0
- package/dist/nodes/node2d/sprite.d.ts.map +1 -0
- package/dist/nodes/node2d/sprite.js +226 -0
- package/dist/nodes/node2d/sprite.js.map +1 -0
- package/dist/nodes/node2d/text.d.ts +62 -0
- package/dist/nodes/node2d/text.d.ts.map +1 -0
- package/dist/nodes/node2d/text.js +52 -0
- package/dist/nodes/node2d/text.js.map +1 -0
- package/dist/nodes/node2d/transform.d.ts +32 -0
- package/dist/nodes/node2d/transform.d.ts.map +1 -0
- package/dist/nodes/node2d/transform.js +30 -0
- package/dist/nodes/node2d/transform.js.map +1 -0
- package/dist/nodes/timer.d.ts +107 -0
- package/dist/nodes/timer.d.ts.map +1 -0
- package/dist/nodes/timer.js +108 -0
- package/dist/nodes/timer.js.map +1 -0
- package/dist/reactivity/index.d.ts +5 -0
- package/dist/reactivity/index.d.ts.map +1 -0
- package/dist/reactivity/index.js +5 -0
- package/dist/reactivity/index.js.map +1 -0
- package/dist/reactivity/reactive.d.ts +4 -0
- package/dist/reactivity/reactive.d.ts.map +1 -0
- package/dist/reactivity/reactive.js +50 -0
- package/dist/reactivity/reactive.js.map +1 -0
- package/dist/reactivity/register.d.ts +7 -0
- package/dist/reactivity/register.d.ts.map +1 -0
- package/dist/reactivity/register.js +18 -0
- package/dist/reactivity/register.js.map +1 -0
- package/dist/reactivity/signal.d.ts +126 -0
- package/dist/reactivity/signal.d.ts.map +1 -0
- package/dist/reactivity/signal.js +152 -0
- package/dist/reactivity/signal.js.map +1 -0
- package/dist/reactivity/types.d.ts +31 -0
- package/dist/reactivity/types.d.ts.map +1 -0
- package/dist/reactivity/types.js +2 -0
- package/dist/reactivity/types.js.map +1 -0
- package/dist/scripts/index.d.ts +2 -0
- package/dist/scripts/index.d.ts.map +1 -0
- package/dist/scripts/index.js +2 -0
- package/dist/scripts/index.js.map +1 -0
- package/dist/scripts/script.d.ts +80 -0
- package/dist/scripts/script.d.ts.map +1 -0
- package/dist/scripts/script.js +75 -0
- package/dist/scripts/script.js.map +1 -0
- package/dist/utils/dpr.d.ts +2 -0
- package/dist/utils/dpr.d.ts.map +1 -0
- package/dist/utils/dpr.js +14 -0
- package/dist/utils/dpr.js.map +1 -0
- package/dist/utils/ternaries.d.ts +6 -0
- package/dist/utils/ternaries.d.ts.map +1 -0
- package/dist/utils/ternaries.js +17 -0
- package/dist/utils/ternaries.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { Event, getEventName } from '../events/event.js';
|
|
2
|
+
import {} from './lib/types.js';
|
|
3
|
+
import { InvalidNodeIdError, NodeChildNotFoundError, NodeTypeMismatchError, UnknownNodeTypeError, } from '../errors/node.js';
|
|
4
|
+
import { getNodeName } from './lib/utils.js';
|
|
5
|
+
import { Nodes } from './lib/registry.js';
|
|
6
|
+
import { PrimaryNode } from './lib/enum.js';
|
|
7
|
+
const idRegEx = /([a-zA-Z][a-zA-Z0-9-_]*)/g;
|
|
8
|
+
export class Node {
|
|
9
|
+
type;
|
|
10
|
+
#id;
|
|
11
|
+
#zIndex = 0;
|
|
12
|
+
_parent;
|
|
13
|
+
_children = [];
|
|
14
|
+
/**
|
|
15
|
+
* The **`deltaIncrease`** property changes the speed of the node and its children.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* // Speed x0.5
|
|
20
|
+
* <transform deltaIncrease={0.5}>
|
|
21
|
+
* <Ball />
|
|
22
|
+
* </transform>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
deltaIncrease = 1;
|
|
26
|
+
script;
|
|
27
|
+
// States
|
|
28
|
+
/**
|
|
29
|
+
* The **`isStarted`** property of the node indicates whether the node is started.
|
|
30
|
+
*/
|
|
31
|
+
isStarted = false;
|
|
32
|
+
/**
|
|
33
|
+
* The **`isDestroyed`** property of the node indicates whether the node is destroyed.
|
|
34
|
+
*/
|
|
35
|
+
isDestroyed = false;
|
|
36
|
+
constructor(type, { id, zIndex, deltaIncrease, script, children }) {
|
|
37
|
+
this.type = type;
|
|
38
|
+
if (typeof id === 'string') {
|
|
39
|
+
const matches = id.match(idRegEx);
|
|
40
|
+
if (matches == null || matches.length !== 1 || matches[0] !== id) {
|
|
41
|
+
throw new InvalidNodeIdError('The id ' + id + ' does not matches with `([a-zA-Z][a-zA-Z0-9-_]*)`');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
this.#id = id ?? Symbol(type);
|
|
45
|
+
if (script) {
|
|
46
|
+
this.script = script;
|
|
47
|
+
this.script.init(this);
|
|
48
|
+
}
|
|
49
|
+
this.#zIndex = zIndex ?? this.#zIndex;
|
|
50
|
+
this.deltaIncrease = deltaIncrease ?? this.deltaIncrease;
|
|
51
|
+
this.addChild(...(children ?? []));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The read-only **`id`** property of a node represents the node's identifier.
|
|
55
|
+
* It can be used to retrieve this node via `child()`.
|
|
56
|
+
* IDs can be non-unique and must match `([a-zA-Z][a-zA-Z0-9-_]*)`.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* const container = useChild(['container'], PrimaryNode.Transform)
|
|
61
|
+
*
|
|
62
|
+
* return (
|
|
63
|
+
* <transform>
|
|
64
|
+
* <transform id='container' />
|
|
65
|
+
* </transform>
|
|
66
|
+
* )
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* **`id`** can be used as path to find nested nodes.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* const child2 = useChild(['child1', 'child2'], PrimaryNode.Transform)
|
|
74
|
+
*
|
|
75
|
+
* return (
|
|
76
|
+
* <transform>
|
|
77
|
+
* <transform id='child1'>
|
|
78
|
+
* <transform id='child2' />
|
|
79
|
+
* </transform>
|
|
80
|
+
* </transform>
|
|
81
|
+
* )
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
get id() {
|
|
85
|
+
return this.#id;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The read-only **`parent`** property returns the parent of this node.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* const transform = useNode(PrimaryNode.Transform)
|
|
93
|
+
*
|
|
94
|
+
* useMount(() => {
|
|
95
|
+
* const parent = transform.node.parent
|
|
96
|
+
* parent?.destroy()
|
|
97
|
+
* })
|
|
98
|
+
*
|
|
99
|
+
* return (
|
|
100
|
+
* <transform ref={transform}>
|
|
101
|
+
* <transform id='container' />
|
|
102
|
+
* </transform>
|
|
103
|
+
* )
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
get parent() {
|
|
107
|
+
return this._parent;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The read-only **`children`** property returns the child nodes.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```tsx
|
|
114
|
+
* const transform = useNode(PrimaryNode.Transform)
|
|
115
|
+
*
|
|
116
|
+
* useMount(() => {
|
|
117
|
+
* const children = transform.node.children
|
|
118
|
+
* console.log(children) // [Node]
|
|
119
|
+
* })
|
|
120
|
+
*
|
|
121
|
+
* return (
|
|
122
|
+
* <transform ref={transform}>
|
|
123
|
+
* <transform id='container' />
|
|
124
|
+
* </transform>
|
|
125
|
+
* )
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
get children() {
|
|
129
|
+
return this._children;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Gets or sets the **`zIndex`** of the node.
|
|
133
|
+
*/
|
|
134
|
+
set zIndex(value) {
|
|
135
|
+
if (value === this.#zIndex)
|
|
136
|
+
return;
|
|
137
|
+
this.zIndexChanged.emit(value);
|
|
138
|
+
this.#zIndex = value;
|
|
139
|
+
}
|
|
140
|
+
get zIndex() {
|
|
141
|
+
return this.#zIndex;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Gets or sets the **`globalZIndex`** of the node.
|
|
145
|
+
*/
|
|
146
|
+
set globalZIndex(value) {
|
|
147
|
+
if (this._parent == null)
|
|
148
|
+
this.zIndex = value;
|
|
149
|
+
else
|
|
150
|
+
this.zIndex = value - this._parent.globalZIndex;
|
|
151
|
+
}
|
|
152
|
+
get globalZIndex() {
|
|
153
|
+
if (this._parent == null)
|
|
154
|
+
return this.zIndex;
|
|
155
|
+
return this.zIndex + this._parent.globalZIndex;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Gets or sets the **`globalDeltaIncrease`** of the node.
|
|
159
|
+
*/
|
|
160
|
+
set globalDeltaIncrease(value) {
|
|
161
|
+
if (this._parent == null)
|
|
162
|
+
this.deltaIncrease = value;
|
|
163
|
+
else
|
|
164
|
+
this.deltaIncrease = value / this._parent.globalDeltaIncrease;
|
|
165
|
+
}
|
|
166
|
+
get globalDeltaIncrease() {
|
|
167
|
+
if (this._parent == null)
|
|
168
|
+
return this.deltaIncrease;
|
|
169
|
+
return this.deltaIncrease * this._parent.globalDeltaIncrease;
|
|
170
|
+
}
|
|
171
|
+
// Methods
|
|
172
|
+
/**
|
|
173
|
+
* Returns the first descendant node that matches the given path and type.
|
|
174
|
+
*
|
|
175
|
+
* @param options Options to filter nodes
|
|
176
|
+
* @returns The matching node, or throws if not found
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```tsx
|
|
180
|
+
* const transform = useNode(PrimaryNode.Transform)
|
|
181
|
+
*
|
|
182
|
+
* useMount(() => {
|
|
183
|
+
* const sprite = transform.node.child({
|
|
184
|
+
* path: ['sprite'],
|
|
185
|
+
* type: PrimaryNode.Sprite
|
|
186
|
+
* })
|
|
187
|
+
* })
|
|
188
|
+
*
|
|
189
|
+
* return (
|
|
190
|
+
* <transform ref={transform}>
|
|
191
|
+
* <sprite id='sprite' />
|
|
192
|
+
* </transform>
|
|
193
|
+
* )
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
child(options) {
|
|
197
|
+
const { type, path } = options;
|
|
198
|
+
if (!(type in Nodes)) {
|
|
199
|
+
throw new UnknownNodeTypeError(type);
|
|
200
|
+
}
|
|
201
|
+
let node;
|
|
202
|
+
for (let i = 0; i < path.length; i++) {
|
|
203
|
+
if (node == null)
|
|
204
|
+
break;
|
|
205
|
+
const n = path[i];
|
|
206
|
+
if (n === '' && i === path.length - 1)
|
|
207
|
+
break;
|
|
208
|
+
node = node._children.find((node) => node.id === n);
|
|
209
|
+
}
|
|
210
|
+
if (node == null) {
|
|
211
|
+
throw new NodeChildNotFoundError(path.join('/'));
|
|
212
|
+
}
|
|
213
|
+
if (!(node instanceof Nodes[type])) {
|
|
214
|
+
throw new NodeTypeMismatchError(type, getNodeName(node));
|
|
215
|
+
}
|
|
216
|
+
return node;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Add child nodes to this node.
|
|
220
|
+
* @param children Nodes to add as children
|
|
221
|
+
*/
|
|
222
|
+
addChild(...children) {
|
|
223
|
+
for (const child of children) {
|
|
224
|
+
if (this._children.includes(child)) {
|
|
225
|
+
const index = this._children.indexOf(child);
|
|
226
|
+
this._children.splice(index, 1);
|
|
227
|
+
}
|
|
228
|
+
this.#attachChild(child);
|
|
229
|
+
this._children.push(child);
|
|
230
|
+
if (this.isStarted) {
|
|
231
|
+
child.start();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
this.#sortChildren();
|
|
235
|
+
}
|
|
236
|
+
removeChild(child) {
|
|
237
|
+
const index = this._children.indexOf(child);
|
|
238
|
+
if (index === -1)
|
|
239
|
+
return;
|
|
240
|
+
child._parent = undefined;
|
|
241
|
+
child.zIndexChanged.off(this.#reorder);
|
|
242
|
+
this._children.splice(index, 1);
|
|
243
|
+
}
|
|
244
|
+
#attachChild(child) {
|
|
245
|
+
child._parent = this;
|
|
246
|
+
child.zIndexChanged.on(this.#reorder);
|
|
247
|
+
}
|
|
248
|
+
#reorder = () => {
|
|
249
|
+
this.#sortChildren();
|
|
250
|
+
};
|
|
251
|
+
#sortChildren() {
|
|
252
|
+
this._children.sort((a, b) => a.globalZIndex - b.globalZIndex);
|
|
253
|
+
}
|
|
254
|
+
// Events
|
|
255
|
+
/**
|
|
256
|
+
* The **`zIndexChanged`** event fires when the node's `zIndex` value changes.
|
|
257
|
+
*/
|
|
258
|
+
zIndexChanged = new Event('zIndexChange', (_zIndex) => { });
|
|
259
|
+
/**
|
|
260
|
+
* The **`started`** event fires when the node finishes its `start()` lifecycle.
|
|
261
|
+
*/
|
|
262
|
+
started = new Event('start', () => { });
|
|
263
|
+
/**
|
|
264
|
+
* The **`drawed`** event fires each frame when the node is being drawn.
|
|
265
|
+
*/
|
|
266
|
+
drawed = new Event('draw', (_delta) => { });
|
|
267
|
+
/**
|
|
268
|
+
* The **`updated`** event fires each frame during the node's update cycle.
|
|
269
|
+
*/
|
|
270
|
+
updated = new Event('update', (_delta) => { });
|
|
271
|
+
/**
|
|
272
|
+
* The **`destroyed`** event fires when the node is destroyed.
|
|
273
|
+
*/
|
|
274
|
+
destroyed = new Event('destroy', () => { });
|
|
275
|
+
// Event functions
|
|
276
|
+
onZIndexChange(_zIndex) { }
|
|
277
|
+
onStart() { }
|
|
278
|
+
onDraw(_delta) { }
|
|
279
|
+
onUpdate(_delta) { }
|
|
280
|
+
onDestroy() { }
|
|
281
|
+
// Lifecycle methods
|
|
282
|
+
/**
|
|
283
|
+
* The **`start`** method initializes the node and starts its lifecycle.
|
|
284
|
+
* It attaches event callbacks and starts all child nodes.
|
|
285
|
+
* Called automatically when the node is added to the scene.
|
|
286
|
+
*/
|
|
287
|
+
start() {
|
|
288
|
+
if (this.isStarted)
|
|
289
|
+
return;
|
|
290
|
+
// Attach events
|
|
291
|
+
const events = Object.keys(this)
|
|
292
|
+
.filter((key) => this[key] instanceof Event)
|
|
293
|
+
.map((key) => this[key]);
|
|
294
|
+
for (const event of events) {
|
|
295
|
+
const key = getEventName(event.baseName);
|
|
296
|
+
if (this[key] == null)
|
|
297
|
+
continue;
|
|
298
|
+
const cb = this[key];
|
|
299
|
+
event.on(cb.bind(this));
|
|
300
|
+
}
|
|
301
|
+
this.isStarted = true;
|
|
302
|
+
for (const node of this._children) {
|
|
303
|
+
node.start();
|
|
304
|
+
}
|
|
305
|
+
this.started.emit();
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The **`update`** method is called each frame to update the node and its children.
|
|
309
|
+
* @param delta The time elapsed since the last frame in seconds.
|
|
310
|
+
*/
|
|
311
|
+
update(delta) {
|
|
312
|
+
this.updated.emit(delta);
|
|
313
|
+
for (const node of this._children) {
|
|
314
|
+
node.update(delta * node.deltaIncrease);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* The **`draw`** method is called each frame to render the node and its children.
|
|
319
|
+
* It applies position translation for proper rendering hierarchy.
|
|
320
|
+
* @param delta The time elapsed since the last frame in seconds.
|
|
321
|
+
*/
|
|
322
|
+
draw(delta) {
|
|
323
|
+
for (const node of this._children) {
|
|
324
|
+
node.draw(delta * node.deltaIncrease);
|
|
325
|
+
}
|
|
326
|
+
this.drawed.emit(delta);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The **`destroy`** method destroys this node and all its children.
|
|
330
|
+
*/
|
|
331
|
+
destroy() {
|
|
332
|
+
if (this.isDestroyed)
|
|
333
|
+
return;
|
|
334
|
+
const q = this._parent != null ? this._parent._children : [];
|
|
335
|
+
const index = q.indexOf(this);
|
|
336
|
+
if (index < 0)
|
|
337
|
+
return;
|
|
338
|
+
q.splice(index, 1);
|
|
339
|
+
this.isDestroyed = true;
|
|
340
|
+
this.destroyed.emit();
|
|
341
|
+
this.cleanEvents();
|
|
342
|
+
for (const node of [...this._children]) {
|
|
343
|
+
node.destroy();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The **`cleanEvents`** method removes all event listeners from this node.
|
|
348
|
+
* It is called automatically when the node is destroyed.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```tsx
|
|
352
|
+
* const transform = useNode(PrimaryNode.Transform)
|
|
353
|
+
*
|
|
354
|
+
* useMount(() => {
|
|
355
|
+
* transform.node.started.on(() => {
|
|
356
|
+
* console.log('Node started')
|
|
357
|
+
* })
|
|
358
|
+
*
|
|
359
|
+
* transform.node.cleanEvents()
|
|
360
|
+
* // No listeners will fire
|
|
361
|
+
* })
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
cleanEvents() {
|
|
365
|
+
this.started.clean();
|
|
366
|
+
this.drawed.clean();
|
|
367
|
+
this.updated.clean();
|
|
368
|
+
this.destroyed.clean();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=_node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_node.js","sourceRoot":"","sources":["../../src/nodes/_node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAsB,MAAM,gBAAgB,CAAA;AACnD,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAoE3C,MAAM,OAAO,GAAG,2BAA2B,CAAA;AAE3C,MAAM,OAAgB,IAAI;IACxB,IAAI,CAAG;IACP,GAAG,CAAiB;IACpB,OAAO,GAAW,CAAC,CAAA;IACnB,OAAO,CAAO;IACd,SAAS,GAAW,EAAE,CAAA;IACtB;;;;;;;;;;OAUG;IACH,aAAa,GAAW,CAAC,CAAA;IACzB,MAAM,CAAiB;IACvB,SAAS;IACT;;OAEG;IACH,SAAS,GAAY,KAAK,CAAA;IAC1B;;OAEG;IACH,WAAW,GAAY,KAAK,CAAA;IAE5B,YAAY,IAAO,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAkB;QAClF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAEhB,IAAI,OAAO,E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IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;QACpB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Event } from '../events/event.js';
|
|
2
|
+
import { PrimaryNode } from './lib/enum.js';
|
|
3
|
+
import { Node, type NodeOptions } from './_node.js';
|
|
4
|
+
import type { Reactive } from '../reactivity/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `AnimationPlayer` node.
|
|
7
|
+
*/
|
|
8
|
+
export interface AnimationPlayerOptions extends NodeOptions<PrimaryNode.AnimationPlayer> {
|
|
9
|
+
/**
|
|
10
|
+
* A function that returns a record of animation definitions.
|
|
11
|
+
* The function is called when the node starts (deferred), not at construction time.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <animation-player
|
|
16
|
+
* animations={() => ({
|
|
17
|
+
* idle: { keyframes: idleFrames, fps: 8 },
|
|
18
|
+
* walk: { keyframes: walkFrames, fps: 8, loop: true },
|
|
19
|
+
* })}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
animations?: Reactive<Record<string, Animation>>;
|
|
24
|
+
/**
|
|
25
|
+
* The animation to play initially. Accepts a static name or a reactive `Reactive`
|
|
26
|
+
* that automatically switches animations when the signal value changes.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Static
|
|
31
|
+
* <animation-player animations={...} currentAnim="idle" />
|
|
32
|
+
*
|
|
33
|
+
* // Reactive
|
|
34
|
+
* const animName = useComputed(() => isWalking() ? 'walk' : 'idle')
|
|
35
|
+
* <animation-player animations={...} currentAnim={animName} />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
currentAnim?: Reactive<string>;
|
|
39
|
+
/**
|
|
40
|
+
* When `true`, the node is automatically destroyed when the current animation ends.
|
|
41
|
+
* Useful for one-shot effect animations.
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <animation-player
|
|
48
|
+
* animations={() => ({ explode: { keyframes: frames, fps: 12 } })}
|
|
49
|
+
* currentAnim="explode"
|
|
50
|
+
* destroyOnEnd
|
|
51
|
+
* />
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
destroyOnEnd?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare class AnimationPlayer extends Node<PrimaryNode.AnimationPlayer> {
|
|
57
|
+
#private;
|
|
58
|
+
/** The read-only **`currentAnim`** property returns the current animation name */
|
|
59
|
+
get currentAnim(): string | null;
|
|
60
|
+
/** The read-only **`index`** property returns the current index */
|
|
61
|
+
get index(): number;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new `AnimationPlayer` node.
|
|
64
|
+
*
|
|
65
|
+
* If `animations` is provided, it is invoked when the node starts.
|
|
66
|
+
* If `currentAnim` is a `SignalGetter`, the player reactively tracks
|
|
67
|
+
* the signal and switches animations automatically.
|
|
68
|
+
*
|
|
69
|
+
* @param options AnimationPlayer configuration options
|
|
70
|
+
*/
|
|
71
|
+
constructor(options: AnimationPlayerOptions);
|
|
72
|
+
/**
|
|
73
|
+
* Detects whether `currentAnim` **change**
|
|
74
|
+
*/
|
|
75
|
+
animationChanged: Event<[_newAnim: string, _oldAnim: string | null], "animationChange">;
|
|
76
|
+
/**
|
|
77
|
+
* Detects whether `stop` is **called**
|
|
78
|
+
*/
|
|
79
|
+
animationStopped: Event<[_anim: string], "animationStop">;
|
|
80
|
+
/**
|
|
81
|
+
* Detects whether this `index` **change**
|
|
82
|
+
*/
|
|
83
|
+
animationIndexChanged: Event<[_index: number], "animationIndexChange">;
|
|
84
|
+
/**
|
|
85
|
+
* Detects whether the current animation **end**
|
|
86
|
+
*/
|
|
87
|
+
animationEnded: Event<[_anim: string], "animationEnd">;
|
|
88
|
+
/**
|
|
89
|
+
* The **`add`** method adds an animation with a key.
|
|
90
|
+
* @param animName Animation identifier
|
|
91
|
+
* @param animation Animation object
|
|
92
|
+
* @returns This instance for chaining
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* const sprite = useNode(PrimaryNode.Sprite)
|
|
97
|
+
* const anim = useNode(PrimaryNode.AnimationPlayer)
|
|
98
|
+
*
|
|
99
|
+
* useMount(() => {
|
|
100
|
+
* anim.node
|
|
101
|
+
* .add('idle', {
|
|
102
|
+
* fps: 4,
|
|
103
|
+
* keyframes: keyframesFromSheet(sprite.node, IDLE_TEXTURE, 4),
|
|
104
|
+
* loop: true,
|
|
105
|
+
* })
|
|
106
|
+
* .add('walk', {
|
|
107
|
+
* fps: 4,
|
|
108
|
+
* keyframes: keyframesFromSheet(sprite.node, WALK_TEXTURE, 4),
|
|
109
|
+
* loop: true,
|
|
110
|
+
* })
|
|
111
|
+
* .play('idle')
|
|
112
|
+
* })
|
|
113
|
+
*
|
|
114
|
+
* return (
|
|
115
|
+
* <sprite ref={sprite} textureId={IDLE_TEXTURE} sourceSize={new Vector2(16, 16)}>
|
|
116
|
+
* <animation-player ref={anim} />
|
|
117
|
+
* </sprite>
|
|
118
|
+
* )
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
add(animName: string, animation: Animation): this;
|
|
122
|
+
/**
|
|
123
|
+
* The **`define`** method adds multiple animations at once.
|
|
124
|
+
* @param animations Record of animation names to animation objects
|
|
125
|
+
* @returns This instance for chaining
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```tsx
|
|
129
|
+
* const sprite = useNode(PrimaryNode.Sprite)
|
|
130
|
+
* const anim = useNode(PrimaryNode.AnimationPlayer)
|
|
131
|
+
*
|
|
132
|
+
* useMount(() => {
|
|
133
|
+
* anim.node
|
|
134
|
+
* .define({
|
|
135
|
+
* idle: {
|
|
136
|
+
* fps: 4,
|
|
137
|
+
* keyframes: keyframesFromSheet(sprite.node, IDLE_TEXTURE, 4),
|
|
138
|
+
* loop: true,
|
|
139
|
+
* },
|
|
140
|
+
* walk: {
|
|
141
|
+
* fps: 4,
|
|
142
|
+
* keyframes: keyframesFromSheet(sprite.node, WALK_TEXTURE, 4),
|
|
143
|
+
* loop: true,
|
|
144
|
+
* },
|
|
145
|
+
* })
|
|
146
|
+
* .play('idle')
|
|
147
|
+
* })
|
|
148
|
+
*
|
|
149
|
+
* return (
|
|
150
|
+
* <sprite ref={sprite} textureId={IDLE_TEXTURE} sourceSize={new Vector2(16, 16)}>
|
|
151
|
+
* <animation-player ref={anim} />
|
|
152
|
+
* </sprite>
|
|
153
|
+
* )
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
define(animations: Record<string, Animation>): this;
|
|
157
|
+
/**
|
|
158
|
+
* The **`play`** method plays an animation by name.
|
|
159
|
+
* @param animName Animation identifier
|
|
160
|
+
* @param index Index to start from (default `0`)
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```tsx
|
|
164
|
+
* const anim = useNode(PrimaryNode.AnimationPlayer)
|
|
165
|
+
*
|
|
166
|
+
* useMount(() => {
|
|
167
|
+
* anim.node.play('idle')
|
|
168
|
+
* })
|
|
169
|
+
*
|
|
170
|
+
* return <animation-player ref={anim} />
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
play(animName: string, index?: number): void;
|
|
174
|
+
/**
|
|
175
|
+
* The **`setNext`** method sets the animation to play after the current one ends.
|
|
176
|
+
* @param animName Animation to play next, or `null` to stop
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```tsx
|
|
180
|
+
* const anim = useNode(PrimaryNode.AnimationPlayer)
|
|
181
|
+
*
|
|
182
|
+
* useEvent(anim, 'animationEnded', () => {
|
|
183
|
+
* anim.node.setNext('idle')
|
|
184
|
+
* })
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
setNext(animName: string | null): void;
|
|
188
|
+
/**
|
|
189
|
+
* The **`stop`** method stops the current animation.
|
|
190
|
+
*/
|
|
191
|
+
stop(): void;
|
|
192
|
+
update(delta: number): void;
|
|
193
|
+
cleanEvents(): void;
|
|
194
|
+
}
|
|
195
|
+
export interface Animation {
|
|
196
|
+
/** Frames per second */
|
|
197
|
+
fps: number;
|
|
198
|
+
/** Frames in the `Animation` */
|
|
199
|
+
keyframes: AnimationKeyframe[];
|
|
200
|
+
/** Whether the `Animation` should start over when it reaches the end. */
|
|
201
|
+
loop?: boolean | undefined;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* A keyframe function that receives the local time (0–1) within the frame
|
|
205
|
+
* and applies the frame's visual state to the sprite.
|
|
206
|
+
*/
|
|
207
|
+
export type AnimationKeyframe = (time: number) => void;
|
|
208
|
+
//# sourceMappingURL=animation-player.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation-player.d.ts","sourceRoot":"","sources":["../../src/nodes/animation-player.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAGtD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,WAAW,CAAC,WAAW,CAAC,eAAe,CAAC;IACtF;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;IAChD;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC9B;;;;;;;;;;;;;;OAcG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,qBAAa,eA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