@rive-app/webgl-single 1.0.66 → 1.0.67
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/package.json +1 -1
- package/rive.js +32 -8
- package/rive.js.map +1 -1
package/package.json
CHANGED
package/rive.js
CHANGED
|
@@ -176,7 +176,7 @@ k.run=xd;if(k.preInit)for("function"==typeof k.preInit&&(k.preInit=[k.preInit]);
|
|
|
176
176
|
/* 2 */
|
|
177
177
|
/***/ ((module) => {
|
|
178
178
|
|
|
179
|
-
module.exports = JSON.parse('{"name":"@rive-app/webgl-single","version":"1.0.
|
|
179
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl-single","version":"1.0.67","description":"Rive\'s webgl based web api with bundled wasm.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
180
180
|
|
|
181
181
|
/***/ }),
|
|
182
182
|
/* 3 */
|
|
@@ -612,6 +612,16 @@ var Animation = /** @class */ (function () {
|
|
|
612
612
|
this.scrubTo = null;
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
+
/**
|
|
616
|
+
* Apply interpolated keyframe values to the artboard. This should be called after calling
|
|
617
|
+
* .advance() on an animation instance so that new values are applied to properties.
|
|
618
|
+
*
|
|
619
|
+
* Note: This does not advance the artboard, which updates all objects on the artboard
|
|
620
|
+
* @param mix - Mix value for the animation from 0 to 1
|
|
621
|
+
*/
|
|
622
|
+
Animation.prototype.apply = function (mix) {
|
|
623
|
+
this.instance.apply(mix);
|
|
624
|
+
};
|
|
615
625
|
Object.defineProperty(Animation.prototype, "needsScrub", {
|
|
616
626
|
get: function () {
|
|
617
627
|
return this.scrubTo !== null;
|
|
@@ -719,6 +729,13 @@ var StateMachine = /** @class */ (function () {
|
|
|
719
729
|
enumerable: false,
|
|
720
730
|
configurable: true
|
|
721
731
|
});
|
|
732
|
+
/**
|
|
733
|
+
* Advances the state machine instance by a given time.
|
|
734
|
+
* @param time - the time to advance the animation by in seconds
|
|
735
|
+
*/
|
|
736
|
+
StateMachine.prototype.advance = function (time) {
|
|
737
|
+
this.instance.advance(time);
|
|
738
|
+
};
|
|
722
739
|
/**
|
|
723
740
|
* Fetches references to the state machine's inputs and caches them
|
|
724
741
|
* @param runtime an instance of the runtime; needed for the SMIInput types
|
|
@@ -813,13 +830,18 @@ var Animator = /** @class */ (function () {
|
|
|
813
830
|
// Try to create a new animation instance
|
|
814
831
|
var anim = this.artboard.animationByName(animatables[i]);
|
|
815
832
|
if (anim) {
|
|
816
|
-
|
|
833
|
+
var newAnimation = new Animation(anim, this.artboard, this.runtime, playing);
|
|
834
|
+
// Display the first frame of the specified animation
|
|
835
|
+
newAnimation.advance(0);
|
|
836
|
+
newAnimation.apply(1.0);
|
|
837
|
+
this.animations.push(newAnimation);
|
|
817
838
|
}
|
|
818
839
|
else {
|
|
819
840
|
// Try to create a new state machine instance
|
|
820
841
|
var sm = this.artboard.stateMachineByName(animatables[i]);
|
|
821
842
|
if (sm) {
|
|
822
|
-
|
|
843
|
+
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard);
|
|
844
|
+
this.stateMachines.push(newStateMachine);
|
|
823
845
|
}
|
|
824
846
|
}
|
|
825
847
|
}
|
|
@@ -1388,8 +1410,9 @@ var Rive = /** @class */ (function () {
|
|
|
1388
1410
|
// Calculate the elapsed time between frames in seconds
|
|
1389
1411
|
var elapsedTime = (time - this.lastRenderTime) / 1000;
|
|
1390
1412
|
this.lastRenderTime = time;
|
|
1391
|
-
// Advance non-paused animations by the elapsed number of seconds
|
|
1392
|
-
//
|
|
1413
|
+
// - Advance non-paused animations by the elapsed number of seconds
|
|
1414
|
+
// - Advance any animations that require scrubbing
|
|
1415
|
+
// - Advance to the first frame even when autoplay is false
|
|
1393
1416
|
var activeAnimations = this.animator.animations.filter(function (a) { return a.playing || a.needsScrub; })
|
|
1394
1417
|
// The scrubbed animations must be applied first to prevent weird artifacts
|
|
1395
1418
|
// if the playing animations conflict with the scrubbed animating attribuates.
|
|
@@ -1400,13 +1423,14 @@ var Rive = /** @class */ (function () {
|
|
|
1400
1423
|
if (animation.instance.didLoop) {
|
|
1401
1424
|
animation.loopCount += 1;
|
|
1402
1425
|
}
|
|
1403
|
-
animation.
|
|
1426
|
+
animation.apply(1.0);
|
|
1404
1427
|
}
|
|
1405
|
-
// Advance non-paused state machines by the elapsed number of seconds
|
|
1428
|
+
// - Advance non-paused state machines by the elapsed number of seconds
|
|
1429
|
+
// - Advance to the first frame even when autoplay is false
|
|
1406
1430
|
var activeStateMachines = this.animator.stateMachines.filter(function (a) { return a.playing; });
|
|
1407
1431
|
for (var _a = 0, activeStateMachines_1 = activeStateMachines; _a < activeStateMachines_1.length; _a++) {
|
|
1408
1432
|
var stateMachine = activeStateMachines_1[_a];
|
|
1409
|
-
stateMachine.
|
|
1433
|
+
stateMachine.advance(elapsedTime);
|
|
1410
1434
|
// stateMachine.instance.apply(this.artboard);
|
|
1411
1435
|
}
|
|
1412
1436
|
// Once the animations have been applied to the artboard, advance it
|