@rive-app/canvas 2.18.0 → 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
|
@@ -736,7 +736,7 @@ function Ya(a, b) {
|
|
|
736
736
|
return Xa(c, a, b);
|
|
737
737
|
}));
|
|
738
738
|
}
|
|
739
|
-
var Za, $a, db = {
|
|
739
|
+
var Za, $a, db = {433500:(a, b, c, d, e) => {
|
|
740
740
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
741
741
|
return 0;
|
|
742
742
|
}
|
|
@@ -799,9 +799,9 @@ var Za, $a, db = {431580:(a, b, c, d, e) => {
|
|
|
799
799
|
}
|
|
800
800
|
window.h.Aa += 1;
|
|
801
801
|
return 1;
|
|
802
|
-
},
|
|
802
|
+
}, 435678:() => {
|
|
803
803
|
"undefined" !== typeof window.h && (--window.h.Aa, 0 === window.h.Aa && delete window.h);
|
|
804
|
-
},
|
|
804
|
+
}, 435842:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 435946:() => {
|
|
805
805
|
try {
|
|
806
806
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
807
807
|
a.close();
|
|
@@ -809,7 +809,7 @@ var Za, $a, db = {431580:(a, b, c, d, e) => {
|
|
|
809
809
|
} catch (c) {
|
|
810
810
|
return 0;
|
|
811
811
|
}
|
|
812
|
-
},
|
|
812
|
+
}, 436117:(a, b, c, d, e, f) => {
|
|
813
813
|
if ("undefined" === typeof window.h) {
|
|
814
814
|
return -1;
|
|
815
815
|
}
|
|
@@ -855,7 +855,7 @@ var Za, $a, db = {431580:(a, b, c, d, e) => {
|
|
|
855
855
|
a == window.h.H.ya && g.Z.connect(g.I.destination);
|
|
856
856
|
g.pb = f;
|
|
857
857
|
return window.h.yc(g);
|
|
858
|
-
},
|
|
858
|
+
}, 438994:a => window.h.ra(a).I.sampleRate, 439067:a => {
|
|
859
859
|
a = window.h.ra(a);
|
|
860
860
|
void 0 !== a.Z && (a.Z.onaudioprocess = function() {
|
|
861
861
|
}, a.Z.disconnect(), a.Z = void 0);
|
|
@@ -863,13 +863,13 @@ var Za, $a, db = {431580:(a, b, c, d, e) => {
|
|
|
863
863
|
a.I.close();
|
|
864
864
|
a.I = void 0;
|
|
865
865
|
a.pb = void 0;
|
|
866
|
-
},
|
|
866
|
+
}, 439467:a => {
|
|
867
867
|
window.h.Cb(a);
|
|
868
|
-
},
|
|
868
|
+
}, 439517:a => {
|
|
869
869
|
a = window.h.ra(a);
|
|
870
870
|
a.I.resume();
|
|
871
871
|
a.state = window.h.ga.xb;
|
|
872
|
-
},
|
|
872
|
+
}, 439656:a => {
|
|
873
873
|
a = window.h.ra(a);
|
|
874
874
|
a.I.suspend();
|
|
875
875
|
a.state = window.h.ga.stopped;
|
|
@@ -3355,26 +3355,160 @@ Zd();
|
|
|
3355
3355
|
/* 2 */
|
|
3356
3356
|
/***/ ((module) => {
|
|
3357
3357
|
|
|
3358
|
-
module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.
|
|
3358
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.19.0","description":"Rive\'s canvas 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.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
3359
3359
|
|
|
3360
3360
|
/***/ }),
|
|
3361
3361
|
/* 3 */
|
|
3362
3362
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3363
3363
|
|
|
3364
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3365
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3366
|
+
/* harmony export */ Animation: () => (/* reexport safe */ _Animation__WEBPACK_IMPORTED_MODULE_0__.Animation)
|
|
3367
|
+
/* harmony export */ });
|
|
3368
|
+
/* harmony import */ var _Animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
3369
|
+
|
|
3370
|
+
|
|
3371
|
+
|
|
3372
|
+
/***/ }),
|
|
3373
|
+
/* 4 */
|
|
3374
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3375
|
+
|
|
3376
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3377
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3378
|
+
/* harmony export */ Animation: () => (/* binding */ Animation)
|
|
3379
|
+
/* harmony export */ });
|
|
3380
|
+
/**
|
|
3381
|
+
* Represents an animation that can be played on an Artboard.
|
|
3382
|
+
* Wraps animations and instances from the runtime and keeps track of playback state.
|
|
3383
|
+
*
|
|
3384
|
+
* The `Animation` class manages the state and behavior of a single animation instance,
|
|
3385
|
+
* including its current time, loop count, and ability to scrub to a specific time.
|
|
3386
|
+
*
|
|
3387
|
+
* The class provides methods to advance the animation, apply its interpolated keyframe
|
|
3388
|
+
* values to the Artboard, and clean up the underlying animation instance when the
|
|
3389
|
+
* animation is no longer needed.
|
|
3390
|
+
*/
|
|
3391
|
+
var Animation = /** @class */ (function () {
|
|
3392
|
+
/**
|
|
3393
|
+
* Constructs a new animation
|
|
3394
|
+
* @constructor
|
|
3395
|
+
* @param {any} animation: runtime animation object
|
|
3396
|
+
* @param {any} instance: runtime animation instance object
|
|
3397
|
+
*/
|
|
3398
|
+
function Animation(animation, artboard, runtime, playing) {
|
|
3399
|
+
this.animation = animation;
|
|
3400
|
+
this.artboard = artboard;
|
|
3401
|
+
this.playing = playing;
|
|
3402
|
+
this.loopCount = 0;
|
|
3403
|
+
/**
|
|
3404
|
+
* The time to which the animation should move to on the next render.
|
|
3405
|
+
* If not null, the animation will scrub to this time instead of advancing by the given time.
|
|
3406
|
+
*/
|
|
3407
|
+
this.scrubTo = null;
|
|
3408
|
+
this.instance = new runtime.LinearAnimationInstance(animation, artboard);
|
|
3409
|
+
}
|
|
3410
|
+
Object.defineProperty(Animation.prototype, "name", {
|
|
3411
|
+
/**
|
|
3412
|
+
* Returns the animation's name
|
|
3413
|
+
*/
|
|
3414
|
+
get: function () {
|
|
3415
|
+
return this.animation.name;
|
|
3416
|
+
},
|
|
3417
|
+
enumerable: false,
|
|
3418
|
+
configurable: true
|
|
3419
|
+
});
|
|
3420
|
+
Object.defineProperty(Animation.prototype, "time", {
|
|
3421
|
+
/**
|
|
3422
|
+
* Returns the animation's name
|
|
3423
|
+
*/
|
|
3424
|
+
get: function () {
|
|
3425
|
+
return this.instance.time;
|
|
3426
|
+
},
|
|
3427
|
+
/**
|
|
3428
|
+
* Sets the animation's current time
|
|
3429
|
+
*/
|
|
3430
|
+
set: function (value) {
|
|
3431
|
+
this.instance.time = value;
|
|
3432
|
+
},
|
|
3433
|
+
enumerable: false,
|
|
3434
|
+
configurable: true
|
|
3435
|
+
});
|
|
3436
|
+
Object.defineProperty(Animation.prototype, "loopValue", {
|
|
3437
|
+
/**
|
|
3438
|
+
* Returns the animation's loop type
|
|
3439
|
+
*/
|
|
3440
|
+
get: function () {
|
|
3441
|
+
return this.animation.loopValue;
|
|
3442
|
+
},
|
|
3443
|
+
enumerable: false,
|
|
3444
|
+
configurable: true
|
|
3445
|
+
});
|
|
3446
|
+
Object.defineProperty(Animation.prototype, "needsScrub", {
|
|
3447
|
+
/**
|
|
3448
|
+
* Indicates whether the animation needs to be scrubbed.
|
|
3449
|
+
* @returns `true` if the animation needs to be scrubbed, `false` otherwise.
|
|
3450
|
+
*/
|
|
3451
|
+
get: function () {
|
|
3452
|
+
return this.scrubTo !== null;
|
|
3453
|
+
},
|
|
3454
|
+
enumerable: false,
|
|
3455
|
+
configurable: true
|
|
3456
|
+
});
|
|
3457
|
+
/**
|
|
3458
|
+
* Advances the animation by the give time. If the animation needs scrubbing,
|
|
3459
|
+
* time is ignored and the stored scrub value is used.
|
|
3460
|
+
* @param time the time to advance the animation by if no scrubbing required
|
|
3461
|
+
*/
|
|
3462
|
+
Animation.prototype.advance = function (time) {
|
|
3463
|
+
if (this.scrubTo === null) {
|
|
3464
|
+
this.instance.advance(time);
|
|
3465
|
+
}
|
|
3466
|
+
else {
|
|
3467
|
+
this.instance.time = 0;
|
|
3468
|
+
this.instance.advance(this.scrubTo);
|
|
3469
|
+
this.scrubTo = null;
|
|
3470
|
+
}
|
|
3471
|
+
};
|
|
3472
|
+
/**
|
|
3473
|
+
* Apply interpolated keyframe values to the artboard. This should be called after calling
|
|
3474
|
+
* .advance() on an animation instance so that new values are applied to properties.
|
|
3475
|
+
*
|
|
3476
|
+
* Note: This does not advance the artboard, which updates all objects on the artboard
|
|
3477
|
+
* @param mix - Mix value for the animation from 0 to 1
|
|
3478
|
+
*/
|
|
3479
|
+
Animation.prototype.apply = function (mix) {
|
|
3480
|
+
this.instance.apply(mix);
|
|
3481
|
+
};
|
|
3482
|
+
/**
|
|
3483
|
+
* Deletes the backing Wasm animation instance; once this is called, this
|
|
3484
|
+
* animation is no more.
|
|
3485
|
+
*/
|
|
3486
|
+
Animation.prototype.cleanup = function () {
|
|
3487
|
+
this.instance.delete();
|
|
3488
|
+
};
|
|
3489
|
+
return Animation;
|
|
3490
|
+
}());
|
|
3491
|
+
|
|
3492
|
+
|
|
3493
|
+
|
|
3494
|
+
/***/ }),
|
|
3495
|
+
/* 5 */
|
|
3496
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3497
|
+
|
|
3364
3498
|
__webpack_require__.r(__webpack_exports__);
|
|
3365
3499
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3366
3500
|
/* harmony export */ BLANK_URL: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__.BLANK_URL),
|
|
3367
3501
|
/* harmony export */ registerTouchInteractions: () => (/* reexport safe */ _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__.registerTouchInteractions),
|
|
3368
3502
|
/* harmony export */ sanitizeUrl: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__.sanitizeUrl)
|
|
3369
3503
|
/* harmony export */ });
|
|
3370
|
-
/* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
3371
|
-
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
3504
|
+
/* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
|
|
3505
|
+
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
|
|
3372
3506
|
|
|
3373
3507
|
|
|
3374
3508
|
|
|
3375
3509
|
|
|
3376
3510
|
/***/ }),
|
|
3377
|
-
/*
|
|
3511
|
+
/* 6 */
|
|
3378
3512
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3379
3513
|
|
|
3380
3514
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -3528,7 +3662,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3528
3662
|
|
|
3529
3663
|
|
|
3530
3664
|
/***/ }),
|
|
3531
|
-
/*
|
|
3665
|
+
/* 7 */
|
|
3532
3666
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3533
3667
|
|
|
3534
3668
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -3660,7 +3794,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3660
3794
|
/* harmony export */ });
|
|
3661
3795
|
/* harmony import */ var _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
3662
3796
|
/* harmony import */ var package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
3663
|
-
/* harmony import */ var
|
|
3797
|
+
/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
|
3798
|
+
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5);
|
|
3664
3799
|
var __extends = (undefined && undefined.__extends) || (function () {
|
|
3665
3800
|
var extendStatics = function (d, b) {
|
|
3666
3801
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -3715,6 +3850,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
3715
3850
|
|
|
3716
3851
|
|
|
3717
3852
|
|
|
3853
|
+
|
|
3718
3854
|
// #region layout
|
|
3719
3855
|
// Fit options for the canvas
|
|
3720
3856
|
var Fit;
|
|
@@ -3893,95 +4029,6 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
3893
4029
|
return RuntimeLoader;
|
|
3894
4030
|
}());
|
|
3895
4031
|
|
|
3896
|
-
// #endregion
|
|
3897
|
-
// #region animations
|
|
3898
|
-
// Wraps animations and instances from the runtime and keeps track of playback
|
|
3899
|
-
// state
|
|
3900
|
-
var Animation = /** @class */ (function () {
|
|
3901
|
-
/**
|
|
3902
|
-
* Constructs a new animation
|
|
3903
|
-
* @constructor
|
|
3904
|
-
* @param {any} animation: runtime animation object
|
|
3905
|
-
* @param {any} instance: runtime animation instance object
|
|
3906
|
-
*/
|
|
3907
|
-
function Animation(animation, artboard, runtime, playing) {
|
|
3908
|
-
this.animation = animation;
|
|
3909
|
-
this.artboard = artboard;
|
|
3910
|
-
this.playing = playing;
|
|
3911
|
-
this.loopCount = 0;
|
|
3912
|
-
// Time to which the animation should move to on the next render
|
|
3913
|
-
this.scrubTo = null;
|
|
3914
|
-
this.instance = new runtime.LinearAnimationInstance(animation, artboard);
|
|
3915
|
-
}
|
|
3916
|
-
Object.defineProperty(Animation.prototype, "name", {
|
|
3917
|
-
// Returns the animation's name
|
|
3918
|
-
get: function () {
|
|
3919
|
-
return this.animation.name;
|
|
3920
|
-
},
|
|
3921
|
-
enumerable: false,
|
|
3922
|
-
configurable: true
|
|
3923
|
-
});
|
|
3924
|
-
Object.defineProperty(Animation.prototype, "time", {
|
|
3925
|
-
// Returns the animation's current time
|
|
3926
|
-
get: function () {
|
|
3927
|
-
return this.instance.time;
|
|
3928
|
-
},
|
|
3929
|
-
// Sets the animation's current time
|
|
3930
|
-
set: function (value) {
|
|
3931
|
-
this.instance.time = value;
|
|
3932
|
-
},
|
|
3933
|
-
enumerable: false,
|
|
3934
|
-
configurable: true
|
|
3935
|
-
});
|
|
3936
|
-
Object.defineProperty(Animation.prototype, "loopValue", {
|
|
3937
|
-
// Returns the animation's loop type
|
|
3938
|
-
get: function () {
|
|
3939
|
-
return this.animation.loopValue;
|
|
3940
|
-
},
|
|
3941
|
-
enumerable: false,
|
|
3942
|
-
configurable: true
|
|
3943
|
-
});
|
|
3944
|
-
/**
|
|
3945
|
-
* Advances the animation by the give time. If the animation needs scrubbing,
|
|
3946
|
-
* time is ignored and the stored scrub value is used.
|
|
3947
|
-
* @param time the time to advance the animation by if no scrubbing required
|
|
3948
|
-
*/
|
|
3949
|
-
Animation.prototype.advance = function (time) {
|
|
3950
|
-
if (this.scrubTo === null) {
|
|
3951
|
-
this.instance.advance(time);
|
|
3952
|
-
}
|
|
3953
|
-
else {
|
|
3954
|
-
this.instance.time = 0;
|
|
3955
|
-
this.instance.advance(this.scrubTo);
|
|
3956
|
-
this.scrubTo = null;
|
|
3957
|
-
}
|
|
3958
|
-
};
|
|
3959
|
-
/**
|
|
3960
|
-
* Apply interpolated keyframe values to the artboard. This should be called after calling
|
|
3961
|
-
* .advance() on an animation instance so that new values are applied to properties.
|
|
3962
|
-
*
|
|
3963
|
-
* Note: This does not advance the artboard, which updates all objects on the artboard
|
|
3964
|
-
* @param mix - Mix value for the animation from 0 to 1
|
|
3965
|
-
*/
|
|
3966
|
-
Animation.prototype.apply = function (mix) {
|
|
3967
|
-
this.instance.apply(mix);
|
|
3968
|
-
};
|
|
3969
|
-
Object.defineProperty(Animation.prototype, "needsScrub", {
|
|
3970
|
-
get: function () {
|
|
3971
|
-
return this.scrubTo !== null;
|
|
3972
|
-
},
|
|
3973
|
-
enumerable: false,
|
|
3974
|
-
configurable: true
|
|
3975
|
-
});
|
|
3976
|
-
/**
|
|
3977
|
-
* Deletes the backing Wasm animation instance; once this is called, this
|
|
3978
|
-
* animation is no more.
|
|
3979
|
-
*/
|
|
3980
|
-
Animation.prototype.cleanup = function () {
|
|
3981
|
-
this.instance.delete();
|
|
3982
|
-
};
|
|
3983
|
-
return Animation;
|
|
3984
|
-
}());
|
|
3985
4032
|
// #endregion
|
|
3986
4033
|
// #region state machines
|
|
3987
4034
|
var StateMachineInputType;
|
|
@@ -4196,7 +4243,7 @@ var Animator = /** @class */ (function () {
|
|
|
4196
4243
|
// Try to create a new animation instance
|
|
4197
4244
|
var anim = this.artboard.animationByName(animatables[i]);
|
|
4198
4245
|
if (anim) {
|
|
4199
|
-
var newAnimation = new Animation(anim, this.artboard, this.runtime, playing);
|
|
4246
|
+
var newAnimation = new _animation__WEBPACK_IMPORTED_MODULE_2__.Animation(anim, this.artboard, this.runtime, playing);
|
|
4200
4247
|
// Display the first frame of the specified animation
|
|
4201
4248
|
newAnimation.advance(0);
|
|
4202
4249
|
newAnimation.apply(1.0);
|
|
@@ -4250,7 +4297,7 @@ var Animator = /** @class */ (function () {
|
|
|
4250
4297
|
// Try to create a new animation instance
|
|
4251
4298
|
var anim = this.artboard.animationByName(animatables[i]);
|
|
4252
4299
|
if (anim) {
|
|
4253
|
-
var newAnimation = new Animation(anim, this.artboard, this.runtime, playing);
|
|
4300
|
+
var newAnimation = new _animation__WEBPACK_IMPORTED_MODULE_2__.Animation(anim, this.artboard, this.runtime, playing);
|
|
4254
4301
|
// Display the first frame of the specified animation
|
|
4255
4302
|
newAnimation.advance(0);
|
|
4256
4303
|
newAnimation.apply(1.0);
|
|
@@ -5147,7 +5194,7 @@ var Rive = /** @class */ (function () {
|
|
|
5147
5194
|
"isTouchScrollEnabled" in riveListenerOptions) {
|
|
5148
5195
|
touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
|
|
5149
5196
|
}
|
|
5150
|
-
this.eventCleanup = (0,
|
|
5197
|
+
this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.registerTouchInteractions)({
|
|
5151
5198
|
canvas: this.canvas,
|
|
5152
5199
|
artboard: this.artboard,
|
|
5153
5200
|
stateMachines: activeStateMachines,
|
|
@@ -5342,10 +5389,10 @@ var Rive = /** @class */ (function () {
|
|
|
5342
5389
|
if (this.automaticallyHandleEvents) {
|
|
5343
5390
|
var newAnchorTag = document.createElement("a");
|
|
5344
5391
|
var _b = event_1, url = _b.url, target = _b.target;
|
|
5345
|
-
var sanitizedUrl = (0,
|
|
5392
|
+
var sanitizedUrl = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.sanitizeUrl)(url);
|
|
5346
5393
|
url && newAnchorTag.setAttribute("href", sanitizedUrl);
|
|
5347
5394
|
target && newAnchorTag.setAttribute("target", target);
|
|
5348
|
-
if (sanitizedUrl && sanitizedUrl !==
|
|
5395
|
+
if (sanitizedUrl && sanitizedUrl !== _utils__WEBPACK_IMPORTED_MODULE_3__.BLANK_URL) {
|
|
5349
5396
|
newAnchorTag.click();
|
|
5350
5397
|
}
|
|
5351
5398
|
}
|