@rive-app/webgl2 2.16.0 → 2.17.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl2",
3
- "version": "2.16.0",
3
+ "version": "2.17.1",
4
4
  "description": "Rive's webgl2 based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -495,6 +495,27 @@ export declare class Rive {
495
495
  * @returns the inputs for the named state machine
496
496
  */
497
497
  stateMachineInputs(name: string): StateMachineInput[];
498
+ private retrieveInputAtPath;
499
+ /**
500
+ * Set the boolean input with the provided name at the given path with value
501
+ * @param input the state machine input name
502
+ * @param value the value to set the input to
503
+ * @param path the path the input is located at an artboard level
504
+ */
505
+ setBooleanStateAtPath(inputName: string, value: boolean, path: string): void;
506
+ /**
507
+ * Set the number input with the provided name at the given path with value
508
+ * @param input the state machine input name
509
+ * @param value the value to set the input to
510
+ * @param path the path the input is located at an artboard level
511
+ */
512
+ setNumberStateAtPath(inputName: string, value: number, path: string): void;
513
+ /**
514
+ * Fire the trigger with the provided name at the given path
515
+ * @param input the state machine input name
516
+ * @param path the path the input is located at an artboard level
517
+ */
518
+ fireStateAtPath(inputName: string, path: string): void;
498
519
  get playingStateMachineNames(): string[];
499
520
  get playingAnimationNames(): string[];
500
521
  get pausedAnimationNames(): string[];
package/rive.js CHANGED
@@ -415,7 +415,7 @@ function Na(a, b) {
415
415
  return Ma(c, a, b);
416
416
  }));
417
417
  }
