@tawaship/pixi-animate-runtime 0.1.0 → 0.1.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/README.md +11 -1
- package/dist/generator.cjs.js +2 -2
- package/dist/pixi-animate-runtime.cjs.js +70 -6
- package/dist/pixi-animate-runtime.cjs.js.map +1 -1
- package/dist/pixi-animate-runtime.esm.js +70 -6
- package/dist/pixi-animate-runtime.esm.js.map +1 -1
- package/dist/pixi-animate-runtime.js +70 -6
- package/dist/pixi-animate-runtime.js.map +1 -1
- package/dist-skills/pixi-animate-runtime-guide/SKILL.md +2 -2
- package/package.json +1 -1
- package/types/player/animate-container.d.ts +4 -2
- package/types/player/content.d.ts +11 -0
- package/types/player/display.d.ts +6 -0
package/README.md
CHANGED
|
@@ -280,7 +280,8 @@ content's frames.
|
|
|
280
280
|
`lib.properties` (`width`, `height`, `fps`, `color` and so on; read-only)
|
|
281
281
|
- To use an image of the content elsewhere, create the symbol that shows it and take its Pixi node:
|
|
282
282
|
`content.create('Bitmap1').pixi.texture`
|
|
283
|
-
- `container.speed` changes the playback speed (`1` is the published frame rate, `0` stops
|
|
283
|
+
- `container.speed` changes the playback speed (`1` is the published frame rate, `0` stops; a value below `0`
|
|
284
|
+
stops it as `0` does, and it goes on from where it stopped once the speed is above `0` again). When the
|
|
284
285
|
display runs slower than the content, one call plays several frames; set `container.overSpeed = false`
|
|
285
286
|
to play at most one frame per call
|
|
286
287
|
- `container.smooth` (`true` by default) keeps the playing even when the time between frames of the display
|
|
@@ -441,6 +442,15 @@ Known faults are put into the player on purpose to confirm that the comparisons
|
|
|
441
442
|
|
|
442
443
|
## Change log
|
|
443
444
|
|
|
445
|
+
### 0.1.1
|
|
446
|
+
|
|
447
|
+
- A `speed` below `0` stops the playing as `0` does. It kept the playing stopped for a while after the speed was
|
|
448
|
+
set above `0` again (for as long as it had been below `0`)
|
|
449
|
+
- Right after a goto made outside the playing (from a pointer event, for example), PixiJS drew synched and single
|
|
450
|
+
frame clips at their old frame, and clips coming back on the display list at the frame they had when they left,
|
|
451
|
+
until the content played its next frame (up to a frame of the content: about 0.1 s at 10 fps). They now show
|
|
452
|
+
what CreateJS shows from the first draw after the goto
|
|
453
|
+
|
|
444
454
|
### 0.1.0
|
|
445
455
|
|
|
446
456
|
- First release: generates runtime content from content published by Adobe Animate for HTML5 Canvas (the command
|
package/dist/generator.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @tawaship/pixi-animate-runtime - v0.1.
|
|
2
|
+
* @tawaship/pixi-animate-runtime - v0.1.1
|
|
3
3
|
*
|
|
4
4
|
* @author tawaship (makazu.mori@gmail.com)
|
|
5
5
|
* @license MIT
|
|
@@ -190,7 +190,7 @@ function checkVersion(version, range, known) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
/** The version of this package (written in from package.json when the package is built) */
|
|
193
|
-
const VERSION = "0.1.
|
|
193
|
+
const VERSION = "0.1.1";
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* The animate-data-converter versions this generator reads definitions of:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @tawaship/pixi-animate-runtime - v0.1.
|
|
2
|
+
* @tawaship/pixi-animate-runtime - v0.1.1
|
|
3
3
|
*
|
|
4
4
|
* @author tawaship (makazu.mori@gmail.com)
|
|
5
5
|
* @license MIT
|
|
@@ -446,6 +446,12 @@ var DisplayObject = /*@__PURE__*/(function (EventDispatcher) {
|
|
|
446
446
|
this._maskHost = null;
|
|
447
447
|
/** The objects this object masks (while they are on a display list) */
|
|
448
448
|
this._maskTargets = [];
|
|
449
|
+
/**
|
|
450
|
+
* Set on a root when a timeline under it jumped outside the playing (a goto):
|
|
451
|
+
* its clips are to be settled before Pixi draws it (settleForDrawing), as a
|
|
452
|
+
* createjs draw would. The resolve phase of a frame clears it
|
|
453
|
+
*/
|
|
454
|
+
this._pendingResolve = false;
|
|
449
455
|
this.id = nextId++;
|
|
450
456
|
this.pixi = pixi;
|
|
451
457
|
pixi.owner = this;
|
|
@@ -1240,6 +1246,13 @@ var MovieClip = /*@__PURE__*/(function (Container) {
|
|
|
1240
1246
|
if (position != null) {
|
|
1241
1247
|
this._t = 0;
|
|
1242
1248
|
this._updateTimeline(position, true);
|
|
1249
|
+
// The clips it placed (synched ones, ones to start over) are settled by createjs when it
|
|
1250
|
+
// draws: the root is to be settled before Pixi draws it, if no frame is played before
|
|
1251
|
+
var root = this;
|
|
1252
|
+
while (root.parent) {
|
|
1253
|
+
root = root.parent;
|
|
1254
|
+
}
|
|
1255
|
+
root._pendingResolve = true;
|
|
1243
1256
|
}
|
|
1244
1257
|
};
|
|
1245
1258
|
MovieClip.prototype._reset = function _reset () {
|
|
@@ -2684,7 +2697,7 @@ function checkVersion(version, range, known) {
|
|
|
2684
2697
|
}
|
|
2685
2698
|
|
|
2686
2699
|
/** The version of this package (written in from package.json when the package is built) */
|
|
2687
|
-
var VERSION = "0.1.
|
|
2700
|
+
var VERSION = "0.1.1";
|
|
2688
2701
|
|
|
2689
2702
|
/**
|
|
2690
2703
|
* The eases of CreateJS (createjs.Ease), computed as CreateJS computes them,
|
|
@@ -3331,6 +3344,7 @@ function tick(root, event) {
|
|
|
3331
3344
|
* reverse order), without playing a frame.
|
|
3332
3345
|
*/
|
|
3333
3346
|
function resolveState(node) {
|
|
3347
|
+
node._pendingResolve = false;
|
|
3334
3348
|
if (node instanceof MovieClip) {
|
|
3335
3349
|
node._updateState();
|
|
3336
3350
|
}
|
|
@@ -3343,6 +3357,34 @@ function resolveState(node) {
|
|
|
3343
3357
|
}
|
|
3344
3358
|
}
|
|
3345
3359
|
}
|
|
3360
|
+
/**
|
|
3361
|
+
* Settles a display tree for drawing without playing it on, as a createjs
|
|
3362
|
+
* stage draw shows it (MovieClip.draw settles each clip): the synched and
|
|
3363
|
+
* single frame clips are placed at the frame their parent gives, and a clip
|
|
3364
|
+
* waiting to start over (an independent clip reset when its parent placed it
|
|
3365
|
+
* again) is shown at its first frame the way a new clip is (no frame script,
|
|
3366
|
+
* its playhead left to start on the next frame, as in the template, where
|
|
3367
|
+
* createjs draws only after a frame). Children after their parent, in reverse
|
|
3368
|
+
* order as the resolve phase.
|
|
3369
|
+
*/
|
|
3370
|
+
function settleForDrawing(node) {
|
|
3371
|
+
if (node instanceof MovieClip) {
|
|
3372
|
+
if (node.mode !== INDEPENDENT) {
|
|
3373
|
+
node._updateState();
|
|
3374
|
+
}
|
|
3375
|
+
else if (node._rawPosition === -1) {
|
|
3376
|
+
node._renderFirstFrame();
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
if (node instanceof Container) {
|
|
3380
|
+
var children = node.children.slice();
|
|
3381
|
+
for (var i = children.length - 1; i >= 0; i--) {
|
|
3382
|
+
if (children[i] instanceof MovieClip) {
|
|
3383
|
+
settleForDrawing(children[i]);
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3346
3388
|
|
|
3347
3389
|
/** The frame rate a root plays at when its content does not give one */
|
|
3348
3390
|
var DEFAULT_FPS = 60;
|
|
@@ -3368,7 +3410,7 @@ var PULL = 0.05;
|
|
|
3368
3410
|
* on only settles it on its first frame.
|
|
3369
3411
|
*/
|
|
3370
3412
|
var AnimateController = function AnimateController(container) {
|
|
3371
|
-
/** Playback speed (1 is the content's own frame rate) */
|
|
3413
|
+
/** Playback speed (1 is the content's own frame rate, 0 stops; a value below 0 is taken as 0) */
|
|
3372
3414
|
this.speed = 1;
|
|
3373
3415
|
/** Whether one call may play more than one frame (when the display runs slower than the content) */
|
|
3374
3416
|
this.overSpeed = true;
|
|
@@ -3380,12 +3422,34 @@ var AnimateController = function AnimateController(container) {
|
|
|
3380
3422
|
this._deltas = [];
|
|
3381
3423
|
this._nextDelta = 0;
|
|
3382
3424
|
this._container = container;
|
|
3425
|
+
// Pixi updates the transforms of the tree before every draw: the roots a goto changed outside
|
|
3426
|
+
// the playing are settled then, as a createjs draw settles them (frames played meanwhile settle them first)
|
|
3427
|
+
var updateTransform = container.updateTransform;
|
|
3428
|
+
var controller = this;
|
|
3429
|
+
container.updateTransform = function () {
|
|
3430
|
+
controller._settleForDrawing();
|
|
3431
|
+
updateTransform.call(this);
|
|
3432
|
+
};
|
|
3433
|
+
};
|
|
3434
|
+
/** Settles the roots marked by a goto since they were last resolved */
|
|
3435
|
+
AnimateController.prototype._settleForDrawing = function _settleForDrawing () {
|
|
3436
|
+
var targets = this._targets;
|
|
3437
|
+
Object.keys(targets).forEach(function (key) {
|
|
3438
|
+
var target = targets[Number(key)];
|
|
3439
|
+
if (target && target.root._pendingResolve) {
|
|
3440
|
+
target.root._pendingResolve = false;
|
|
3441
|
+
settleForDrawing(target.root);
|
|
3442
|
+
}
|
|
3443
|
+
});
|
|
3383
3444
|
};
|
|
3384
3445
|
AnimateController.prototype.handleTick = function handleTick (delta) {
|
|
3385
3446
|
var this$1$1 = this;
|
|
3386
3447
|
|
|
3387
|
-
|
|
3388
|
-
|
|
3448
|
+
// A speed below 0 plays as 0 does (nothing is played backward): the frames owed stay where they
|
|
3449
|
+
// were, and the playing goes on from there once the speed is above 0 again
|
|
3450
|
+
var speed = Math.max(this.speed, 0);
|
|
3451
|
+
var d = delta * speed;
|
|
3452
|
+
var usual = this._usualDelta(delta) * speed;
|
|
3389
3453
|
var targets = this._targets;
|
|
3390
3454
|
Object.keys(targets).forEach(function (key) {
|
|
3391
3455
|
var target = targets[Number(key)];
|
|
@@ -3491,7 +3555,7 @@ var AnimateContainer = /*@__PURE__*/(function (superclass) {
|
|
|
3491
3555
|
AnimateContainer.prototype.constructor = AnimateContainer;
|
|
3492
3556
|
|
|
3493
3557
|
var prototypeAccessors = { speed: { configurable: true },overSpeed: { configurable: true },smooth: { configurable: true } };
|
|
3494
|
-
/** Playback speed (1 is the content's own frame rate) */
|
|
3558
|
+
/** Playback speed (1 is the content's own frame rate, 0 stops; a value below 0 is taken as 0) */
|
|
3495
3559
|
prototypeAccessors.speed.get = function () { return this._controller.speed; };
|
|
3496
3560
|
prototypeAccessors.speed.set = function (value) { this._controller.speed = value; };
|
|
3497
3561
|
/** Whether one call may play more than one frame (when the display runs slower than the content) */
|