@visactor/vstory 0.0.11 → 0.0.13

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/dist/index.js CHANGED
@@ -25359,7 +25359,7 @@
25359
25359
  scaleX = _params$scaleX === void 0 ? 1 : _params$scaleX,
25360
25360
  _params$scaleY = params.scaleY,
25361
25361
  scaleY = _params$scaleY === void 0 ? 1 : _params$scaleY;
25362
- this._container && this._initCanvasByContainer(dpr), params.canvas && this._initCanvasByCanvas(canvas, width, height, dpr), this._stage.background = background, this._stage.defaultLayer.setAttributes({
25362
+ this._container && this._initCanvasByContainer(width, height, dpr), params.canvas && this._initCanvasByCanvas(canvas, width, height, dpr), this._stage.background = background, this._stage.defaultLayer.setAttributes({
25363
25363
  background: layerBackground
25364
25364
  }), this._stage.defaultLayer.scale(scaleX, scaleY);
25365
25365
  }
@@ -25380,12 +25380,12 @@
25380
25380
  }
25381
25381
  }, {
25382
25382
  key: "_initCanvasByContainer",
25383
- value: function _initCanvasByContainer(dpr) {
25383
+ value: function _initCanvasByContainer(width, height, dpr) {
25384
25384
  var container = this._container;
25385
25385
  if (!container) return;
25386
25386
  var canvas = document.createElement("canvas");
25387
25387
  canvas.id = "_visactor_story_canvas_".concat(this._story.id), this._canvas = canvas, container.appendChild(canvas);
25388
- var stage = this._initCanvas(canvas, container.clientWidth, container.clientHeight, dpr);
25388
+ var stage = this._initCanvas(canvas, null != width ? width : container.clientWidth, null != height ? height : container.clientHeight, dpr);
25389
25389
  this._stage = stage;
25390
25390
  }
25391
25391
  }, {
@@ -108581,10 +108581,12 @@
108581
108581
  }
108582
108582
  };
108583
108583
  var arcGrowRadius = function arcGrowRadius(instance, animation, option) {
108584
- var duration = animation.duration,
108585
- loop = animation.loop,
108586
- oneByOne = animation.oneByOne,
108587
- easing = animation.easing,
108584
+ var _a, _b;
108585
+ var _getCustomParams = getCustomParams(animation, null !== (_a = animation.delayPerTime) && void 0 !== _a ? _a : 60, null !== (_b = animation.enterPerTime) && void 0 !== _b ? _b : 100),
108586
+ duration = _getCustomParams.duration,
108587
+ loop = _getCustomParams.loop,
108588
+ oneByOne = _getCustomParams.oneByOne,
108589
+ easing = _getCustomParams.easing,
108588
108590
  disappear = option.disappear;
108589
108591
  return {
108590
108592
  type: disappear ? "growRadiusOut" : "growRadiusIn",
@@ -108595,10 +108597,12 @@
108595
108597
  };
108596
108598
  },
108597
108599
  arcGrowAngle = function arcGrowAngle(instance, animation, option) {
108598
- var duration = animation.duration,
108599
- loop = animation.loop,
108600
- oneByOne = animation.oneByOne,
108601
- easing = animation.easing,
108600
+ var _a, _b;
108601
+ var _getCustomParams2 = getCustomParams(animation, null !== (_a = animation.delayPerTime) && void 0 !== _a ? _a : 60, null !== (_b = animation.enterPerTime) && void 0 !== _b ? _b : 100),
108602
+ duration = _getCustomParams2.duration,
108603
+ loop = _getCustomParams2.loop,
108604
+ oneByOne = _getCustomParams2.oneByOne,
108605
+ easing = _getCustomParams2.easing,
108602
108606
  disappear = option.disappear;
108603
108607
  return {
108604
108608
  type: disappear ? "growAngleOut" : "growAngleIn",
@@ -108612,10 +108616,12 @@
108612
108616
  };
108613
108617
  },
