@rive-app/webgl 2.17.3 → 2.19.0
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 +155 -108
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_fallback.wasm +0 -0
package/package.json
CHANGED
package/rive.js
CHANGED
|
@@ -400,7 +400,7 @@ function Qa(a, b) {
|
|
|
400
400
|
return Pa(c, a, b);
|
|
401
401
|
}));
|
|
402
402
|
}
|
|
403
|
-
var Ra, Sa, Wa = {
|
|
403
|
+
var Ra, Sa, Wa = {688572:(a, b, c, d, e) => {
|
|
404
404
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
405
405
|
return 0;
|
|
406
406
|
}
|
|
@@ -463,9 +463,9 @@ var Ra, Sa, Wa = {685548:(a, b, c, d, e) => {
|
|
|
463
463
|
}
|
|
464
464
|
window.h.Ea += 1;
|
|
465
465
|
return 1;
|
|
466
|
-
},
|
|
466
|
+
}, 690750:() => {
|
|
467
467
|
"undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
|
|
468
|
-
},
|
|
468
|
+
}, 690914:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 691018:() => {
|
|
469
469
|
try {
|
|
470
470
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
471
471
|
a.close();
|
|
@@ -473,7 +473,7 @@ var Ra, Sa, Wa = {685548:(a, b, c, d, e) => {
|
|
|
473
473
|
} catch (c) {
|
|
474
474
|
return 0;
|
|
475
475
|
}
|
|
476
|
-
},
|
|
476
|
+
}, 691189:(a, b, c, d, e, f) => {
|
|
477
477
|
if ("undefined" === typeof window.h) {
|
|
478
478
|
return -1;
|
|
479
479
|
}
|
|
@@ -519,7 +519,7 @@ var Ra, Sa, Wa = {685548:(a, b, c, d, e) => {
|
|
|
519
519
|
a == window.h.H.Ca && g.X.connect(g.I.destination);
|
|
520
520
|
g.lb = f;
|
|
521
521
|
return window.h.nc(g);
|
|
522
|
-
},
|
|
522
|
+
}, 694066:a => window.h.ta(a).I.sampleRate, 694139:a => {
|
|
523
523
|
a = window.h.ta(a);
|
|
524
524
|
void 0 !== a.X && (a.X.onaudioprocess = function() {
|
|
525
525
|
}, a.X.disconnect(), a.X = void 0);
|
|
@@ -527,13 +527,13 @@ var Ra, Sa, Wa = {685548:(a, b, c, d, e) => {
|
|
|
527
527
|
a.I.close();
|
|
528
528
|
a.I = void 0;
|
|
529
529
|
a.lb = void 0;
|
|
530
|
-
},
|
|
530
|
+
}, 694539:a => {
|
|
531
531
|
window.h.xb(a);
|
|
532
|
-
},
|
|
532
|
+
}, 694589:a => {
|
|
533
533
|
a = window.h.ta(a);
|
|
534
534
|
a.I.resume();
|
|
535
535
|
a.state = window.h.ha.sb;
|
|
536
|
-
},
|
|
536
|
+
}, 694728:a => {
|
|
537
537
|
a = window.h.ta(a);
|
|
538
538
|
a.I.suspend();
|
|
539
539
|
a.state = window.h.ha.stopped;
|
|
@@ -4053,26 +4053,160 @@ Ie();
|
|
|
4053
4053
|
/* 2 */
|
|
4054
4054
|
/***/ ((module) => {
|
|
4055
4055
|
|
|
4056
|
-
module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.
|
|
4056
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.19.0","description":"Rive\'s webgl based web api.","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.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
4057
4057
|
|
|
4058
4058
|
/***/ }),
|
|
4059
4059
|
/* 3 */
|
|
4060
4060
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4061
4061
|
|
|
4062
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4063
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4064
|
+
/* harmony export */ Animation: () => (/* reexport safe */ _Animation__WEBPACK_IMPORTED_MODULE_0__.Animation)
|
|
4065
|
+
/* harmony export */ });
|
|
4066
|
+
/* harmony import */ var _Animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
4067
|
+
|
|
4068
|
+
|
|
4069
|
+
|
|
4070
|
+
/***/ }),
|
|
4071
|
+
/* 4 */
|
|
4072
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4073
|
+
|
|
4074
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4075
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4076
|
+
/* harmony export */ Animation: () => (/* binding */ Animation)
|
|
4077
|
+
/* harmony export */ });
|
|
4078
|
+
/**
|
|
4079
|
+
* Represents an animation that can be played on an Artboard.
|
|
4080
|
+
* Wraps animations and instances from the runtime and keeps track of playback state.
|
|
4081
|
+
*
|
|
4082
|
+
* The `Animation` class manages the state and behavior of a single animation instance,
|
|
4083
|
+
* including its current time, loop count, and ability to scrub to a specific time.
|
|
4084
|
+
*
|
|
4085
|
+
* The class provides methods to advance the animation, apply its interpolated keyframe
|
|
4086
|
+
* values to the Artboard, and clean up the underlying animation instance when the
|
|
4087
|
+
* animation is no longer needed.
|
|
4088
|
+
*/
|
|
4089
|
+
var Animation = /** @class */ (function () {
|
|
4090
|
+
/**
|
|
4091
|
+
* Constructs a new animation
|
|
4092
|
+
* @constructor
|
|
4093
|
+
* @param {any} animation: runtime animation object
|
|
4094
|
+
* @param {any} instance: runtime animation instance object
|
|
4095
|
+
*/
|
|
4096
|
+
function Animation(animation, artboard, runtime, playing) {
|
|
4097
|
+
this.animation = animation;
|
|
4098
|
+
this.artboard = artboard;
|
|
4099
|
+
this.playing = playing;
|
|
4100
|
+
this.loopCount = 0;
|
|
4101
|
+
/**
|
|
4102
|
+
* The time to which the animation should move to on the next render.
|
|
4103
|
+
* If not null, the animation will scrub to this time instead of advancing by the given time.
|
|
4104
|
+
*/
|
|
4105
|
+
this.scrubTo = null;
|
|
4106
|
+
this.instance = new runtime.LinearAnimationInstance(animation, artboard);
|
|
4107
|
+
}
|
|
4108
|
+
Object.defineProperty(Animation.prototype, "name", {
|
|
4109
|
+
/**
|
|
4110
|
+
* Returns the animation's name
|
|
4111
|
+
*/
|
|
4112
|
+
get: function () {
|
|
4113
|
+
return this.animation.name;
|
|
4114
|
+
},
|
|
4115
|
+
enumerable: false,
|
|
4116
|
+
configurable: true
|
|
4117
|
+
});
|
|
4118
|
+
Object.defineProperty(Animation.prototype, "time", {
|
|
4119
|
+
/**
|
|
4120
|
+
* Returns the animation's name
|
|
4121
|
+
*/
|
|
4122
|
+
get: function () {
|
|
4123
|
+
return this.instance.time;
|
|
4124
|
+
},
|
|
4125
|
+
/**
|
|
4126
|
+
* Sets the animation's current time
|
|
4127
|
+
*/
|
|
4128
|
+
set: function (value) {
|
|
4129
|
+
this.instance.time = value;
|
|
4130
|
+
},
|
|
4131
|
+
enumerable: false,
|
|
4132
|
+
configurable: true
|
|
4133
|
+
});
|
|
4134
|
+
Object.defineProperty(Animation.prototype, "loopValue", {
|
|
4135
|
+
/**
|
|
4136
|
+
* Returns the animation's loop type
|
|
4137
|
+
*/
|
|
4138
|
+
get: function () {
|
|
4139
|
+
return this.animation.loopValue;
|
|
4140
|
+
},
|
|
4141
|
+
enumerable: false,
|
|
4142
|
+
configurable: true
|
|
4143
|
+
});
|
|
4144
|
+
Object.defineProperty(Animation.prototype, "needsScrub", {
|
|
4145
|
+
/**
|
|
4146
|
+
* Indicates whether the animation needs to be scrubbed.
|
|
4147
|
+
* @returns `true` if the animation needs to be scrubbed, `false` otherwise.
|
|
4148
|
+
*/
|
|
4149
|
+
get: function () {
|
|
4150
|
+
return this.scrubTo !== null;
|
|
4151
|
+
},
|
|
4152
|
+
enumerable: false,
|
|
4153
|
+
configurable: true
|
|
4154
|
+
});
|
|
4155
|
+
/**
|
|
4156
|
+
* Advances the animation by the give time. If the animation needs scrubbing,
|
|
4157
|
+
* time is ignored and the stored scrub value is used.
|
|
4158
|
+
* @param time the time to advance the animation by if no scrubbing required
|
|
4159
|
+
*/
|
|
4160
|
+
Animation.prototype.advance = function (time) {
|
|
4161
|
+
if (this.scrubTo === null) {
|
|
4162
|
+
this.instance.advance(time);
|
|
4163
|
+
}
|
|
4164
|
+
else {
|
|
4165
|
+
this.instance.time = 0;
|
|
4166
|
+
this.instance.advance(this.scrubTo);
|
|
4167
|
+
this.scrubTo = null;
|
|
4168
|
+
}
|
|
4169
|
+
};
|
|
4170
|
+
/**
|
|
4171
|
+
* Apply interpolated keyframe values to the artboard. This should be called after calling
|
|
4172
|
+
* .advance() on an animation instance so that new values are applied to properties.
|
|
4173
|
+
*
|
|
4174
|
+
* Note: This does not advance the artboard, which updates all objects on the artboard
|
|
4175
|
+
* @param mix - Mix value for the animation from 0 to 1
|
|
4176
|
+
*/
|
|
4177
|
+
Animation.prototype.apply = function (mix) {
|
|
4178
|
+
this.instance.apply(mix);
|
|
4179
|
+
};
|
|
4180
|
+
/**
|
|
4181
|
+
* Deletes the backing Wasm animation instance; once this is called, this
|
|
4182
|
+
* animation is no more.
|
|
4183
|
+
*/
|
|
4184
|
+
Animation.prototype.cleanup = function () {
|
|
4185
|
+
this.instance.delete();
|
|
4186
|
+
};
|
|
4187
|
+
return Animation;
|
|
4188
|
+
}());
|
|
4189
|
+
|
|
4190
|
+
|
|
4191
|
+
|
|
4192
|
+
/***/ }),
|
|
4193
|
+
/* 5 */
|
|
4194
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4195
|
+
|
|
4062
4196
|
__webpack_require__.r(__webpack_exports__);
|
|
4063
4197
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4064
4198
|
/* harmony export */ BLANK_URL: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__.BLANK_URL),
|
|
4065
4199
|
/* harmony export */ registerTouchInteractions: () => (/* reexport safe */ _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__.registerTouchInteractions),
|
|
4066
4200
|
/* harmony export */ sanitizeUrl: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__.sanitizeUrl)
|
|
4067
4201
|
/* harmony export */ });
|
|
4068
|
-
/* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
4069
|
-
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
4202
|
+
/* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
|
|
4203
|
+
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
|
|
4070
4204
|
|
|
4071
4205
|
|
|
4072
4206
|
|
|
4073
4207
|
|
|
4074
4208
|
/***/ }),
|
|
4075
|
-
/*
|
|
4209
|
+
/* 6 */
|
|
4076
4210
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4077
4211
|
|
|
4078
4212
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -4226,7 +4360,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
4226
4360
|
|
|
4227
4361
|
|
|
4228
4362
|
/***/ }),
|
|
4229
|
-
/*
|
|
4363
|
+
/* 7 */
|
|
4230
4364
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4231
4365
|
|
|
4232
4366
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -4358,7 +4492,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4358
4492
|
/* harmony export */ });
|
|
4359
4493
|
/* harmony import */ var _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
4360
4494
|
/* harmony import */ var package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
4361
|
-
/* harmony import */ var
|
|
4495
|
+
/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
|
4496
|
+
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5);
|
|
4362
4497
|
var __extends = (undefined && undefined.__extends) || (function () {
|
|
4363
4498
|
var extendStatics = function (d, b) {
|
|
4364
4499
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -4413,6 +4548,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
4413
4548
|
|
|
4414
4549
|
|
|
4415
4550
|
|
|
4551
|
+
|
|
4416
4552
|
// #region layout
|
|
4417
4553
|
// Fit options for the canvas
|
|
4418
4554
|
var Fit;
|
|
@@ -4591,95 +4727,6 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
4591
4727
|
return RuntimeLoader;
|
|
4592
4728
|
}());
|
|
4593
4729
|
|
|
4594
|
-
// #endregion
|
|
4595
|
-
// #region animations
|
|
4596
|
-
// Wraps animations and instances from the runtime and keeps track of playback
|
|
4597
|
-
// state
|
|
4598
|
-
var Animation = /** @class */ (function () {
|
|
4599
|
-
/**
|
|
4600
|
-
* Constructs a new animation
|
|
4601
|
-
* @constructor
|
|
4602
|
-
* @param {any} animation: runtime animation object
|
|
4603
|
-
* @param {any} instance: runtime animation instance object
|
|
4604
|
-
*/
|
|
4605
|
-
function Animation(animation, artboard, runtime, playing) {
|
|
4606
|
-
this.animation = animation;
|
|
4607
|
-
this.artboard = artboard;
|
|
4608
|
-
this.playing = playing;
|
|
4609
|
-
this.loopCount = 0;
|
|
4610
|
-
// Time to which the animation should move to on the next render
|
|
4611
|
-
this.scrubTo = null;
|
|
4612
|
-
this.instance = new runtime.LinearAnimationInstance(animation, artboard);
|
|
4613
|
-
}
|
|
4614
|
-
Object.defineProperty(Animation.prototype, "name", {
|
|
4615
|
-
// Returns the animation's name
|
|
4616
|
-
get: function () {
|
|
4617
|
-
return this.animation.name;
|
|
4618
|
-
},
|
|
4619
|
-
enumerable: false,
|
|
4620
|
-
configurable: true
|
|
4621
|
-
});
|
|
4622
|
-
Object.defineProperty(Animation.prototype, "time", {
|
|
4623
|
-
// Returns the animation's current time
|
|
4624
|
-
get: function () {
|
|
4625
|
-
return this.instance.time;
|
|
4626
|
-
},
|
|
4627
|
-
// Sets the animation's current time
|
|
4628
|
-
set: function (value) {
|
|
4629
|
-
this.instance.time = value;
|
|
4630
|
-
},
|
|
4631
|
-
enumerable: false,
|
|
4632
|
-
configurable: true
|
|
4633
|
-
});
|
|
4634
|
-
Object.defineProperty(Animation.prototype, "loopValue", {
|
|
4635
|
-
// Returns the animation's loop type
|
|
4636
|
-
get: function () {
|
|
4637
|
-
return this.animation.loopValue;
|
|
4638
|
-
},
|
|
4639
|
-
enumerable: false,
|
|
4640
|
-
configurable: true
|
|
4641
|
-
});
|
|
4642
|
-
/**
|
|
4643
|
-
* Advances the animation by the give time. If the animation needs scrubbing,
|
|
4644
|
-
* time is ignored and the stored scrub value is used.
|
|
4645
|
-
* @param time the time to advance the animation by if no scrubbing required
|
|
4646
|
-
*/
|
|
4647
|
-
Animation.prototype.advance = function (time) {
|
|
4648
|
-
if (this.scrubTo === null) {
|
|
4649
|
-
this.instance.advance(time);
|
|
4650
|
-
}
|
|
4651
|
-
else {
|
|
4652
|
-
this.instance.time = 0;
|
|
4653
|
-
this.instance.advance(this.scrubTo);
|
|
4654
|
-
this.scrubTo = null;
|
|
4655
|
-
}
|
|
4656
|
-
};
|
|
4657
|
-
/**
|
|
4658
|
-
* Apply interpolated keyframe values to the artboard. This should be called after calling
|
|
4659
|
-
* .advance() on an animation instance so that new values are applied to properties.
|
|
4660
|
-
*
|
|
4661
|
-
* Note: This does not advance the artboard, which updates all objects on the artboard
|
|
4662
|
-
* @param mix - Mix value for the animation from 0 to 1
|
|
4663
|
-
*/
|
|
4664
|
-
Animation.prototype.apply = function (mix) {
|
|
4665
|
-
this.instance.apply(mix);
|
|
4666
|
-
};
|
|
4667
|
-
Object.defineProperty(Animation.prototype, "needsScrub", {
|
|
4668
|
-
get: function () {
|
|
4669
|
-
return this.scrubTo !== null;
|
|
4670
|
-
},
|
|
4671
|
-
enumerable: false,
|
|
4672
|
-
configurable: true
|
|
4673
|
-
});
|
|
4674
|
-
/**
|
|
4675
|
-
* Deletes the backing Wasm animation instance; once this is called, this
|
|
4676
|
-
* animation is no more.
|
|
4677
|
-
*/
|
|
4678
|
-
Animation.prototype.cleanup = function () {
|
|
4679
|
-
this.instance.delete();
|
|
4680
|
-
};
|
|
4681
|
-
return Animation;
|
|
4682
|
-
}());
|
|
4683
4730
|
// #endregion
|
|
4684
4731
|
// #region state machines
|
|
4685
4732
|
var StateMachineInputType;
|
|
@@ -4894,7 +4941,7 @@ var Animator = /** @class */ (function () {
|
|
|
4894
4941
|
// Try to create a new animation instance
|
|
4895
4942
|
var anim = this.artboard.animationByName(animatables[i]);
|
|
4896
4943
|
if (anim) {
|
|
4897
|
-
var newAnimation = new Animation(anim, this.artboard, this.runtime, playing);
|
|
4944
|
+
var newAnimation = new _animation__WEBPACK_IMPORTED_MODULE_2__.Animation(anim, this.artboard, this.runtime, playing);
|
|
4898
4945
|
// Display the first frame of the specified animation
|
|
4899
4946
|
newAnimation.advance(0);
|
|
4900
4947
|
newAnimation.apply(1.0);
|
|
@@ -4948,7 +4995,7 @@ var Animator = /** @class */ (function () {
|
|
|
4948
4995
|
// Try to create a new animation instance
|
|
4949
4996
|
var anim = this.artboard.animationByName(animatables[i]);
|
|
4950
4997
|
if (anim) {
|
|
4951
|
-
var newAnimation = new Animation(anim, this.artboard, this.runtime, playing);
|
|
4998
|
+
var newAnimation = new _animation__WEBPACK_IMPORTED_MODULE_2__.Animation(anim, this.artboard, this.runtime, playing);
|
|
4952
4999
|
// Display the first frame of the specified animation
|
|
4953
5000
|
newAnimation.advance(0);
|
|
4954
5001
|
newAnimation.apply(1.0);
|
|
@@ -5845,7 +5892,7 @@ var Rive = /** @class */ (function () {
|
|
|
5845
5892
|
"isTouchScrollEnabled" in riveListenerOptions) {
|
|
5846
5893
|
touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
|
|
5847
5894
|
}
|
|
5848
|
-
this.eventCleanup = (0,
|
|
5895
|
+
this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.registerTouchInteractions)({
|
|
5849
5896
|
canvas: this.canvas,
|
|
5850
5897
|
artboard: this.artboard,
|
|
5851
5898
|
stateMachines: activeStateMachines,
|
|
@@ -6040,10 +6087,10 @@ var Rive = /** @class */ (function () {
|
|
|
6040
6087
|
if (this.automaticallyHandleEvents) {
|
|
6041
6088
|
var newAnchorTag = document.createElement("a");
|
|
6042
6089
|
var _b = event_1, url = _b.url, target = _b.target;
|
|
6043
|
-
var sanitizedUrl = (0,
|
|
6090
|
+
var sanitizedUrl = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.sanitizeUrl)(url);
|
|
6044
6091
|
url && newAnchorTag.setAttribute("href", sanitizedUrl);
|
|
6045
6092
|
target && newAnchorTag.setAttribute("target", target);
|
|
6046
|
-
if (sanitizedUrl && sanitizedUrl !==
|
|
6093
|
+
if (sanitizedUrl && sanitizedUrl !== _utils__WEBPACK_IMPORTED_MODULE_3__.BLANK_URL) {
|
|
6047
6094
|
newAnchorTag.click();
|
|
6048
6095
|
}
|
|
6049
6096
|
}
|