excalibur 0.26.0-alpha.263 → 0.26.0-alpha.267
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/.nvmrc +1 -1
- package/CHANGELOG.md +1 -0
- package/build/dist/Graphics/Animation.d.ts +60 -0
- package/build/dist/Graphics/Animation.js +74 -3
- package/build/dist/Graphics/Animation.js.map +1 -1
- package/build/dist/excalibur.js +77 -5
- 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 +2 -2
- package/build/esm/Actions/Action/Blink.d.ts +17 -0
- package/build/esm/Actions/Action/CallMethod.d.ts +10 -0
- package/build/esm/Actions/Action/Delay.d.ts +12 -0
- package/build/esm/Actions/Action/Die.d.ts +11 -0
- package/build/esm/Actions/Action/EaseTo.d.ts +21 -0
- package/build/esm/Actions/Action/Fade.d.ts +17 -0
- package/build/esm/Actions/Action/Follow.d.ts +23 -0
- package/build/esm/Actions/Action/Meet.d.ts +23 -0
- package/build/esm/Actions/Action/MoveBy.d.ts +22 -0
- package/build/esm/Actions/Action/MoveTo.d.ts +21 -0
- package/build/esm/Actions/Action/Repeat.d.ts +16 -0
- package/build/esm/Actions/Action/RepeatForever.d.ts +20 -0
- package/build/esm/Actions/Action/RotateBy.d.ts +27 -0
- package/build/esm/Actions/Action/RotateTo.d.ts +26 -0
- package/build/esm/Actions/Action/ScaleBy.d.ts +24 -0
- package/build/esm/Actions/Action/ScaleTo.d.ts +23 -0
- package/build/esm/Actions/Action.d.ts +10 -0
- package/build/esm/Actions/ActionContext.d.ts +219 -0
- package/build/esm/Actions/ActionQueue.d.ts +56 -0
- package/build/esm/Actions/Actionable.d.ts +4 -0
- package/build/esm/Actions/ActionsComponent.d.ts +236 -0
- package/build/esm/Actions/ActionsSystem.d.ts +9 -0
- package/build/esm/Actions/Index.d.ts +21 -0
- package/build/esm/Actions/RotationType.d.ts +25 -0
- package/build/esm/Actor.d.ts +727 -0
- package/build/esm/Camera.d.ts +360 -0
- package/build/esm/Class.d.ts +43 -0
- package/build/esm/Collision/BodyComponent.d.ts +208 -0
- package/build/esm/Collision/BoundingBox.d.ts +109 -0
- package/build/esm/Collision/ColliderComponent.d.ts +98 -0
- package/build/esm/Collision/Colliders/CircleCollider.d.ts +92 -0
- package/build/esm/Collision/Colliders/ClosestLineJumpTable.d.ts +23 -0
- package/build/esm/Collision/Colliders/Collider.d.ts +94 -0
- package/build/esm/Collision/Colliders/CollisionJumpTable.d.ts +14 -0
- package/build/esm/Collision/Colliders/CompositeCollider.d.ts +38 -0
- package/build/esm/Collision/Colliders/EdgeCollider.d.ts +112 -0
- package/build/esm/Collision/Colliders/PolygonCollider.d.ts +138 -0
- package/build/esm/Collision/Colliders/SeparatingAxis.d.ts +46 -0
- package/build/esm/Collision/Colliders/Shape.d.ts +54 -0
- package/build/esm/Collision/CollisionSystem.d.ts +26 -0
- package/build/esm/Collision/CollisionType.d.ts +31 -0
- package/build/esm/Collision/Detection/CollisionContact.d.ts +53 -0
- package/build/esm/Collision/Detection/CollisionProcessor.d.ts +28 -0
- package/build/esm/Collision/Detection/DynamicTree.d.ts +85 -0
- package/build/esm/Collision/Detection/DynamicTreeCollisionProcessor.d.ts +40 -0
- package/build/esm/Collision/Detection/Pair.d.ts +31 -0
- package/build/esm/Collision/Group/CollisionGroup.d.ts +96 -0
- package/build/esm/Collision/Group/CollisionGroupManager.d.ts +30 -0
- package/build/esm/Collision/Index.d.ts +28 -0
- package/build/esm/Collision/Integrator.d.ts +6 -0
- package/build/esm/Collision/MotionSystem.d.ts +11 -0
- package/build/esm/Collision/Physics.d.ts +133 -0
- package/build/esm/Collision/Side.d.ts +21 -0
- package/build/esm/Collision/Solver/ArcadeSolver.d.ts +15 -0
- package/build/esm/Collision/Solver/ContactConstraintPoint.d.ts +43 -0
- package/build/esm/Collision/Solver/RealisticSolver.d.ts +21 -0
- package/build/esm/Collision/Solver/Solver.d.ts +50 -0
- package/build/esm/Color.d.ts +244 -0
- package/build/esm/Configurable.d.ts +9 -0
- package/build/esm/Debug/Debug.d.ts +327 -0
- package/build/esm/Debug/DebugFlags.d.ts +11 -0
- package/build/esm/Debug/DebugSystem.d.ts +29 -0
- package/build/esm/Debug/index.d.ts +3 -0
- package/build/esm/Deprecated.d.ts +0 -0
- package/build/esm/Drawing/Animation.d.ts +196 -0
- package/build/esm/Drawing/CanvasDrawComponent.d.ts +10 -0
- package/build/esm/Drawing/CanvasDrawingSystem.d.ts +23 -0
- package/build/esm/Drawing/Index.d.ts +9 -0
- package/build/esm/Drawing/Polygon.d.ts +74 -0
- package/build/esm/Drawing/Sprite.d.ts +159 -0
- package/build/esm/Drawing/SpriteEffects.d.ts +120 -0
- package/build/esm/Drawing/SpriteSheet.d.ts +184 -0
- package/build/esm/Drawing/Texture.d.ts +44 -0
- package/build/esm/Engine.d.ts +581 -0
- package/build/esm/EntityComponentSystem/Component.d.ts +69 -0
- package/build/esm/EntityComponentSystem/Components/MotionComponent.d.ts +55 -0
- package/build/esm/EntityComponentSystem/Components/TransformComponent.d.ts +103 -0
- package/build/esm/EntityComponentSystem/Entity.d.ts +247 -0
- package/build/esm/EntityComponentSystem/EntityManager.d.ts +35 -0
- package/build/esm/EntityComponentSystem/Query.d.ts +51 -0
- package/build/esm/EntityComponentSystem/QueryManager.d.ts +48 -0
- package/build/esm/EntityComponentSystem/System.d.ts +107 -0
- package/build/esm/EntityComponentSystem/SystemManager.d.ts +45 -0
- package/build/esm/EntityComponentSystem/Util.d.ts +1 -0
- package/build/esm/EntityComponentSystem/World.d.ts +45 -0
- package/build/esm/EntityComponentSystem/index.d.ts +10 -0
- package/build/esm/EventDispatcher.d.ts +51 -0
- package/build/esm/Events/MediaEvents.d.ts +47 -0
- package/build/esm/Events.d.ts +475 -0
- package/build/esm/Flags.d.ts +62 -0
- package/build/esm/Graphics/Animation.d.ts +189 -0
- package/build/esm/Graphics/Canvas.d.ts +24 -0
- package/build/esm/Graphics/Circle.d.ts +15 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContext.d.ts +155 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContext2DCanvas.d.ts +87 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +105 -0
- package/build/esm/Graphics/Context/batch.d.ts +11 -0
- package/build/esm/Graphics/Context/debug-text.d.ts +24 -0
- package/build/esm/Graphics/Context/draw-image-command.d.ts +47 -0
- package/build/esm/Graphics/Context/image-renderer.d.ts +39 -0
- package/build/esm/Graphics/Context/line-renderer.d.ts +22 -0
- package/build/esm/Graphics/Context/point-renderer.d.ts +22 -0
- package/build/esm/Graphics/Context/renderer.d.ts +66 -0
- package/build/esm/Graphics/Context/shader.d.ts +81 -0
- package/build/esm/Graphics/Context/state-stack.d.ts +10 -0
- package/build/esm/Graphics/Context/texture-loader.d.ts +33 -0
- package/build/esm/Graphics/Context/transform-stack.d.ts +12 -0
- package/build/esm/Graphics/Context/webgl-util.d.ts +12 -0
- package/build/esm/Graphics/Font.d.ts +57 -0
- package/build/esm/Graphics/FontCommon.d.ts +123 -0
- package/build/esm/Graphics/Graphic.d.ts +129 -0
- package/build/esm/Graphics/GraphicsComponent.d.ts +222 -0
- package/build/esm/Graphics/GraphicsDiagnostics.d.ts +5 -0
- package/build/esm/Graphics/GraphicsGroup.d.ts +24 -0
- package/build/esm/Graphics/GraphicsSystem.d.ts +35 -0
- package/build/esm/Graphics/ImageSource.d.ts +53 -0
- package/build/esm/Graphics/Polygon.d.ts +17 -0
- package/build/esm/Graphics/Raster.d.ts +105 -0
- package/build/esm/Graphics/Rectangle.d.ts +13 -0
- package/build/esm/Graphics/Sprite.d.ts +59 -0
- package/build/esm/Graphics/SpriteFont.d.ts +53 -0
- package/build/esm/Graphics/SpriteSheet.d.ts +137 -0
- package/build/esm/Graphics/Text.d.ts +29 -0
- package/build/esm/Graphics/index.d.ts +21 -0
- package/build/esm/Id.d.ts +8 -0
- package/build/esm/Input/CapturePointerConfig.d.ts +13 -0
- package/build/esm/Input/EngineInput.d.ts +8 -0
- package/build/esm/Input/Gamepad.d.ts +227 -0
- package/build/esm/Input/Index.d.ts +14 -0
- package/build/esm/Input/Keyboard.d.ts +187 -0
- package/build/esm/Input/Pointer.d.ts +134 -0
- package/build/esm/Input/PointerEvents.d.ts +170 -0
- package/build/esm/Input/Pointers.d.ts +78 -0
- package/build/esm/Interfaces/Audio.d.ts +29 -0
- package/build/esm/Interfaces/AudioImplementation.d.ts +25 -0
- package/build/esm/Interfaces/Clonable.d.ts +3 -0
- package/build/esm/Interfaces/Drawable.d.ts +97 -0
- package/build/esm/Interfaces/Evented.d.ts +31 -0
- package/build/esm/Interfaces/Index.d.ts +9 -0
- package/build/esm/Interfaces/LifecycleEvents.d.ts +167 -0
- package/build/esm/Interfaces/Loadable.d.ts +18 -0
- package/build/esm/Interfaces/PointerEventHandlers.d.ts +40 -0
- package/build/esm/Interfaces/Trait.d.ts +9 -0
- package/build/esm/Label.d.ts +146 -0
- package/build/esm/Loader.d.ts +173 -0
- package/build/esm/Math/Index.d.ts +8 -0
- package/build/esm/Math/Random.d.ts +125 -0
- package/build/esm/Math/global-coordinates.d.ts +10 -0
- package/build/esm/Math/line.d.ts +95 -0
- package/build/esm/Math/matrix.d.ts +110 -0
- package/build/esm/Math/projection.d.ts +10 -0
- package/build/esm/Math/ray.d.ts +25 -0
- package/build/esm/Math/vector-view.d.ts +18 -0
- package/build/esm/Math/vector.d.ts +201 -0
- package/build/esm/Particles.d.ts +244 -0
- package/build/esm/Polyfill.d.ts +6 -0
- package/build/esm/PostProcessing/ColorBlindCorrector.d.ts +28 -0
- package/build/esm/PostProcessing/Index.d.ts +2 -0
- package/build/esm/PostProcessing/PostProcessor.d.ts +6 -0
- package/build/esm/Promises.d.ts +87 -0
- package/build/esm/Resources/Gif.d.ts +117 -0
- package/build/esm/Resources/Index.d.ts +3 -0
- package/build/esm/Resources/Resource.d.ts +31 -0
- package/build/esm/Resources/Sound/AudioContext.d.ts +7 -0
- package/build/esm/Resources/Sound/Index.d.ts +3 -0
- package/build/esm/Resources/Sound/Sound.d.ts +79 -0
- package/build/esm/Resources/Sound/WebAudioInstance.d.ts +45 -0
- package/build/esm/Scene.d.ts +301 -0
- package/build/esm/Screen.d.ts +282 -0
- package/build/esm/ScreenElement.d.ts +13 -0
- package/build/esm/TileMap.d.ts +222 -0
- package/build/esm/Timer.d.ts +93 -0
- package/build/esm/Traits/CapturePointer.d.ts +10 -0
- package/build/esm/Traits/Index.d.ts +5 -0
- package/build/esm/Traits/OffscreenCulling.d.ts +11 -0
- package/build/esm/Trigger.d.ts +48 -0
- package/build/esm/Util/Actors.d.ts +12 -0
- package/build/esm/Util/Browser.d.ts +28 -0
- package/build/esm/Util/CullingBox.d.ts +23 -0
- package/build/esm/Util/Decorators.d.ts +15 -0
- package/build/esm/Util/Detector.d.ts +40 -0
- package/build/esm/Util/DrawUtil.d.ts +69 -0
- package/build/esm/Util/EasingFunctions.d.ts +59 -0
- package/build/esm/Util/Index.d.ts +6 -0
- package/build/esm/Util/Log.d.ts +109 -0
- package/build/esm/Util/Observable.d.ts +55 -0
- package/build/esm/Util/Pool.d.ts +44 -0
- package/build/esm/Util/SortedList.d.ts +52 -0
- package/build/esm/Util/Sound.d.ts +4 -0
- package/build/esm/Util/Util.d.ts +196 -0
- package/build/esm/Util/Watch.d.ts +8 -0
- package/build/esm/Util/WebAudio.d.ts +15 -0
- package/build/esm/excalibur.d.ts +2 -0
- package/build/esm/excalibur.js +28793 -0
- package/build/esm/excalibur.js.map +1 -0
- package/build/esm/excalibur.min.js +3 -0
- package/build/esm/excalibur.min.js.LICENSE.txt +7 -0
- package/build/esm/excalibur.min.js.map +1 -0
- package/build/esm/index.d.ts +57 -0
- package/package.json +7 -7
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
14.18.
|
|
1
|
+
14.18.1
|
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
14
14
|
- `withEngine` utils support an aditional options parameter to override the Engine default options.
|
|
15
15
|
- Story to show a play / pause implementation.
|
|
16
16
|
- `ex.Animation` now support `totalDuration` that will calculate automatically each frame duration based on how many frames have.
|
|
17
|
+
- `ex.Animation` now supports `.reverse()` to reverse the direction of play in an animation, use the `ex.Animation.direction` to inspect if the animation is playing in the `ex.AnimationDirection.Forward` direction or the `ex.AnimationDirection.Backward` direction.
|
|
17
18
|
-
|
|
18
19
|
### Changed
|
|
19
20
|
|
|
@@ -11,6 +11,16 @@ export interface HasTick {
|
|
|
11
11
|
*/
|
|
12
12
|
tick(elapsedMilliseconds: number, idempotencyToken?: number): void;
|
|
13
13
|
}
|
|
14
|
+
export declare enum AnimationDirection {
|
|
15
|
+
/**
|
|
16
|
+
* Animation is playing forwards
|
|
17
|
+
*/
|
|
18
|
+
Forward = "forward",
|
|
19
|
+
/**
|
|
20
|
+
* Animation is play backwards
|
|
21
|
+
*/
|
|
22
|
+
Backward = "backward"
|
|
23
|
+
}
|
|
14
24
|
export declare enum AnimationStrategy {
|
|
15
25
|
/**
|
|
16
26
|
* Animation ends without displaying anything
|
|
@@ -50,6 +60,10 @@ export interface AnimationOptions {
|
|
|
50
60
|
* List of frames in the order you wish to play them
|
|
51
61
|
*/
|
|
52
62
|
frames: Frame[];
|
|
63
|
+
/**
|
|
64
|
+
* Optionally reverse the direction of play
|
|
65
|
+
*/
|
|
66
|
+
reverse?: boolean;
|
|
53
67
|
/**
|
|
54
68
|
* Optionally specify a default frame duration in ms (Default is 1000)
|
|
55
69
|
*/
|
|
@@ -114,15 +128,61 @@ export declare class Animation extends Graphic implements HasTick {
|
|
|
114
128
|
* @returns LegacyDrawing.Animation
|
|
115
129
|
*/
|
|
116
130
|
static toLegacyAnimation(engine: Engine, animation: Animation): LegacyDrawing.Animation;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the current Frame of the animation
|
|
133
|
+
*/
|
|
117
134
|
get currentFrame(): Frame | null;
|
|
135
|
+
/**
|
|
136
|
+
* Returns the current frame index of the animation
|
|
137
|
+
*/
|
|
138
|
+
get currentFrameIndex(): number;
|
|
139
|
+
/**
|
|
140
|
+
* Returns `true` if the animation is playing
|
|
141
|
+
*/
|
|
118
142
|
get isPlaying(): boolean;
|
|
143
|
+
private _reversed;
|
|
144
|
+
/**
|
|
145
|
+
* Reverses the play direction of the Animation, this preserves the current frame
|
|
146
|
+
*/
|
|
147
|
+
reverse(): void;
|
|
148
|
+
/**
|
|
149
|
+
* Returns the current play direction of the animation
|
|
150
|
+
*/
|
|
151
|
+
get direction(): AnimationDirection;
|
|
152
|
+
/**
|
|
153
|
+
* Plays or resumes the animation from the current frame
|
|
154
|
+
*/
|
|
119
155
|
play(): void;
|
|
156
|
+
/**
|
|
157
|
+
* Pauses the animation on the current frame
|
|
158
|
+
*/
|
|
120
159
|
pause(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Reset the animation back to the beginning, including if the animation were done
|
|
162
|
+
*/
|
|
121
163
|
reset(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Returns `true` if the animation can end
|
|
166
|
+
*/
|
|
122
167
|
get canFinish(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Returns `true` if the animation is done, for looping type animations
|
|
170
|
+
* `ex.AnimationStrategy.PingPong` and `ex.AnimationStrategy.Loop` this will always return `false`
|
|
171
|
+
*
|
|
172
|
+
* See the `ex.Animation.canFinish()` method to know if an animation type can end
|
|
173
|
+
*/
|
|
123
174
|
get done(): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Jump the animation immediately to a specific frame if it exists
|
|
177
|
+
* @param frameNumber
|
|
178
|
+
*/
|
|
124
179
|
goToFrame(frameNumber: number): void;
|
|
125
180
|
private _nextFrame;
|
|
181
|
+
/**
|
|
182
|
+
* Called internally by Excalibur to update the state of the animation potential update the current frame
|
|
183
|
+
* @param elapsedMilliseconds Milliseconds elapsed
|
|
184
|
+
* @param idempotencyToken Prevents double ticking in a frame by passing a unique token to the frame
|
|
185
|
+
*/
|
|
126
186
|
tick(elapsedMilliseconds: number, idempotencyToken?: number): void;
|
|
127
187
|
private _updateDimensions;
|
|
128
188
|
protected _drawImage(ctx: ExcaliburGraphicsContext, x: number, y: number): void;
|
|
@@ -4,6 +4,17 @@ import { EventDispatcher } from '../EventDispatcher';
|
|
|
4
4
|
import { Logger } from '../Util/Log';
|
|
5
5
|
import { LegacyDrawing } from '..';
|
|
6
6
|
import { Sprite } from '.';
|
|
7
|
+
export var AnimationDirection;
|
|
8
|
+
(function (AnimationDirection) {
|
|
9
|
+
/**
|
|
10
|
+
* Animation is playing forwards
|
|
11
|
+
*/
|
|
12
|
+
AnimationDirection["Forward"] = "forward";
|
|
13
|
+
/**
|
|
14
|
+
* Animation is play backwards
|
|
15
|
+
*/
|
|
16
|
+
AnimationDirection["Backward"] = "backward";
|
|
17
|
+
})(AnimationDirection || (AnimationDirection = {}));
|
|
7
18
|
export var AnimationStrategy;
|
|
8
19
|
(function (AnimationStrategy) {
|
|
9
20
|
/**
|
|
@@ -41,16 +52,20 @@ export class Animation extends Graphic {
|
|
|
41
52
|
this._firstTick = true;
|
|
42
53
|
this._currentFrame = 0;
|
|
43
54
|
this._timeLeftInFrame = 0;
|
|
44
|
-
this._direction = 1;
|
|
55
|
+
this._direction = 1; // TODO only used in ping-pong
|
|
45
56
|
this._done = false;
|
|
46
57
|
this._playing = true;
|
|
58
|
+
this._reversed = false;
|
|
47
59
|
this.frames = options.frames;
|
|
48
60
|
this.strategy = (_a = options.strategy) !== null && _a !== void 0 ? _a : this.strategy;
|
|
49
61
|
this.frameDuration = options.totalDuration ? options.totalDuration / this.frames.length : (_b = options.frameDuration) !== null && _b !== void 0 ? _b : this.frameDuration;
|
|
62
|
+
if (options.reverse) {
|
|
63
|
+
this.reverse();
|
|
64
|
+
}
|
|
50
65
|
this.goToFrame(0);
|
|
51
66
|
}
|
|
52
67
|
clone() {
|
|
53
|
-
return new Animation(Object.assign({ frames: this.frames.map((f) => (Object.assign({}, f))), frameDuration: this.frameDuration, strategy: this.strategy }, this.cloneGraphicOptions()));
|
|
68
|
+
return new Animation(Object.assign({ frames: this.frames.map((f) => (Object.assign({}, f))), frameDuration: this.frameDuration, reverse: this._reversed, strategy: this.strategy }, this.cloneGraphicOptions()));
|
|
54
69
|
}
|
|
55
70
|
/**
|
|
56
71
|
* Create an Animation from a [[SpriteSheet]], a list of indices into the sprite sheet, a duration per frame
|
|
@@ -101,27 +116,68 @@ export class Animation extends Graphic {
|
|
|
101
116
|
engine: engine
|
|
102
117
|
});
|
|
103
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Returns the current Frame of the animation
|
|
121
|
+
*/
|
|
104
122
|
get currentFrame() {
|
|
105
123
|
if (this._currentFrame >= 0 && this._currentFrame < this.frames.length) {
|
|
106
124
|
return this.frames[this._currentFrame];
|
|
107
125
|
}
|
|
108
126
|
return null;
|
|
109
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Returns the current frame index of the animation
|
|
130
|
+
*/
|
|
131
|
+
get currentFrameIndex() {
|
|
132
|
+
return this._currentFrame;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Returns `true` if the animation is playing
|
|
136
|
+
*/
|
|
110
137
|
get isPlaying() {
|
|
111
138
|
return this._playing;
|
|
112
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Reverses the play direction of the Animation, this preserves the current frame
|
|
142
|
+
*/
|
|
143
|
+
reverse() {
|
|
144
|
+
// Don't mutate with the original frame list, create a copy
|
|
145
|
+
this.frames = this.frames.slice().reverse();
|
|
146
|
+
this._reversed = !this._reversed;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Returns the current play direction of the animation
|
|
150
|
+
*/
|
|
151
|
+
get direction() {
|
|
152
|
+
// Keep logically consistent with ping-pong direction
|
|
153
|
+
// If ping-pong is forward = 1 and reversed is true then we are logically reversed
|
|
154
|
+
const reversed = (this._reversed && this._direction === 1) ? true : false;
|
|
155
|
+
return reversed ? AnimationDirection.Backward : AnimationDirection.Forward;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Plays or resumes the animation from the current frame
|
|
159
|
+
*/
|
|
113
160
|
play() {
|
|
114
161
|
this._playing = true;
|
|
115
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Pauses the animation on the current frame
|
|
165
|
+
*/
|
|
116
166
|
pause() {
|
|
117
167
|
this._playing = false;
|
|
118
|
-
this._firstTick = true;
|
|
168
|
+
this._firstTick = true; // firstTick must be set to emit the proper frame event
|
|
119
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Reset the animation back to the beginning, including if the animation were done
|
|
172
|
+
*/
|
|
120
173
|
reset() {
|
|
121
174
|
this._done = false;
|
|
122
175
|
this._firstTick = true;
|
|
123
176
|
this._currentFrame = 0;
|
|
124
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Returns `true` if the animation can end
|
|
180
|
+
*/
|
|
125
181
|
get canFinish() {
|
|
126
182
|
switch (this.strategy) {
|
|
127
183
|
case AnimationStrategy.End:
|
|
@@ -133,9 +189,19 @@ export class Animation extends Graphic {
|
|
|
133
189
|
}
|
|
134
190
|
}
|
|
135
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Returns `true` if the animation is done, for looping type animations
|
|
194
|
+
* `ex.AnimationStrategy.PingPong` and `ex.AnimationStrategy.Loop` this will always return `false`
|
|
195
|
+
*
|
|
196
|
+
* See the `ex.Animation.canFinish()` method to know if an animation type can end
|
|
197
|
+
*/
|
|
136
198
|
get done() {
|
|
137
199
|
return this._done;
|
|
138
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Jump the animation immediately to a specific frame if it exists
|
|
203
|
+
* @param frameNumber
|
|
204
|
+
*/
|
|
139
205
|
goToFrame(frameNumber) {
|
|
140
206
|
var _a, _b;
|
|
141
207
|
this._currentFrame = frameNumber;
|
|
@@ -194,6 +260,11 @@ export class Animation extends Graphic {
|
|
|
194
260
|
}
|
|
195
261
|
return next;
|
|
196
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Called internally by Excalibur to update the state of the animation potential update the current frame
|
|
265
|
+
* @param elapsedMilliseconds Milliseconds elapsed
|
|
266
|
+
* @param idempotencyToken Prevents double ticking in a frame by passing a unique token to the frame
|
|
267
|
+
*/
|
|
197
268
|
tick(elapsedMilliseconds, idempotencyToken = 0) {
|
|
198
269
|
if (this._idempotencyToken === idempotencyToken) {
|
|
199
270
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animation.js","sourceRoot":"","sources":["../../../src/engine/Graphics/Animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAU,aAAa,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAW3B,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"Animation.js","sourceRoot":"","sources":["../../../src/engine/Graphics/Animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAU,aAAa,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAW3B,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,yCAAmB,CAAA;IACnB;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AAQ,EAAE;YAClB,OAAO;SACR;QAED,2CAA2C;QAC3C,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,YAAmB,CAAC,CAAC;SACrD;QAED,IAAI,CAAC,gBAAgB,IAAI,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC;QAC9D,IAAI,IAAI,CAAC,gBAAgB,IAAI,CAAC,EAAE;YAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SACnC;QACD,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAEO,iBAAiB;;QACvB,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,KAAK,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,OAAO,0CAAE,KAAK,CAAC;YAC9C,IAAI,CAAC,MAAM,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,OAAO,0CAAE,MAAM,CAAC;SACjD;IACH,CAAC;IAES,UAAU,CAAC,GAA6B,EAAE,CAAS,EAAE,CAAS;QACtE,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SAC3C;IACH,CAAC;;AApSc,iBAAO,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC"}
|
package/build/dist/excalibur.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* excalibur - 0.26.0-alpha.
|
|
2
|
+
* excalibur - 0.26.0-alpha.267+ad95c5d - 2021-11-1
|
|
3
3
|
* https://github.com/excaliburjs/Excalibur
|
|
4
4
|
* Copyright (c) 2021 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
|
|
5
5
|
* Licensed BSD-2-Clause
|
|
@@ -1792,6 +1792,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1792
1792
|
"AddedComponent": () => (/* reexport */ AddedComponent),
|
|
1793
1793
|
"AddedEntity": () => (/* reexport */ AddedEntity),
|
|
1794
1794
|
"Animation": () => (/* reexport */ Animation),
|
|
1795
|
+
"AnimationDirection": () => (/* reexport */ AnimationDirection),
|
|
1795
1796
|
"AnimationStrategy": () => (/* reexport */ AnimationStrategy),
|
|
1796
1797
|
"ArcadeSolver": () => (/* reexport */ ArcadeSolver),
|
|
1797
1798
|
"AudioContextFactory": () => (/* reexport */ AudioContextFactory),
|
|
@@ -19572,6 +19573,17 @@ GraphicsDiagnostics.DrawnImagesCount = 0;
|
|
|
19572
19573
|
|
|
19573
19574
|
|
|
19574
19575
|
|
|
19576
|
+
var AnimationDirection;
|
|
19577
|
+
(function (AnimationDirection) {
|
|
19578
|
+
/**
|
|
19579
|
+
* Animation is playing forwards
|
|
19580
|
+
*/
|
|
19581
|
+
AnimationDirection["Forward"] = "forward";
|
|
19582
|
+
/**
|
|
19583
|
+
* Animation is play backwards
|
|
19584
|
+
*/
|
|
19585
|
+
AnimationDirection["Backward"] = "backward";
|
|
19586
|
+
})(AnimationDirection || (AnimationDirection = {}));
|
|
19575
19587
|
var AnimationStrategy;
|
|
19576
19588
|
(function (AnimationStrategy) {
|
|
19577
19589
|
/**
|
|
@@ -19609,16 +19621,20 @@ class Animation extends Graphic {
|
|
|
19609
19621
|
this._firstTick = true;
|
|
19610
19622
|
this._currentFrame = 0;
|
|
19611
19623
|
this._timeLeftInFrame = 0;
|
|
19612
|
-
this._direction = 1;
|
|
19624
|
+
this._direction = 1; // TODO only used in ping-pong
|
|
19613
19625
|
this._done = false;
|
|
19614
19626
|
this._playing = true;
|
|
19627
|
+
this._reversed = false;
|
|
19615
19628
|
this.frames = options.frames;
|
|
19616
19629
|
this.strategy = (_a = options.strategy) !== null && _a !== void 0 ? _a : this.strategy;
|
|
19617
19630
|
this.frameDuration = options.totalDuration ? options.totalDuration / this.frames.length : (_b = options.frameDuration) !== null && _b !== void 0 ? _b : this.frameDuration;
|
|
19631
|
+
if (options.reverse) {
|
|
19632
|
+
this.reverse();
|
|
19633
|
+
}
|
|
19618
19634
|
this.goToFrame(0);
|
|
19619
19635
|
}
|
|
19620
19636
|
clone() {
|
|
19621
|
-
return new Animation(Object.assign({ frames: this.frames.map((f) => (Object.assign({}, f))), frameDuration: this.frameDuration, strategy: this.strategy }, this.cloneGraphicOptions()));
|
|
19637
|
+
return new Animation(Object.assign({ frames: this.frames.map((f) => (Object.assign({}, f))), frameDuration: this.frameDuration, reverse: this._reversed, strategy: this.strategy }, this.cloneGraphicOptions()));
|
|
19622
19638
|
}
|
|
19623
19639
|
/**
|
|
19624
19640
|
* Create an Animation from a [[SpriteSheet]], a list of indices into the sprite sheet, a duration per frame
|
|
@@ -19669,27 +19685,68 @@ class Animation extends Graphic {
|
|
|
19669
19685
|
engine: engine
|
|
19670
19686
|
});
|
|
19671
19687
|
}
|
|
19688
|
+
/**
|
|
19689
|
+
* Returns the current Frame of the animation
|
|
19690
|
+
*/
|
|
19672
19691
|
get currentFrame() {
|
|
19673
19692
|
if (this._currentFrame >= 0 && this._currentFrame < this.frames.length) {
|
|
19674
19693
|
return this.frames[this._currentFrame];
|
|
19675
19694
|
}
|
|
19676
19695
|
return null;
|
|
19677
19696
|
}
|
|
19697
|
+
/**
|
|
19698
|
+
* Returns the current frame index of the animation
|
|
19699
|
+
*/
|
|
19700
|
+
get currentFrameIndex() {
|
|
19701
|
+
return this._currentFrame;
|
|
19702
|
+
}
|
|
19703
|
+
/**
|
|
19704
|
+
* Returns `true` if the animation is playing
|
|
19705
|
+
*/
|
|
19678
19706
|
get isPlaying() {
|
|
19679
19707
|
return this._playing;
|
|
19680
19708
|
}
|
|
19709
|
+
/**
|
|
19710
|
+
* Reverses the play direction of the Animation, this preserves the current frame
|
|
19711
|
+
*/
|
|
19712
|
+
reverse() {
|
|
19713
|
+
// Don't mutate with the original frame list, create a copy
|
|
19714
|
+
this.frames = this.frames.slice().reverse();
|
|
19715
|
+
this._reversed = !this._reversed;
|
|
19716
|
+
}
|
|
19717
|
+
/**
|
|
19718
|
+
* Returns the current play direction of the animation
|
|
19719
|
+
*/
|
|
19720
|
+
get direction() {
|
|
19721
|
+
// Keep logically consistent with ping-pong direction
|
|
19722
|
+
// If ping-pong is forward = 1 and reversed is true then we are logically reversed
|
|
19723
|
+
const reversed = (this._reversed && this._direction === 1) ? true : false;
|
|
19724
|
+
return reversed ? AnimationDirection.Backward : AnimationDirection.Forward;
|
|
19725
|
+
}
|
|
19726
|
+
/**
|
|
19727
|
+
* Plays or resumes the animation from the current frame
|
|
19728
|
+
*/
|
|
19681
19729
|
play() {
|
|
19682
19730
|
this._playing = true;
|
|
19683
19731
|
}
|
|
19732
|
+
/**
|
|
19733
|
+
* Pauses the animation on the current frame
|
|
19734
|
+
*/
|
|
19684
19735
|
pause() {
|
|
19685
19736
|
this._playing = false;
|
|
19686
|
-
this._firstTick = true;
|
|
19737
|
+
this._firstTick = true; // firstTick must be set to emit the proper frame event
|
|
19687
19738
|
}
|
|
19739
|
+
/**
|
|
19740
|
+
* Reset the animation back to the beginning, including if the animation were done
|
|
19741
|
+
*/
|
|
19688
19742
|
reset() {
|
|
19689
19743
|
this._done = false;
|
|
19690
19744
|
this._firstTick = true;
|
|
19691
19745
|
this._currentFrame = 0;
|
|
19692
19746
|
}
|
|
19747
|
+
/**
|
|
19748
|
+
* Returns `true` if the animation can end
|
|
19749
|
+
*/
|
|
19693
19750
|
get canFinish() {
|
|
19694
19751
|
switch (this.strategy) {
|
|
19695
19752
|
case AnimationStrategy.End:
|
|
@@ -19701,9 +19758,19 @@ class Animation extends Graphic {
|
|
|
19701
19758
|
}
|
|
19702
19759
|
}
|
|
19703
19760
|
}
|
|
19761
|
+
/**
|
|
19762
|
+
* Returns `true` if the animation is done, for looping type animations
|
|
19763
|
+
* `ex.AnimationStrategy.PingPong` and `ex.AnimationStrategy.Loop` this will always return `false`
|
|
19764
|
+
*
|
|
19765
|
+
* See the `ex.Animation.canFinish()` method to know if an animation type can end
|
|
19766
|
+
*/
|
|
19704
19767
|
get done() {
|
|
19705
19768
|
return this._done;
|
|
19706
19769
|
}
|
|
19770
|
+
/**
|
|
19771
|
+
* Jump the animation immediately to a specific frame if it exists
|
|
19772
|
+
* @param frameNumber
|
|
19773
|
+
*/
|
|
19707
19774
|
goToFrame(frameNumber) {
|
|
19708
19775
|
var _a, _b;
|
|
19709
19776
|
this._currentFrame = frameNumber;
|
|
@@ -19762,6 +19829,11 @@ class Animation extends Graphic {
|
|
|
19762
19829
|
}
|
|
19763
19830
|
return next;
|
|
19764
19831
|
}
|
|
19832
|
+
/**
|
|
19833
|
+
* Called internally by Excalibur to update the state of the animation potential update the current frame
|
|
19834
|
+
* @param elapsedMilliseconds Milliseconds elapsed
|
|
19835
|
+
* @param idempotencyToken Prevents double ticking in a frame by passing a unique token to the frame
|
|
19836
|
+
*/
|
|
19765
19837
|
tick(elapsedMilliseconds, idempotencyToken = 0) {
|
|
19766
19838
|
if (this._idempotencyToken === idempotencyToken) {
|
|
19767
19839
|
return;
|
|
@@ -28427,7 +28499,7 @@ Promises_Promise = Promise_1 = Promises_decorate([
|
|
|
28427
28499
|
* The current Excalibur version string
|
|
28428
28500
|
* @description `process.env.__EX_VERSION` gets replaced by Webpack on build
|
|
28429
28501
|
*/
|
|
28430
|
-
const EX_VERSION = "0.26.0-alpha.
|
|
28502
|
+
const EX_VERSION = "0.26.0-alpha.267+ad95c5d";
|
|
28431
28503
|
|
|
28432
28504
|
polyfill();
|
|
28433
28505
|
// This file is used as the bundle entry point and exports everything
|