excalibur 0.25.2 → 0.25.3
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/CHANGELOG.md +7 -2
- package/build/dist/Actions/Action/Blink.js +51 -0
- package/build/dist/Actions/Action/Blink.js.map +1 -0
- package/build/dist/Actions/Action/CallMethod.js +21 -0
- package/build/dist/Actions/Action/CallMethod.js.map +1 -0
- package/build/dist/Actions/Action/Delay.js +25 -0
- package/build/dist/Actions/Action/Delay.js.map +1 -0
- package/build/dist/Actions/Action/Die.js +22 -0
- package/build/dist/Actions/Action/Die.js.map +1 -0
- package/build/dist/Actions/Action/EaseTo.js +69 -0
- package/build/dist/Actions/Action/EaseTo.js.map +1 -0
- package/build/dist/Actions/Action/Fade.js +46 -0
- package/build/dist/Actions/Action/Fade.js.map +1 -0
- package/build/dist/Actions/Action/Follow.js +55 -0
- package/build/dist/Actions/Action/Follow.js.map +1 -0
- package/build/dist/Actions/Action/Meet.js +52 -0
- package/build/dist/Actions/Action/Meet.js.map +1 -0
- package/build/dist/Actions/Action/MoveBy.js +47 -0
- package/build/dist/Actions/Action/MoveBy.js.map +1 -0
- package/build/dist/Actions/Action/MoveTo.js +40 -0
- package/build/dist/Actions/Action/MoveTo.js.map +1 -0
- package/build/dist/Actions/Action/Repeat.js +31 -0
- package/build/dist/Actions/Action/Repeat.js.map +1 -0
- package/build/dist/Actions/Action/RepeatForever.js +37 -0
- package/build/dist/Actions/Action/RepeatForever.js.map +1 -0
- package/build/dist/Actions/Action/RotateBy.js +91 -0
- package/build/dist/Actions/Action/RotateBy.js.map +1 -0
- package/build/dist/Actions/Action/RotateTo.js +90 -0
- package/build/dist/Actions/Action/RotateTo.js.map +1 -0
- package/build/dist/Actions/Action/ScaleBy.js +45 -0
- package/build/dist/Actions/Action/ScaleBy.js.map +1 -0
- package/build/dist/Actions/Action/ScaleTo.js +56 -0
- package/build/dist/Actions/Action/ScaleTo.js.map +1 -0
- package/build/dist/Actions/Action.js +2 -0
- package/build/dist/Actions/Action.js.map +1 -0
- package/build/dist/Actions/ActionContext.js +305 -0
- package/build/dist/Actions/ActionContext.js.map +1 -0
- package/build/dist/Actions/ActionQueue.js +87 -0
- package/build/dist/Actions/ActionQueue.js.map +1 -0
- package/build/dist/Actions/Actionable.js +2 -0
- package/build/dist/Actions/Actionable.js.map +1 -0
- package/build/dist/Actions/ActionsComponent.js +198 -0
- package/build/dist/Actions/ActionsComponent.js.map +1 -0
- package/build/dist/Actions/ActionsSystem.js +18 -0
- package/build/dist/Actions/ActionsSystem.js.map +1 -0
- package/build/dist/Actions/Index.js +22 -0
- package/build/dist/Actions/Index.js.map +1 -0
- package/build/dist/Actions/RotationType.js +27 -0
- package/build/dist/Actions/RotationType.js.map +1 -0
- package/build/dist/Actor.js +831 -0
- package/build/dist/Actor.js.map +1 -0
- package/build/dist/Camera.js +663 -0
- package/build/dist/Camera.js.map +1 -0
- package/build/dist/Class.js +48 -0
- package/build/dist/Class.js.map +1 -0
- package/build/dist/Collision/BodyComponent.js +351 -0
- package/build/dist/Collision/BodyComponent.js.map +1 -0
- package/build/dist/Collision/BoundingBox.js +361 -0
- package/build/dist/Collision/BoundingBox.js.map +1 -0
- package/build/dist/Collision/ColliderComponent.js +198 -0
- package/build/dist/Collision/ColliderComponent.js.map +1 -0
- package/build/dist/Collision/Colliders/CircleCollider.js +264 -0
- package/build/dist/Collision/Colliders/CircleCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js +211 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/Collider.js +26 -0
- package/build/dist/Collision/Colliders/Collider.js.map +1 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js +301 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/CompositeCollider.js +232 -0
- package/build/dist/Collision/Colliders/CompositeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js +253 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js +389 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js +67 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js.map +1 -0
- package/build/dist/Collision/Colliders/Shape.js +102 -0
- package/build/dist/Collision/Colliders/Shape.js.map +1 -0
- package/build/dist/Collision/CollisionSystem.js +116 -0
- package/build/dist/Collision/CollisionSystem.js.map +1 -0
- package/build/dist/Collision/CollisionType.js +33 -0
- package/build/dist/Collision/CollisionType.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionContact.js +46 -0
- package/build/dist/Collision/Detection/CollisionContact.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js +2 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js.map +1 -0
- package/build/dist/Collision/Detection/DynamicTree.js +442 -0
- package/build/dist/Collision/Detection/DynamicTree.js.map +1 -0
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js +211 -0
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js.map +1 -0
- package/build/dist/Collision/Detection/Pair.js +92 -0
- package/build/dist/Collision/Detection/Pair.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroup.js +114 -0
- package/build/dist/Collision/Group/CollisionGroup.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroupManager.js +52 -0
- package/build/dist/Collision/Group/CollisionGroupManager.js.map +1 -0
- package/build/dist/Collision/Index.js +29 -0
- package/build/dist/Collision/Index.js.map +1 -0
- package/build/dist/Collision/Integrator.js +11 -0
- package/build/dist/Collision/Integrator.js.map +1 -0
- package/build/dist/Collision/MotionSystem.js +42 -0
- package/build/dist/Collision/MotionSystem.js.map +1 -0
- package/build/dist/Collision/Physics.js +163 -0
- package/build/dist/Collision/Physics.js.map +1 -0
- package/build/dist/Collision/Side.js +51 -0
- package/build/dist/Collision/Side.js.map +1 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js +101 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js.map +1 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js +83 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +1 -0
- package/build/dist/Collision/Solver/RealisticSolver.js +248 -0
- package/build/dist/Collision/Solver/RealisticSolver.js.map +1 -0
- package/build/dist/Collision/Solver/Solver.js +37 -0
- package/build/dist/Collision/Solver/Solver.js.map +1 -0
- package/build/dist/Color.js +461 -0
- package/build/dist/Color.js.map +1 -0
- package/build/dist/Configurable.js +32 -0
- package/build/dist/Configurable.js.map +1 -0
- package/build/dist/Debug/Debug.js +375 -0
- package/build/dist/Debug/Debug.js.map +1 -0
- package/build/dist/Debug/DebugFlags.js +40 -0
- package/build/dist/Debug/DebugFlags.js.map +1 -0
- package/build/dist/Debug/DebugSystem.js +251 -0
- package/build/dist/Debug/DebugSystem.js.map +1 -0
- package/build/dist/Debug/index.js +4 -0
- package/build/dist/Debug/index.js.map +1 -0
- package/build/dist/Deprecated.js +2 -0
- package/build/dist/Deprecated.js.map +1 -0
- package/build/dist/Drawing/Animation.js +294 -0
- package/build/dist/Drawing/Animation.js.map +1 -0
- package/build/dist/Drawing/CanvasDrawComponent.js +16 -0
- package/build/dist/Drawing/CanvasDrawComponent.js.map +1 -0
- package/build/dist/Drawing/CanvasDrawingSystem.js +95 -0
- package/build/dist/Drawing/CanvasDrawingSystem.js.map +1 -0
- package/build/dist/Drawing/Index.js +10 -0
- package/build/dist/Drawing/Index.js.map +1 -0
- package/build/dist/Drawing/Polygon.js +139 -0
- package/build/dist/Drawing/Polygon.js.map +1 -0
- package/build/dist/Drawing/Sprite.js +355 -0
- package/build/dist/Drawing/Sprite.js.map +1 -0
- package/build/dist/Drawing/SpriteEffects.js +246 -0
- package/build/dist/Drawing/SpriteEffects.js.map +1 -0
- package/build/dist/Drawing/SpriteSheet.js +413 -0
- package/build/dist/Drawing/SpriteSheet.js.map +1 -0
- package/build/dist/Drawing/Texture.js +69 -0
- package/build/dist/Drawing/Texture.js.map +1 -0
- package/build/dist/Engine.d.ts +4 -1
- package/build/dist/Engine.js +985 -0
- package/build/dist/Engine.js.map +1 -0
- package/build/dist/EntityComponentSystem/Component.js +65 -0
- package/build/dist/EntityComponentSystem/Component.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js +33 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js +249 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Entity.js +452 -0
- package/build/dist/EntityComponentSystem/Entity.js.map +1 -0
- package/build/dist/EntityComponentSystem/EntityManager.js +128 -0
- package/build/dist/EntityComponentSystem/EntityManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Query.js +91 -0
- package/build/dist/EntityComponentSystem/Query.js.map +1 -0
- package/build/dist/EntityComponentSystem/QueryManager.js +90 -0
- package/build/dist/EntityComponentSystem/QueryManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/System.js +76 -0
- package/build/dist/EntityComponentSystem/System.js.map +1 -0
- package/build/dist/EntityComponentSystem/SystemManager.js +102 -0
- package/build/dist/EntityComponentSystem/SystemManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Util.js +5 -0
- package/build/dist/EntityComponentSystem/Util.js.map +1 -0
- package/build/dist/EntityComponentSystem/World.js +55 -0
- package/build/dist/EntityComponentSystem/World.js.map +1 -0
- package/build/dist/EntityComponentSystem/index.js +11 -0
- package/build/dist/EntityComponentSystem/index.js.map +1 -0
- package/build/dist/EventDispatcher.js +114 -0
- package/build/dist/EventDispatcher.js.map +1 -0
- package/build/dist/Events/ExEvent.js +12 -0
- package/build/dist/Events/ExEvent.js.map +1 -0
- package/build/dist/Events/MediaEvents.js +75 -0
- package/build/dist/Events/MediaEvents.js.map +1 -0
- package/build/dist/Events/PointerEvents.js +52 -0
- package/build/dist/Events/PointerEvents.js.map +1 -0
- package/build/dist/Events.js +497 -0
- package/build/dist/Events.js.map +1 -0
- package/build/dist/Flags.js +90 -0
- package/build/dist/Flags.js.map +1 -0
- package/build/dist/Graphics/Animation.js +310 -0
- package/build/dist/Graphics/Animation.js.map +1 -0
- package/build/dist/Graphics/Canvas.js +38 -0
- package/build/dist/Graphics/Canvas.js.map +1 -0
- package/build/dist/Graphics/Circle.js +47 -0
- package/build/dist/Graphics/Circle.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js +2 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js +207 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +331 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js +160 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/debug-text.js +47 -0
- package/build/dist/Graphics/Context/debug-text.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js +209 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js +87 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js +82 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js +69 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js +272 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/render-source.js +16 -0
- package/build/dist/Graphics/Context/render-source.js.map +1 -0
- package/build/dist/Graphics/Context/render-target.js +65 -0
- package/build/dist/Graphics/Context/render-target.js.map +1 -0
- package/build/dist/Graphics/Context/renderer.js +2 -0
- package/build/dist/Graphics/Context/renderer.js.map +1 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js +53 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js.map +1 -0
- package/build/dist/Graphics/Context/shader.js +236 -0
- package/build/dist/Graphics/Context/shader.js.map +1 -0
- package/build/dist/Graphics/Context/state-stack.js +27 -0
- package/build/dist/Graphics/Context/state-stack.js.map +1 -0
- package/build/dist/Graphics/Context/texture-loader.d.ts +8 -0
- package/build/dist/Graphics/Context/texture-loader.js +121 -0
- package/build/dist/Graphics/Context/texture-loader.js.map +1 -0
- package/build/dist/Graphics/Context/transform-stack.js +30 -0
- package/build/dist/Graphics/Context/transform-stack.js.map +1 -0
- package/build/dist/Graphics/Context/vertex-buffer.js +45 -0
- package/build/dist/Graphics/Context/vertex-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/vertex-layout.js +93 -0
- package/build/dist/Graphics/Context/vertex-layout.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-adapter.js +19 -0
- package/build/dist/Graphics/Context/webgl-adapter.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-util.js +105 -0
- package/build/dist/Graphics/Context/webgl-util.js.map +1 -0
- package/build/dist/Graphics/DebugGraphicsComponent.js +15 -0
- package/build/dist/Graphics/DebugGraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/Filtering.js +17 -0
- package/build/dist/Graphics/Filtering.js.map +1 -0
- package/build/dist/Graphics/Font.js +293 -0
- package/build/dist/Graphics/Font.js.map +1 -0
- package/build/dist/Graphics/FontCommon.js +109 -0
- package/build/dist/Graphics/FontCommon.js.map +1 -0
- package/build/dist/Graphics/Graphic.js +200 -0
- package/build/dist/Graphics/Graphic.js.map +1 -0
- package/build/dist/Graphics/GraphicsComponent.js +290 -0
- package/build/dist/Graphics/GraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js +9 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js.map +1 -0
- package/build/dist/Graphics/GraphicsGroup.js +69 -0
- package/build/dist/Graphics/GraphicsGroup.js.map +1 -0
- package/build/dist/Graphics/GraphicsSystem.js +153 -0
- package/build/dist/Graphics/GraphicsSystem.js.map +1 -0
- package/build/dist/Graphics/ImageSource.js +116 -0
- package/build/dist/Graphics/ImageSource.js.map +1 -0
- package/build/dist/Graphics/Polygon.js +59 -0
- package/build/dist/Graphics/Polygon.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js +7 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js +52 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js +2 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js +56 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js.map +1 -0
- package/build/dist/Graphics/Raster.js +207 -0
- package/build/dist/Graphics/Raster.js.map +1 -0
- package/build/dist/Graphics/Rectangle.js +29 -0
- package/build/dist/Graphics/Rectangle.js.map +1 -0
- package/build/dist/Graphics/Sprite.js +103 -0
- package/build/dist/Graphics/Sprite.js.map +1 -0
- package/build/dist/Graphics/SpriteFont.js +120 -0
- package/build/dist/Graphics/SpriteFont.js.map +1 -0
- package/build/dist/Graphics/SpriteSheet.js +115 -0
- package/build/dist/Graphics/SpriteSheet.js.map +1 -0
- package/build/dist/Graphics/Text.js +94 -0
- package/build/dist/Graphics/Text.js.map +1 -0
- package/build/dist/Graphics/index.js +42 -0
- package/build/dist/Graphics/index.js.map +1 -0
- package/build/dist/Id.js +8 -0
- package/build/dist/Id.js.map +1 -0
- package/build/dist/Input/CapturePointerConfig.js +5 -0
- package/build/dist/Input/CapturePointerConfig.js.map +1 -0
- package/build/dist/Input/EngineInput.js +2 -0
- package/build/dist/Input/EngineInput.js.map +1 -0
- package/build/dist/Input/Gamepad.js +358 -0
- package/build/dist/Input/Gamepad.js.map +1 -0
- package/build/dist/Input/Index.js +22 -0
- package/build/dist/Input/Index.js.map +1 -0
- package/build/dist/Input/Keyboard.js +267 -0
- package/build/dist/Input/Keyboard.js.map +1 -0
- package/build/dist/Input/NativePointerButton.js +12 -0
- package/build/dist/Input/NativePointerButton.js.map +1 -0
- package/build/dist/Input/PointerAbstraction.js +41 -0
- package/build/dist/Input/PointerAbstraction.js.map +1 -0
- package/build/dist/Input/PointerButton.js +12 -0
- package/build/dist/Input/PointerButton.js.map +1 -0
- package/build/dist/Input/PointerComponent.js +28 -0
- package/build/dist/Input/PointerComponent.js.map +1 -0
- package/build/dist/Input/PointerEvent.js +25 -0
- package/build/dist/Input/PointerEvent.js.map +1 -0
- package/build/dist/Input/PointerEventReceiver.js +414 -0
- package/build/dist/Input/PointerEventReceiver.js.map +1 -0
- package/build/dist/Input/PointerScope.js +16 -0
- package/build/dist/Input/PointerScope.js.map +1 -0
- package/build/dist/Input/PointerSystem.js +217 -0
- package/build/dist/Input/PointerSystem.js.map +1 -0
- package/build/dist/Input/PointerType.js +11 -0
- package/build/dist/Input/PointerType.js.map +1 -0
- package/build/dist/Input/WheelDeltaMode.js +7 -0
- package/build/dist/Input/WheelDeltaMode.js.map +1 -0
- package/build/dist/Input/WheelEvent.js +21 -0
- package/build/dist/Input/WheelEvent.js.map +1 -0
- package/build/dist/Interfaces/Audio.js +2 -0
- package/build/dist/Interfaces/Audio.js.map +1 -0
- package/build/dist/Interfaces/AudioImplementation.js +11 -0
- package/build/dist/Interfaces/AudioImplementation.js.map +1 -0
- package/build/dist/Interfaces/Clonable.js +2 -0
- package/build/dist/Interfaces/Clonable.js.map +1 -0
- package/build/dist/Interfaces/Drawable.js +2 -0
- package/build/dist/Interfaces/Drawable.js.map +1 -0
- package/build/dist/Interfaces/Evented.js +2 -0
- package/build/dist/Interfaces/Evented.js.map +1 -0
- package/build/dist/Interfaces/Index.js +10 -0
- package/build/dist/Interfaces/Index.js.map +1 -0
- package/build/dist/Interfaces/LifecycleEvents.js +51 -0
- package/build/dist/Interfaces/LifecycleEvents.js.map +1 -0
- package/build/dist/Interfaces/Loadable.js +2 -0
- package/build/dist/Interfaces/Loadable.js.map +1 -0
- package/build/dist/Interfaces/PointerEventHandlers.js +2 -0
- package/build/dist/Interfaces/PointerEventHandlers.js.map +1 -0
- package/build/dist/Interfaces/Trait.js +2 -0
- package/build/dist/Interfaces/Trait.js.map +1 -0
- package/build/dist/Label.js +273 -0
- package/build/dist/Label.js.map +1 -0
- package/build/dist/Loader.js +367 -0
- package/build/dist/Loader.js.map +1 -0
- package/build/dist/Math/Index.js +10 -0
- package/build/dist/Math/Index.js.map +1 -0
- package/build/dist/Math/Random.js +239 -0
- package/build/dist/Math/Random.js.map +1 -0
- package/build/dist/Math/global-coordinates.js +30 -0
- package/build/dist/Math/global-coordinates.js.map +1 -0
- package/build/dist/Math/line.js +194 -0
- package/build/dist/Math/line.js.map +1 -0
- package/build/dist/Math/matrix.js +446 -0
- package/build/dist/Math/matrix.js.map +1 -0
- package/build/dist/Math/projection.js +24 -0
- package/build/dist/Math/projection.js.map +1 -0
- package/build/dist/Math/ray.js +52 -0
- package/build/dist/Math/ray.js.map +1 -0
- package/build/dist/Math/util.js +82 -0
- package/build/dist/Math/util.js.map +1 -0
- package/build/dist/Math/vector-view.js +25 -0
- package/build/dist/Math/vector-view.js.map +1 -0
- package/build/dist/Math/vector.js +326 -0
- package/build/dist/Math/vector.js.map +1 -0
- package/build/dist/Particles.js +449 -0
- package/build/dist/Particles.js.map +1 -0
- package/build/dist/Polyfill.js +56 -0
- package/build/dist/Polyfill.js.map +1 -0
- package/build/dist/Promises.js +205 -0
- package/build/dist/Promises.js.map +1 -0
- package/build/dist/Resources/Gif.js +479 -0
- package/build/dist/Resources/Gif.js.map +1 -0
- package/build/dist/Resources/Index.js +4 -0
- package/build/dist/Resources/Index.js.map +1 -0
- package/build/dist/Resources/Resource.js +74 -0
- package/build/dist/Resources/Resource.js.map +1 -0
- package/build/dist/Resources/Sound/AudioContext.js +16 -0
- package/build/dist/Resources/Sound/AudioContext.js.map +1 -0
- package/build/dist/Resources/Sound/Index.js +4 -0
- package/build/dist/Resources/Sound/Index.js.map +1 -0
- package/build/dist/Resources/Sound/Sound.js +240 -0
- package/build/dist/Resources/Sound/Sound.js.map +1 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js +160 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js.map +1 -0
- package/build/dist/Scene.js +458 -0
- package/build/dist/Scene.js.map +1 -0
- package/build/dist/Screen.js +634 -0
- package/build/dist/Screen.js.map +1 -0
- package/build/dist/ScreenElement.js +29 -0
- package/build/dist/ScreenElement.js.map +1 -0
- package/build/dist/TileMap.js +488 -0
- package/build/dist/TileMap.js.map +1 -0
- package/build/dist/Timer.js +198 -0
- package/build/dist/Timer.js.map +1 -0
- package/build/dist/Traits/Index.js +5 -0
- package/build/dist/Traits/Index.js.map +1 -0
- package/build/dist/Traits/OffscreenCulling.js +35 -0
- package/build/dist/Traits/OffscreenCulling.js.map +1 -0
- package/build/dist/Trigger.js +113 -0
- package/build/dist/Trigger.js.map +1 -0
- package/build/dist/Util/Actors.js +19 -0
- package/build/dist/Util/Actors.js.map +1 -0
- package/build/dist/Util/Browser.js +66 -0
- package/build/dist/Util/Browser.js.map +1 -0
- package/build/dist/Util/Clock.js +219 -0
- package/build/dist/Util/Clock.js.map +1 -0
- package/build/dist/Util/CullingBox.js +104 -0
- package/build/dist/Util/CullingBox.js.map +1 -0
- package/build/dist/Util/Decorators.js +78 -0
- package/build/dist/Util/Decorators.js.map +1 -0
- package/build/dist/Util/Detector.js +167 -0
- package/build/dist/Util/Detector.js.map +1 -0
- package/build/dist/Util/DrawUtil.js +117 -0
- package/build/dist/Util/DrawUtil.js.map +1 -0
- package/build/dist/Util/EasingFunctions.js +118 -0
- package/build/dist/Util/EasingFunctions.js.map +1 -0
- package/build/dist/Util/Fps.js +47 -0
- package/build/dist/Util/Fps.js.map +1 -0
- package/build/dist/Util/Index.js +7 -0
- package/build/dist/Util/Index.js.map +1 -0
- package/build/dist/Util/Log.js +195 -0
- package/build/dist/Util/Log.js.map +1 -0
- package/build/dist/Util/Observable.js +60 -0
- package/build/dist/Util/Observable.js.map +1 -0
- package/build/dist/Util/Pool.js +66 -0
- package/build/dist/Util/Pool.js.map +1 -0
- package/build/dist/Util/SortedList.js +261 -0
- package/build/dist/Util/SortedList.js.map +1 -0
- package/build/dist/Util/Sound.js +22 -0
- package/build/dist/Util/Sound.js.map +1 -0
- package/build/dist/Util/Util.js +294 -0
- package/build/dist/Util/Util.js.map +1 -0
- package/build/dist/Util/Watch.js +67 -0
- package/build/dist/Util/Watch.js.map +1 -0
- package/build/dist/Util/WebAudio.js +62 -0
- package/build/dist/Util/WebAudio.js.map +1 -0
- package/build/dist/excalibur.js +101 -22
- package/build/dist/excalibur.js.map +1 -1
- package/build/dist/excalibur.min.js +1 -1
- package/build/dist/excalibur.min.js.LICENSE.txt +1 -1
- package/build/dist/excalibur.min.js.map +1 -1
- package/build/dist/index.js +74 -0
- package/build/dist/index.js.map +1 -0
- package/build/esm/Engine.d.ts +4 -1
- package/build/esm/Graphics/Context/texture-loader.d.ts +8 -0
- package/build/esm/excalibur.js +101 -22
- package/build/esm/excalibur.js.map +1 -1
- package/build/esm/excalibur.min.js +1 -1
- package/build/esm/excalibur.min.js.LICENSE.txt +1 -1
- package/build/esm/excalibur.min.js.map +1 -1
- package/package.json +23 -22
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// Promises/A+ Spec http://promises-aplus.github.io/promises-spec/
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var Promise_1;
|
|
9
|
+
import { obsolete } from './Util/Decorators';
|
|
10
|
+
/**
|
|
11
|
+
* Valid states for a promise to be in
|
|
12
|
+
* @deprecated Will be removed in v0.26.0
|
|
13
|
+
*/
|
|
14
|
+
export var PromiseState;
|
|
15
|
+
(function (PromiseState) {
|
|
16
|
+
PromiseState[PromiseState["Resolved"] = 0] = "Resolved";
|
|
17
|
+
PromiseState[PromiseState["Rejected"] = 1] = "Rejected";
|
|
18
|
+
PromiseState[PromiseState["Pending"] = 2] = "Pending";
|
|
19
|
+
})(PromiseState || (PromiseState = {}));
|
|
20
|
+
/**
|
|
21
|
+
* Promises are used to do asynchronous work and they are useful for
|
|
22
|
+
* creating a chain of actions. In Excalibur they are used for loading,
|
|
23
|
+
* sounds, animation, actions, and more.
|
|
24
|
+
* @deprecated Will be removed in v0.26.0
|
|
25
|
+
*/
|
|
26
|
+
let Promise = Promise_1 = class Promise {
|
|
27
|
+
constructor() {
|
|
28
|
+
this._state = PromiseState.Pending;
|
|
29
|
+
this._successCallbacks = [];
|
|
30
|
+
this._rejectCallback = () => {
|
|
31
|
+
return;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create and resolve a Promise with an optional value
|
|
36
|
+
* @param value An optional value to wrap in a resolved promise
|
|
37
|
+
* @deprecated Use browser native promises
|
|
38
|
+
*/
|
|
39
|
+
static resolve(value) {
|
|
40
|
+
const promise = new Promise_1().resolve(value);
|
|
41
|
+
return promise;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create and reject a Promise with an optional value
|
|
45
|
+
* @param value An optional value to wrap in a rejected promise
|
|
46
|
+
* @deprecated Use browser native promises
|
|
47
|
+
*/
|
|
48
|
+
static reject(value) {
|
|
49
|
+
const promise = new Promise_1().reject(value);
|
|
50
|
+
return promise;
|
|
51
|
+
}
|
|
52
|
+
static join() {
|
|
53
|
+
let promises = [];
|
|
54
|
+
if (arguments.length > 0 && !Array.isArray(arguments[0])) {
|
|
55
|
+
for (let _i = 0; _i < arguments.length; _i++) {
|
|
56
|
+
promises[_i - 0] = arguments[_i];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (arguments.length === 1 && Array.isArray(arguments[0])) {
|
|
60
|
+
promises = arguments[0];
|
|
61
|
+
}
|
|
62
|
+
const joinedPromise = new Promise_1();
|
|
63
|
+
if (!promises || !promises.length) {
|
|
64
|
+
return joinedPromise.resolve();
|
|
65
|
+
}
|
|
66
|
+
const total = promises.length;
|
|
67
|
+
let successes = 0;
|
|
68
|
+
let rejects = 0;
|
|
69
|
+
const errors = [];
|
|
70
|
+
promises.forEach((p) => {
|
|
71
|
+
p.then(() => {
|
|
72
|
+
successes += 1;
|
|
73
|
+
if (successes === total) {
|
|
74
|
+
joinedPromise.resolve();
|
|
75
|
+
}
|
|
76
|
+
else if (successes + rejects + errors.length === total) {
|
|
77
|
+
joinedPromise.reject(errors);
|
|
78
|
+
}
|
|
79
|
+
}, () => {
|
|
80
|
+
rejects += 1;
|
|
81
|
+
if (successes + rejects + errors.length === total) {
|
|
82
|
+
joinedPromise.reject(errors);
|
|
83
|
+
}
|
|
84
|
+
}).error((e) => {
|
|
85
|
+
errors.push(e);
|
|
86
|
+
if (errors.length + successes + rejects === total) {
|
|
87
|
+
joinedPromise.reject(errors);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
return joinedPromise;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Chain success and reject callbacks after the promise is resolved
|
|
95
|
+
* @param successCallback Call on resolution of promise
|
|
96
|
+
* @param rejectCallback Call on rejection of promise
|
|
97
|
+
* @deprecated Use browser native promises
|
|
98
|
+
*/
|
|
99
|
+
then(successCallback, rejectCallback) {
|
|
100
|
+
if (successCallback) {
|
|
101
|
+
this._successCallbacks.push(successCallback);
|
|
102
|
+
// If the promise is already resolved call immediately
|
|
103
|
+
if (this.state() === PromiseState.Resolved) {
|
|
104
|
+
try {
|
|
105
|
+
successCallback.call(this, this._value);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
this._handleError(e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (rejectCallback) {
|
|
113
|
+
this._rejectCallback = rejectCallback;
|
|
114
|
+
// If the promise is already rejected call immediately
|
|
115
|
+
if (this.state() === PromiseState.Rejected) {
|
|
116
|
+
try {
|
|
117
|
+
rejectCallback.call(this, this._value);
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
this._handleError(e);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Add an error callback to the promise
|
|
128
|
+
* @param errorCallback Call if there was an error in a callback
|
|
129
|
+
* @deprecated Use browser native promises
|
|
130
|
+
*/
|
|
131
|
+
error(errorCallback) {
|
|
132
|
+
if (errorCallback) {
|
|
133
|
+
this._errorCallback = errorCallback;
|
|
134
|
+
}
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Resolve the promise and pass an option value to the success callbacks
|
|
139
|
+
* @param value Value to pass to the success callbacks
|
|
140
|
+
* @deprecated Use browser native promises
|
|
141
|
+
*/
|
|
142
|
+
resolve(value) {
|
|
143
|
+
if (this._state === PromiseState.Pending) {
|
|
144
|
+
this._value = value;
|
|
145
|
+
try {
|
|
146
|
+
this._state = PromiseState.Resolved;
|
|
147
|
+
this._successCallbacks.forEach((cb) => {
|
|
148
|
+
cb.call(this, this._value);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
this._handleError(e);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
throw new Error('Cannot resolve a promise that is not in a pending state!');
|
|
157
|
+
}
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Reject the promise and pass an option value to the reject callbacks
|
|
162
|
+
* @param value Value to pass to the reject callbacks
|
|
163
|
+
* @deprecated Use browser native promises
|
|
164
|
+
*/
|
|
165
|
+
reject(value) {
|
|
166
|
+
if (this._state === PromiseState.Pending) {
|
|
167
|
+
this._value = value;
|
|
168
|
+
try {
|
|
169
|
+
this._state = PromiseState.Rejected;
|
|
170
|
+
this._rejectCallback.call(this, this._value);
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
this._handleError(e);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
throw new Error('Cannot reject a promise that is not in a pending state!');
|
|
178
|
+
}
|
|
179
|
+
return this;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Inspect the current state of a promise
|
|
183
|
+
* @deprecated Use browser native promises
|
|
184
|
+
*/
|
|
185
|
+
state() {
|
|
186
|
+
return this._state;
|
|
187
|
+
}
|
|
188
|
+
_handleError(e) {
|
|
189
|
+
if (this._errorCallback) {
|
|
190
|
+
this._errorCallback.call(this, e);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
// rethrow error
|
|
194
|
+
throw e;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
Promise = Promise_1 = __decorate([
|
|
199
|
+
obsolete({
|
|
200
|
+
message: 'ex.Promises are being replaced by native browser promises in v0.26.0',
|
|
201
|
+
alternateMethod: 'Use browser native promises'
|
|
202
|
+
})
|
|
203
|
+
], Promise);
|
|
204
|
+
export { Promise };
|
|
205
|
+
//# sourceMappingURL=Promises.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Promises.js","sourceRoot":"","sources":["../../src/engine/Promises.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import { Resource } from './Resource';
|
|
2
|
+
import { Sprite } from '../Graphics/Sprite';
|
|
3
|
+
import { Color } from '../Color';
|
|
4
|
+
import { SpriteSheet } from '../Graphics/SpriteSheet';
|
|
5
|
+
import { Animation } from '../Graphics/Animation';
|
|
6
|
+
import { ImageSource } from '../Graphics/ImageSource';
|
|
7
|
+
import { range } from '../Math/util';
|
|
8
|
+
/**
|
|
9
|
+
* The [[Texture]] object allows games built in Excalibur to load image resources.
|
|
10
|
+
* [[Texture]] is an [[Loadable]] which means it can be passed to a [[Loader]]
|
|
11
|
+
* to pre-load before starting a level or game.
|
|
12
|
+
*/
|
|
13
|
+
export class Gif {
|
|
14
|
+
/**
|
|
15
|
+
* @param path Path to the image resource
|
|
16
|
+
* @param color Optionally set the color to treat as transparent the gif, by default [[Color.Magenta]]
|
|
17
|
+
* @param bustCache Optionally load texture with cache busting
|
|
18
|
+
*/
|
|
19
|
+
constructor(path, color = Color.Magenta, bustCache = true) {
|
|
20
|
+
this.path = path;
|
|
21
|
+
this.color = color;
|
|
22
|
+
this.bustCache = bustCache;
|
|
23
|
+
this._stream = null;
|
|
24
|
+
this._gif = null;
|
|
25
|
+
this._textures = [];
|
|
26
|
+
this._animation = null;
|
|
27
|
+
this._transparentColor = null;
|
|
28
|
+
this._resource = new Resource(path, 'arraybuffer', bustCache);
|
|
29
|
+
this._transparentColor = color;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Begins loading the texture and returns a promise to be resolved on completion
|
|
33
|
+
*/
|
|
34
|
+
async load() {
|
|
35
|
+
const arraybuffer = await this._resource.load();
|
|
36
|
+
this._stream = new Stream(arraybuffer);
|
|
37
|
+
this._gif = new ParseGif(this._stream, this._transparentColor);
|
|
38
|
+
const images = this._gif.images.map(i => new ImageSource(i.src, false));
|
|
39
|
+
// Load all textures
|
|
40
|
+
await Promise.all(images.map(t => t.load()));
|
|
41
|
+
return this.data = this._textures = images;
|
|
42
|
+
}
|
|
43
|
+
isLoaded() {
|
|
44
|
+
return !!this.data;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Return a frame of the gif as a legacy sprite by index
|
|
48
|
+
* @deprecated
|
|
49
|
+
*/
|
|
50
|
+
toLegacySprite(id = 0) {
|
|
51
|
+
return Sprite.toLegacySprite(this.toSprite(id));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Return the gif as a legacy spritesheet
|
|
55
|
+
* @deprecated
|
|
56
|
+
*/
|
|
57
|
+
toLegacySpriteSheet() {
|
|
58
|
+
return SpriteSheet.toLegacySpriteSheet(this.toSpriteSheet());
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Return the gif as a legacy animation
|
|
62
|
+
* @deprecated
|
|
63
|
+
* @param engine
|
|
64
|
+
* @param speed
|
|
65
|
+
*/
|
|
66
|
+
toLegacyAnimation(engine, speed) {
|
|
67
|
+
return Animation.toLegacyAnimation(engine, this.toAnimation(speed));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Return a frame of the gif as a sprite by id
|
|
71
|
+
* @param id
|
|
72
|
+
*/
|
|
73
|
+
toSprite(id = 0) {
|
|
74
|
+
const sprite = this._textures[id].toSprite();
|
|
75
|
+
return sprite;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Return the gif as a spritesheet
|
|
79
|
+
*/
|
|
80
|
+
toSpriteSheet() {
|
|
81
|
+
const sprites = this._textures.map((image) => {
|
|
82
|
+
return image.toSprite();
|
|
83
|
+
});
|
|
84
|
+
return new SpriteSheet({ sprites });
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Transform the GIF into an animation with duration per frame
|
|
88
|
+
*/
|
|
89
|
+
toAnimation(durationPerFrameMs) {
|
|
90
|
+
const spriteSheet = this.toSpriteSheet();
|
|
91
|
+
const length = spriteSheet.sprites.length;
|
|
92
|
+
this._animation = Animation.fromSpriteSheet(spriteSheet, range(0, length), durationPerFrameMs);
|
|
93
|
+
return this._animation;
|
|
94
|
+
}
|
|
95
|
+
get readCheckBytes() {
|
|
96
|
+
return this._gif.checkBytes;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const bitsToNum = (ba) => {
|
|
100
|
+
return ba.reduce(function (s, n) {
|
|
101
|
+
return s * 2 + n;
|
|
102
|
+
}, 0);
|
|
103
|
+
};
|
|
104
|
+
const byteToBitArr = (bite) => {
|
|
105
|
+
const a = [];
|
|
106
|
+
for (let i = 7; i >= 0; i--) {
|
|
107
|
+
a.push(!!(bite & (1 << i)));
|
|
108
|
+
}
|
|
109
|
+
return a;
|
|
110
|
+
};
|
|
111
|
+
export class Stream {
|
|
112
|
+
constructor(dataArray) {
|
|
113
|
+
this.data = null;
|
|
114
|
+
this.len = 0;
|
|
115
|
+
this.position = 0;
|
|
116
|
+
this.readByte = () => {
|
|
117
|
+
if (this.position >= this.data.byteLength) {
|
|
118
|
+
throw new Error('Attempted to read past end of stream.');
|
|
119
|
+
}
|
|
120
|
+
return this.data[this.position++];
|
|
121
|
+
};
|
|
122
|
+
this.readBytes = (n) => {
|
|
123
|
+
const bytes = [];
|
|
124
|
+
for (let i = 0; i < n; i++) {
|
|
125
|
+
bytes.push(this.readByte());
|
|
126
|
+
}
|
|
127
|
+
return bytes;
|
|
128
|
+
};
|
|
129
|
+
this.read = (n) => {
|
|
130
|
+
let s = '';
|
|
131
|
+
for (let i = 0; i < n; i++) {
|
|
132
|
+
s += String.fromCharCode(this.readByte());
|
|
133
|
+
}
|
|
134
|
+
return s;
|
|
135
|
+
};
|
|
136
|
+
this.readUnsigned = () => {
|
|
137
|
+
// Little-endian.
|
|
138
|
+
const a = this.readBytes(2);
|
|
139
|
+
return (a[1] << 8) + a[0];
|
|
140
|
+
};
|
|
141
|
+
this.data = new Uint8Array(dataArray);
|
|
142
|
+
this.len = this.data.byteLength;
|
|
143
|
+
if (this.len === 0) {
|
|
144
|
+
throw new Error('No data loaded from file');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const lzwDecode = function (minCodeSize, data) {
|
|
149
|
+
// TODO: Now that the GIF parser is a bit different, maybe this should get an array of bytes instead of a String?
|
|
150
|
+
let pos = 0; // Maybe this streaming thing should be merged with the Stream?
|
|
151
|
+
const readCode = function (size) {
|
|
152
|
+
let code = 0;
|
|
153
|
+
for (let i = 0; i < size; i++) {
|
|
154
|
+
if (data.charCodeAt(pos >> 3) & (1 << (pos & 7))) {
|
|
155
|
+
code |= 1 << i;
|
|
156
|
+
}
|
|
157
|
+
pos++;
|
|
158
|
+
}
|
|
159
|
+
return code;
|
|
160
|
+
};
|
|
161
|
+
const output = [];
|
|
162
|
+
const clearCode = 1 << minCodeSize;
|
|
163
|
+
const eoiCode = clearCode + 1;
|
|
164
|
+
let codeSize = minCodeSize + 1;
|
|
165
|
+
let dict = [];
|
|
166
|
+
const clear = function () {
|
|
167
|
+
dict = [];
|
|
168
|
+
codeSize = minCodeSize + 1;
|
|
169
|
+
for (let i = 0; i < clearCode; i++) {
|
|
170
|
+
dict[i] = [i];
|
|
171
|
+
}
|
|
172
|
+
dict[clearCode] = [];
|
|
173
|
+
dict[eoiCode] = null;
|
|
174
|
+
};
|
|
175
|
+
let code;
|
|
176
|
+
let last;
|
|
177
|
+
while (true) {
|
|
178
|
+
last = code;
|
|
179
|
+
code = readCode(codeSize);
|
|
180
|
+
if (code === clearCode) {
|
|
181
|
+
clear();
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (code === eoiCode) {
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
if (code < dict.length) {
|
|
188
|
+
if (last !== clearCode) {
|
|
189
|
+
dict.push(dict[last].concat(dict[code][0]));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
if (code !== dict.length) {
|
|
194
|
+
throw new Error('Invalid LZW code.');
|
|
195
|
+
}
|
|
196
|
+
dict.push(dict[last].concat(dict[last][0]));
|
|
197
|
+
}
|
|
198
|
+
output.push.apply(output, dict[code]);
|
|
199
|
+
if (dict.length === 1 << codeSize && codeSize < 12) {
|
|
200
|
+
// If we're at the last code and codeSize is 12, the next code will be a clearCode, and it'll be 12 bits long.
|
|
201
|
+
codeSize++;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// I don't know if this is technically an error, but some GIFs do it.
|
|
205
|
+
//if (Math.ceil(pos / 8) !== data.length) throw new Error('Extraneous LZW bytes.');
|
|
206
|
+
return output;
|
|
207
|
+
};
|
|
208
|
+
// The actual parsing; returns an object with properties.
|
|
209
|
+
export class ParseGif {
|
|
210
|
+
constructor(stream, color = Color.Magenta) {
|
|
211
|
+
this._st = null;
|
|
212
|
+
this._handler = {};
|
|
213
|
+
this._transparentColor = null;
|
|
214
|
+
this.frames = [];
|
|
215
|
+
this.images = [];
|
|
216
|
+
this.globalColorTable = [];
|
|
217
|
+
this.checkBytes = [];
|
|
218
|
+
// LZW (GIF-specific)
|
|
219
|
+
this.parseColorTable = (entries) => {
|
|
220
|
+
// Each entry is 3 bytes, for RGB.
|
|
221
|
+
const ct = [];
|
|
222
|
+
for (let i = 0; i < entries; i++) {
|
|
223
|
+
const rgb = this._st.readBytes(3);
|
|
224
|
+
const rgba = '#' +
|
|
225
|
+
rgb
|
|
226
|
+
.map((x) => {
|
|
227
|
+
const hex = x.toString(16);
|
|
228
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
229
|
+
})
|
|
230
|
+
.join('');
|
|
231
|
+
ct.push(rgba);
|
|
232
|
+
}
|
|
233
|
+
return ct;
|
|
234
|
+
};
|
|
235
|
+
this.readSubBlocks = () => {
|
|
236
|
+
let size, data;
|
|
237
|
+
data = '';
|
|
238
|
+
do {
|
|
239
|
+
size = this._st.readByte();
|
|
240
|
+
data += this._st.read(size);
|
|
241
|
+
} while (size !== 0);
|
|
242
|
+
return data;
|
|
243
|
+
};
|
|
244
|
+
this.parseHeader = () => {
|
|
245
|
+
const hdr = {
|
|
246
|
+
sig: null,
|
|
247
|
+
ver: null,
|
|
248
|
+
width: null,
|
|
249
|
+
height: null,
|
|
250
|
+
colorRes: null,
|
|
251
|
+
globalColorTableSize: null,
|
|
252
|
+
gctFlag: null,
|
|
253
|
+
sorted: null,
|
|
254
|
+
globalColorTable: [],
|
|
255
|
+
bgColor: null,
|
|
256
|
+
pixelAspectRatio: null // if not 0, aspectRatio = (pixelAspectRatio + 15) / 64
|
|
257
|
+
};
|
|
258
|
+
hdr.sig = this._st.read(3);
|
|
259
|
+
hdr.ver = this._st.read(3);
|
|
260
|
+
if (hdr.sig !== 'GIF') {
|
|
261
|
+
throw new Error('Not a GIF file.'); // XXX: This should probably be handled more nicely.
|
|
262
|
+
}
|
|
263
|
+
hdr.width = this._st.readUnsigned();
|
|
264
|
+
hdr.height = this._st.readUnsigned();
|
|
265
|
+
const bits = byteToBitArr(this._st.readByte());
|
|
266
|
+
hdr.gctFlag = bits.shift();
|
|
267
|
+
hdr.colorRes = bitsToNum(bits.splice(0, 3));
|
|
268
|
+
hdr.sorted = bits.shift();
|
|
269
|
+
hdr.globalColorTableSize = bitsToNum(bits.splice(0, 3));
|
|
270
|
+
hdr.bgColor = this._st.readByte();
|
|
271
|
+
hdr.pixelAspectRatio = this._st.readByte(); // if not 0, aspectRatio = (pixelAspectRatio + 15) / 64
|
|
272
|
+
if (hdr.gctFlag) {
|
|
273
|
+
hdr.globalColorTable = this.parseColorTable(1 << (hdr.globalColorTableSize + 1));
|
|
274
|
+
this.globalColorTable = hdr.globalColorTable;
|
|
275
|
+
}
|
|
276
|
+
if (this._handler.hdr && this._handler.hdr(hdr)) {
|
|
277
|
+
this.checkBytes.push(this._handler.hdr);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
this.parseExt = (block) => {
|
|
281
|
+
const parseGCExt = (block) => {
|
|
282
|
+
this.checkBytes.push(this._st.readByte()); // Always 4
|
|
283
|
+
const bits = byteToBitArr(this._st.readByte());
|
|
284
|
+
block.reserved = bits.splice(0, 3); // Reserved; should be 000.
|
|
285
|
+
block.disposalMethod = bitsToNum(bits.splice(0, 3));
|
|
286
|
+
block.userInput = bits.shift();
|
|
287
|
+
block.transparencyGiven = bits.shift();
|
|
288
|
+
block.delayTime = this._st.readUnsigned();
|
|
289
|
+
block.transparencyIndex = this._st.readByte();
|
|
290
|
+
block.terminator = this._st.readByte();
|
|
291
|
+
if (this._handler.gce && this._handler.gce(block)) {
|
|
292
|
+
this.checkBytes.push(this._handler.gce);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
const parseComExt = (block) => {
|
|
296
|
+
block.comment = this.readSubBlocks();
|
|
297
|
+
if (this._handler.com && this._handler.com(block)) {
|
|
298
|
+
this.checkBytes.push(this._handler.com);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const parsePTExt = (block) => {
|
|
302
|
+
this.checkBytes.push(this._st.readByte()); // Always 12
|
|
303
|
+
block.ptHeader = this._st.readBytes(12);
|
|
304
|
+
block.ptData = this.readSubBlocks();
|
|
305
|
+
if (this._handler.pte && this._handler.pte(block)) {
|
|
306
|
+
this.checkBytes.push(this._handler.pte);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const parseAppExt = (block) => {
|
|
310
|
+
const parseNetscapeExt = (block) => {
|
|
311
|
+
this.checkBytes.push(this._st.readByte()); // Always 3
|
|
312
|
+
block.unknown = this._st.readByte(); // Q: Always 1? What is this?
|
|
313
|
+
block.iterations = this._st.readUnsigned();
|
|
314
|
+
block.terminator = this._st.readByte();
|
|
315
|
+
if (this._handler.app && this._handler.app.NETSCAPE && this._handler.app.NETSCAPE(block)) {
|
|
316
|
+
this.checkBytes.push(this._handler.app);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const parseUnknownAppExt = (block) => {
|
|
320
|
+
block.appData = this.readSubBlocks();
|
|
321
|
+
// FIXME: This won't work if a handler wants to match on any identifier.
|
|
322
|
+
if (this._handler.app && this._handler.app[block.identifier] && this._handler.app[block.identifier](block)) {
|
|
323
|
+
this.checkBytes.push(this._handler.app[block.identifier]);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
this.checkBytes.push(this._st.readByte()); // Always 11
|
|
327
|
+
block.identifier = this._st.read(8);
|
|
328
|
+
block.authCode = this._st.read(3);
|
|
329
|
+
switch (block.identifier) {
|
|
330
|
+
case 'NETSCAPE':
|
|
331
|
+
parseNetscapeExt(block);
|
|
332
|
+
break;
|
|
333
|
+
default:
|
|
334
|
+
parseUnknownAppExt(block);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
const parseUnknownExt = (block) => {
|
|
339
|
+
block.data = this.readSubBlocks();
|
|
340
|
+
if (this._handler.unknown && this._handler.unknown(block)) {
|
|
341
|
+
this.checkBytes.push(this._handler.unknown);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
block.label = this._st.readByte();
|
|
345
|
+
switch (block.label) {
|
|
346
|
+
case 0xf9:
|
|
347
|
+
block.extType = 'gce';
|
|
348
|
+
parseGCExt(block);
|
|
349
|
+
break;
|
|
350
|
+
case 0xfe:
|
|
351
|
+
block.extType = 'com';
|
|
352
|
+
parseComExt(block);
|
|
353
|
+
break;
|
|
354
|
+
case 0x01:
|
|
355
|
+
block.extType = 'pte';
|
|
356
|
+
parsePTExt(block);
|
|
357
|
+
break;
|
|
358
|
+
case 0xff:
|
|
359
|
+
block.extType = 'app';
|
|
360
|
+
parseAppExt(block);
|
|
361
|
+
break;
|
|
362
|
+
default:
|
|
363
|
+
block.extType = 'unknown';
|
|
364
|
+
parseUnknownExt(block);
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
this.parseImg = (img) => {
|
|
369
|
+
const deinterlace = (pixels, width) => {
|
|
370
|
+
// Of course this defeats the purpose of interlacing. And it's *probably*
|
|
371
|
+
// the least efficient way it's ever been implemented. But nevertheless...
|
|
372
|
+
const newPixels = new Array(pixels.length);
|
|
373
|
+
const rows = pixels.length / width;
|
|
374
|
+
const cpRow = (toRow, fromRow) => {
|
|
375
|
+
const fromPixels = pixels.slice(fromRow * width, (fromRow + 1) * width);
|
|
376
|
+
newPixels.splice.apply(newPixels, [toRow * width, width].concat(fromPixels));
|
|
377
|
+
};
|
|
378
|
+
const offsets = [0, 4, 2, 1];
|
|
379
|
+
const steps = [8, 8, 4, 2];
|
|
380
|
+
let fromRow = 0;
|
|
381
|
+
for (let pass = 0; pass < 4; pass++) {
|
|
382
|
+
for (let toRow = offsets[pass]; toRow < rows; toRow += steps[pass]) {
|
|
383
|
+
cpRow(toRow, fromRow);
|
|
384
|
+
fromRow++;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return newPixels;
|
|
388
|
+
};
|
|
389
|
+
img.leftPos = this._st.readUnsigned();
|
|
390
|
+
img.topPos = this._st.readUnsigned();
|
|
391
|
+
img.width = this._st.readUnsigned();
|
|
392
|
+
img.height = this._st.readUnsigned();
|
|
393
|
+
const bits = byteToBitArr(this._st.readByte());
|
|
394
|
+
img.lctFlag = bits.shift();
|
|
395
|
+
img.interlaced = bits.shift();
|
|
396
|
+
img.sorted = bits.shift();
|
|
397
|
+
img.reserved = bits.splice(0, 2);
|
|
398
|
+
img.lctSize = bitsToNum(bits.splice(0, 3));
|
|
399
|
+
if (img.lctFlag) {
|
|
400
|
+
img.lct = this.parseColorTable(1 << (img.lctSize + 1));
|
|
401
|
+
}
|
|
402
|
+
img.lzwMinCodeSize = this._st.readByte();
|
|
403
|
+
const lzwData = this.readSubBlocks();
|
|
404
|
+
img.pixels = lzwDecode(img.lzwMinCodeSize, lzwData);
|
|
405
|
+
if (img.interlaced) {
|
|
406
|
+
// Move
|
|
407
|
+
img.pixels = deinterlace(img.pixels, img.width);
|
|
408
|
+
}
|
|
409
|
+
this.frames.push(img);
|
|
410
|
+
this.arrayToImage(img);
|
|
411
|
+
if (this._handler.img && this._handler.img(img)) {
|
|
412
|
+
this.checkBytes.push(this._handler);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
this.parseBlock = () => {
|
|
416
|
+
const block = {
|
|
417
|
+
sentinel: this._st.readByte(),
|
|
418
|
+
type: ''
|
|
419
|
+
};
|
|
420
|
+
const blockChar = String.fromCharCode(block.sentinel);
|
|
421
|
+
switch (blockChar) {
|
|
422
|
+
case '!':
|
|
423
|
+
block.type = 'ext';
|
|
424
|
+
this.parseExt(block);
|
|
425
|
+
break;
|
|
426
|
+
case ',':
|
|
427
|
+
block.type = 'img';
|
|
428
|
+
this.parseImg(block);
|
|
429
|
+
break;
|
|
430
|
+
case ';':
|
|
431
|
+
block.type = 'eof';
|
|
432
|
+
if (this._handler.eof && this._handler.eof(block)) {
|
|
433
|
+
this.checkBytes.push(this._handler.eof);
|
|
434
|
+
}
|
|
435
|
+
break;
|
|
436
|
+
default:
|
|
437
|
+
throw new Error('Unknown block: 0x' + block.sentinel.toString(16));
|
|
438
|
+
}
|
|
439
|
+
if (block.type !== 'eof') {
|
|
440
|
+
this.parseBlock();
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
this.arrayToImage = (frame) => {
|
|
444
|
+
let count = 0;
|
|
445
|
+
const c = document.createElement('canvas');
|
|
446
|
+
c.id = count.toString();
|
|
447
|
+
c.width = frame.width;
|
|
448
|
+
c.height = frame.height;
|
|
449
|
+
count++;
|
|
450
|
+
const context = c.getContext('2d');
|
|
451
|
+
const pixSize = 1;
|
|
452
|
+
let y = 0;
|
|
453
|
+
let x = 0;
|
|
454
|
+
for (let i = 0; i < frame.pixels.length; i++) {
|
|
455
|
+
if (x % frame.width === 0) {
|
|
456
|
+
y++;
|
|
457
|
+
x = 0;
|
|
458
|
+
}
|
|
459
|
+
if (this.globalColorTable[frame.pixels[i]] === this._transparentColor.toHex()) {
|
|
460
|
+
context.fillStyle = `rgba(0, 0, 0, 0)`;
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
context.fillStyle = this.globalColorTable[frame.pixels[i]];
|
|
464
|
+
}
|
|
465
|
+
context.fillRect(x, y, pixSize, pixSize);
|
|
466
|
+
x++;
|
|
467
|
+
}
|
|
468
|
+
const img = new Image();
|
|
469
|
+
img.src = c.toDataURL();
|
|
470
|
+
this.images.push(img);
|
|
471
|
+
};
|
|
472
|
+
this._st = stream;
|
|
473
|
+
this._handler = {};
|
|
474
|
+
this._transparentColor = color;
|
|
475
|
+
this.parseHeader();
|
|
476
|
+
this.parseBlock();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
//# sourceMappingURL=Gif.js.map
|