108614
108618
  arcFade = function arcFade(instance, animation, option) {
108615
- var duration = animation.duration,
108616
- loop = animation.loop,
108617
- oneByOne = animation.oneByOne,
108618
- easing = animation.easing,
108619
+ var _a, _b;
108620
+ var _getCustomParams3 = getCustomParams(animation, null !== (_a = animation.delayPerTime) && void 0 !== _a ? _a : 60, null !== (_b = animation.enterPerTime) && void 0 !== _b ? _b : 100),
108621
+ duration = _getCustomParams3.duration,
108622
+ loop = _getCustomParams3.loop,
108623
+ oneByOne = _getCustomParams3.oneByOne,
108624
+ easing = _getCustomParams3.easing,
108619
108625
  disappear = option.disappear;
108620
108626
  return {
108621
108627
  type: disappear ? "fadeOut" : "fadeIn",
@@ -108627,11 +108633,11 @@
108627
108633
  },
108628
108634
  pieLeap = function pieLeap(instance, animation) {
108629
108635
  var _a, _b, _c, _d;
108630
- var _getCustomParams = getCustomParams(animation, null !== (_b = null !== (_a = animation.delayPerTime) && void 0 !== _a ? _a : PieLeap.delayPerTime) && void 0 !== _b ? _b : 50, null !== (_d = null !== (_c = animation.enterPerTime) && void 0 !== _c ? _c : PieLeap.enterPerTime) && void 0 !== _d ? _d : 300),
108631
- duration = _getCustomParams.duration,
108632
- loop = _getCustomParams.loop,
108633
- oneByOne = _getCustomParams.oneByOne,
108634
- easing = _getCustomParams.easing;
108636
+ var _getCustomParams4 = getCustomParams(animation, null !== (_b = null !== (_a = animation.delayPerTime) && void 0 !== _a ? _a : PieLeap.delayPerTime) && void 0 !== _b ? _b : 50, null !== (_d = null !== (_c = animation.enterPerTime) && void 0 !== _c ? _c : PieLeap.enterPerTime) && void 0 !== _d ? _d : 300),
108637
+ duration = _getCustomParams4.duration,
108638
+ loop = _getCustomParams4.loop,
108639
+ oneByOne = _getCustomParams4.oneByOne,
108640
+ easing = _getCustomParams4.easing;
108635
108641
  return {
108636
108642
  channel: ["x", "y", "innerRadius", "outerRadius"],
108637
108643
  custom: PieLeap,
@@ -108896,6 +108902,14 @@
108896
108902
  return getCharacterGraphic(character);
108897
108903
  }
108898
108904
 
108905
+ var bounce2Str = "M 0 -0.545 C 0.024 -0.045 0.068 0.414 0.21 0.429 C 0.36 0.436 0.396 -0.258 0.521 -0.237 C 0.626 -0.232 0.634 0.131 0.717 0.128 C 0.827 0.133 0.827 -0.073 0.91 -0.083 C 0.962 -0.086 1 0 1 0",
108906
+ bounce3Str = "M 0 -0.545 C 0.024 -0.045 0.052 0.358 0.216 0.381 C 0.321 0.368 0.37 -0.122 0.506 -0.114 C 0.615 -0.12 0.668 0.094 0.837 0.092 C 0.923 0.087 0.973 0.034 1.004 -0.005",
108907
+ bounce4Str = "M 0 -0.545 C 0.024 -0.045 0.075 0.389 0.216 0.381 C 0.36 0.376 0.425 -0.133 0.756 -0.127 C 0.918 -0.109 0.973 -0.057 1.007 0.003",
108908
+ bounceMap = {
108909
+ bounce2: bounce2Str,
108910
+ bounce3: bounce3Str,
108911
+ bounce4: bounce4Str
108912
+ };
108899
108913
  function bounce(character, animation, params) {
108900
108914
  var graphic = getCharacterParentGraphic(character);
108901
108915
  if (graphic) {
@@ -108906,7 +108920,8 @@
108906
108920
  !1 === visible && (graphic.attribute.visible = !0);
108907
108921
  var height = graphic.AABBBounds.height();
108908
108922
  !1 === visible && graphic.setAttribute("visible", !1), graphic.animate().play(new Bounce({}, {}, duration, easing, {
108909
- dy: null != dy ? dy : .2 * height
108923
+ dy: (params.flipY ? -1 : 1) * (null != dy ? dy : .2 * height),
108924
+ customEase: params.customEase || bounceMap[params.type]
108910
108925
  }));
108911
108926
  }
108912
108927
  }
@@ -108988,7 +109003,7 @@
108988
109003
  graphic = characters[characters.length - 1],
108989
109004
  componentStyle = Object.assign({}, panelStyle);
108990
109005
  ["x", "y", "dx", "dy", "scaleX", "scaleY", "width", "height"].forEach(function (key) {
108991
- key in componentStyle && (componentStyle[key] = graphicStyle[key], delete componentStyle[key]);
109006
+ key in graphicStyle && (componentStyle[key] = graphicStyle[key], delete graphicStyle[key]);
108992
109007
  }), component && (component.styleAnimate ? component.styleAnimate(componentStyle, animation) : component.animate().to(componentStyle, duration, easing)), graphic && graphicStyle && (graphic.styleAnimate ? graphic.styleAnimate(graphicStyle, animation) : graphic.animate().to(graphicStyle, duration, easing)), text && textStyle && text.animate().to(textStyle, duration, easing);
108993
109008
  }
108994
109009
  }]);
@@ -110447,14 +110462,26 @@
110447
110462
  initVR();
110448
110463
  }
110449
110464
 
110465
+ exports.ACTION_TYPE = ACTION_TYPE;
110466
+ exports.BaseComponentWithText = BaseComponentWithText;
110467
+ exports.BaseRuntime = BaseRuntime;
110468
+ exports.CharacterComponent = CharacterComponent;
110450
110469
  exports.CommonBounceActionProcessor = CommonBounceActionProcessor;
110470
+ exports.CommonMoveToActionProcessor = CommonMoveToActionProcessor;
110471
+ exports.CommonScaleToActionProcessor = CommonScaleToActionProcessor;
110472
+ exports.CommonStyleActionProcessor = CommonStyleActionProcessor;
110473
+ exports.CommonVisibilityActionProcessor = CommonVisibilityActionProcessor;
110451
110474
  exports.GlobalTickerStore = GlobalTickerStore;
110452
110475
  exports.Player = Player$1;
110453
110476
  exports.ProcessorRegistry = ProcessorRegistry;
110454
110477
  exports.Story = Story;
110478
+ exports.StoryFactory = StoryFactory;
110455
110479
  exports.createStory = createStory;
110456
110480
  exports.createUnitTemplate = createUnitTemplate;
110457
110481
  exports.decompressData = decompressData;
110482
+ exports.getCharacterByEffect = getCharacterByEffect;
110483
+ exports.getCharacterGraphic = getCharacterGraphic;
110484
+ exports.getCharacterParentGraphic = getCharacterParentGraphic;
110458
110485
  exports.globalProcessorRegistry = globalProcessorRegistry;
110459
110486
  exports.globalTickerStore = globalTickerStore;
110460
110487
  exports.initVR = initVR;