418
- var Oa, Pa, Ta = {470384:(a, b, c, d, e) => {
418
+ var Oa, Pa, Ta = {470416:(a, b, c, d, e) => {
419
419
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
420
420
  return 0;
421
421
  }
@@ -478,9 +478,9 @@ var Oa, Pa, Ta = {470384:(a, b, c, d, e) => {
478
478
  }
479
479
  window.h.Da += 1;
480
480
  return 1;
481
- }, 472562:() => {
481
+ }, 472594:() => {
482
482
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
483
- }, 472726:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 472830:() => {
483
+ }, 472758:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 472862:() => {
484
484
  try {
485
485
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
486
486
  a.close();
@@ -488,7 +488,7 @@ var Oa, Pa, Ta = {470384:(a, b, c, d, e) => {
488
488
  } catch (c) {
489
489
  return 0;
490
490
  }
491
- }, 473001:(a, b, c, d, e, f) => {
491
+ }, 473033:(a, b, c, d, e, f) => {
492
492
  if ("undefined" === typeof window.h) {
493
493
  return -1;
494
494
  }
@@ -534,7 +534,7 @@ var Oa, Pa, Ta = {470384:(a, b, c, d, e) => {
534
534
  a == window.h.I.Ba && g.Y.connect(g.J.destination);
535
535
  g.jb = f;
536
536
  return window.h.lc(g);
537
- }, 475878:a => window.h.va(a).J.sampleRate, 475951:a => {
537
+ }, 475910:a => window.h.va(a).J.sampleRate, 475983:a => {
538
538
  a = window.h.va(a);
539
539
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
540
540
  }, a.Y.disconnect(), a.Y = void 0);
@@ -542,13 +542,13 @@ var Oa, Pa, Ta = {470384:(a, b, c, d, e) => {
542
542
  a.J.close();
543
543
  a.J = void 0;
544
544
  a.jb = void 0;
545
- }, 476351:a => {
545
+ }, 476383:a => {
546
546
  window.h.wb(a);
547
- }, 476401:a => {
547
+ }, 476433:a => {
548
548
  a = window.h.va(a);
549
549
  a.J.resume();
550
550
  a.state = window.h.ha.rb;
551
- }, 476540:a => {
551
+ }, 476572:a => {
552
552
  a = window.h.va(a);
553
553
  a.J.suspend();
554
554
  a.state = window.h.ha.stopped;
@@ -3459,8 +3459,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = B.dynCall_viijii
3459
3459
  n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = B.dynCall_iiiiij)(a, b, c, d, e, f, g);
3460
3460
  n.dynCall_iiiiijj = (a, b, c, d, e, f, g, m, p) => (n.dynCall_iiiiijj = B.dynCall_iiiiijj)(a, b, c, d, e, f, g, m, p);
3461
3461
  n.dynCall_iiiiiijj = (a, b, c, d, e, f, g, m, p, l) => (n.dynCall_iiiiiijj = B.dynCall_iiiiiijj)(a, b, c, d, e, f, g, m, p, l);
3462
- n.___start_em_js = 467760;
3463
- n.___stop_em_js = 470384;
3462
+ n.___start_em_js = 467792;
3463
+ n.___stop_em_js = 470416;
3464
3464
  var Wd;
3465
3465
  Ga = function Xd() {
3466
3466
  Wd || Yd();
@@ -3520,7 +3520,7 @@ Yd();
3520
3520
  /* 2 */
3521
3521
  /***/ ((module) => {
3522
3522
 
3523
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.16.0","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3523
+ module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.17.1","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3524
3524
 
3525
3525
  /***/ }),
3526
3526
  /* 3 */
@@ -5911,6 +5911,73 @@ var Rive = /** @class */ (function () {
5911
5911
  var stateMachine = this.animator.stateMachines.find(function (m) { return m.name === name; });
5912
5912
  return stateMachine === null || stateMachine === void 0 ? void 0 : stateMachine.inputs;
5913
5913
  };
5914
+ // Returns the input with the provided name at the given path
5915
+ Rive.prototype.retrieveInputAtPath = function (name, path) {
5916
+ if (!name) {
5917
+ console.warn("No input name provided for path '".concat(path, "'"));
5918
+ return;
5919
+ }
5920
+ if (!this.artboard) {
5921
+ console.warn("Tried to access input: '".concat(name, "', at path: '").concat(path, "', but the Artboard is null"));
5922
+ return;
5923
+ }
5924
+ var input = this.artboard.inputByPath(name, path);
5925
+ if (!input) {
5926
+ console.warn("Could not access an input with name: '".concat(name, "', at path:'").concat(path, "'"));
5927
+ return;
5928
+ }
5929
+ return input;
5930
+ };
5931
+ /**
5932
+ * Set the boolean input with the provided name at the given path with value
5933
+ * @param input the state machine input name
5934
+ * @param value the value to set the input to
5935
+ * @param path the path the input is located at an artboard level
5936
+ */
5937
+ Rive.prototype.setBooleanStateAtPath = function (inputName, value, path) {
5938
+ var input = this.retrieveInputAtPath(inputName, path);
5939
+ if (!input)
5940
+ return;
5941
+ if (input.type === StateMachineInputType.Boolean) {
5942
+ input.asBool().value = value;
5943
+ }
5944
+ else {
5945
+ console.warn("Input with name: '".concat(inputName, "', at path:'").concat(path, "' is not a boolean"));
5946
+ }
5947
+ };
5948
+ /**
5949
+ * Set the number input with the provided name at the given path with value
5950
+ * @param input the state machine input name
5951
+ * @param value the value to set the input to
5952
+ * @param path the path the input is located at an artboard level
5953
+ */
5954
+ Rive.prototype.setNumberStateAtPath = function (inputName, value, path) {
5955
+ var input = this.retrieveInputAtPath(inputName, path);
5956
+ if (!input)
5957
+ return;
5958
+ if (input.type === StateMachineInputType.Number) {
5959
+ input.asNumber().value = value;
5960
+ }
5961
+ else {
5962
+ console.warn("Input with name: '".concat(inputName, "', at path:'").concat(path, "' is not a number"));
5963
+ }
5964
+ };
5965
+ /**
5966
+ * Fire the trigger with the provided name at the given path
5967
+ * @param input the state machine input name
5968
+ * @param path the path the input is located at an artboard level
5969
+ */
5970
+ Rive.prototype.fireStateAtPath = function (inputName, path) {
5971
+ var input = this.retrieveInputAtPath(inputName, path);
5972
+ if (!input)
5973
+ return;
5974
+ if (input.type === StateMachineInputType.Trigger) {
5975
+ input.asTrigger().fire();
5976
+ }
5977
+ else {
5978
+ console.warn("Input with name: '".concat(inputName, "', at path:'").concat(path, "' is not a trigger"));
5979
+ }
5980
+ };
5914
5981
  Object.defineProperty(Rive.prototype, "playingStateMachineNames", {
5915
5982
  // Returns a list of playing machine names
5916
5983
  get: function () {