@visactor/vrender 1.1.0-alpha.11 → 1.1.0-alpha.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
@@ -9318,12 +9318,42 @@
9318
9318
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
9319
9319
  }
9320
9320
  setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
9321
- this.visitTrackedAnimates(animate => {
9322
- (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
9323
- animate.preventAttr(key);
9324
- });
9321
+ if (!params) return;
9322
+ const keys = Object.keys(params);
9323
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.visitTrackedAnimates(animate => {
9324
+ (animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
9325
9325
  }), this.applyTransientAttributes(params, forceUpdateTag, context);
9326
9326
  }
9327
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
9328
+ var _a;
9329
+ const graphicContext = this.context,
9330
+ diffAttrs = null == graphicContext ? void 0 : graphicContext.diffAttrs,
9331
+ updateType = null == context ? void 0 : context.type;
9332
+ if (!keys.length || !graphicContext || !diffAttrs || updateType === exports.AttributeUpdateType.STATE || null != updateType && updateType >= exports.AttributeUpdateType.ANIMATE_BIND && updateType <= exports.AttributeUpdateType.ANIMATE_END) return;
9333
+ let fromAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs && null !== (_a = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _a ? _a : null,
9334
+ captured = !1;
9335
+ for (let i = 0; i < keys.length; i++) {
9336
+ const key = keys[i];
9337
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
9338
+ const previousValue = this.attribute[key],
9339
+ nextValue = params[key];
9340
+ isEqual(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = cloneAttributeValue(previousValue), captured = !0);
9341
+ }
9342
+ captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
9343
+ }
9344
+ consumeTransientFromAttrsBeforePreventAnimate(rawDiffAttrs, diffAttrs) {
9345
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
9346
+ if (!transientFromAttrs || this.transientFromAttrsBeforePreventAnimateDiffAttrs !== rawDiffAttrs) return null;
9347
+ let fromAttrs = null,
9348
+ remaining = !1;
9349
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && (Object.prototype.hasOwnProperty.call(diffAttrs, key) ? (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = transientFromAttrs[key]) : remaining = !0);
9350
+ if (remaining) {
9351
+ const nextTransientFromAttrs = {};
9352
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
9353
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
9354
+ } else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
9355
+ return fromAttrs;
9356
+ }
9327
9357
  setAttributes(params, forceUpdateTag = !1, context) {
9328
9358
  params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
9329
9359
  }
@@ -32432,6 +32462,18 @@
32432
32462
  return !1;
32433
32463
  }
32434
32464
 
32465
+ const animateUpdateContext = {
32466
+ type: exports.AttributeUpdateType.ANIMATE_UPDATE
32467
+ };
32468
+ function applyAnimationFrameAttributes(target, attributes) {
32469
+ var _a;
32470
+ if (!attributes) return;
32471
+ const transientTarget = target;
32472
+ transientTarget.attribute || (transientTarget.attribute = {});
32473
+ const targetAttribute = transientTarget.attribute;
32474
+ for (const key in attributes) Object.prototype.hasOwnProperty.call(attributes, key) && (targetAttribute[key] = attributes[key]);
32475
+ null === (_a = transientTarget.onAttributeUpdate) || void 0 === _a || _a.call(transientTarget, animateUpdateContext);
32476
+ }
32435
32477
  function applyAnimationTransientAttributes(target, attributes, type = exports.AttributeUpdateType.ANIMATE_UPDATE) {
32436
32478
  var _a;
32437
32479
  if (!attributes) return;
@@ -32446,6 +32488,10 @@
32446
32488
  }
32447
32489
 
32448
32490
  function noop() {}
32491
+ function includesKey$1(keys, key) {
32492
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
32493
+ return !1;
32494
+ }
32449
32495
  class Step {
32450
32496
  constructor(type, props, duration, easing) {
32451
32497
  var _a;
@@ -32501,6 +32547,17 @@
32501
32547
  onBind() {
32502
32548
  "glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
32503
32549
  }
32550
+ runInterpolateUpdate(fromProps, toProps, ratio) {
32551
+ if (this.animate.interpolateUpdateFunction) return void this.animate.interpolateUpdateFunction(fromProps, toProps, ratio, this, this.target);
32552
+ const funcs = this.interpolateUpdateFunctions,
32553
+ propKeys = this.propKeys;
32554
+ if (funcs && propKeys) for (let index = 0; index < funcs.length; index++) {
32555
+ const key = propKeys[index],
32556
+ fromValue = fromProps[key],
32557
+ toValue = toProps[key];
32558
+ funcs[index](key, fromValue, toValue, ratio, this, this.target);
32559
+ }
32560
+ }
32504
32561
  onFirstRun() {}
32505
32562
  onStart() {
32506
32563
  if (!this._hasFirstRun) {
@@ -32515,23 +32572,49 @@
32515
32572
  tryPreventConflict() {
32516
32573
  var _a, _b;
32517
32574
  const animate = this.animate,
32518
- target = this.target;
32519
- (null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
32520
- var _a;
32521
- null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
32522
- })(a => {
32575
+ target = this.target,
32576
+ forEachTrackedAnimate = null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
32577
+ var _a;
32578
+ null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
32579
+ },
32580
+ propKeys = this.propKeys;
32581
+ forEachTrackedAnimate(a => {
32523
32582
  if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
32524
32583
  const fromProps = a.getStartProps();
32525
- this.propKeys.forEach(key => {
32526
- null != fromProps[key] && a.preventAttr(key);
32527
- });
32584
+ let conflictKeys = null;
32585
+ for (let i = 0; i < propKeys.length; i++) {
32586
+ const key = propKeys[i];
32587
+ null != fromProps[key] && (null != conflictKeys ? conflictKeys : conflictKeys = []).push(key);
32588
+ }
32589
+ conflictKeys && a.preventAttrs(conflictKeys);
32528
32590
  });
32529
32591
  }
32592
+ removeKeysFromRecord(record, keys) {
32593
+ if (!record) return record;
32594
+ let hasBlockedKey = !1;
32595
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey$1(keys, key)) {
32596
+ hasBlockedKey = !0;
32597
+ break;
32598
+ }
32599
+ if (!hasBlockedKey) return record;
32600
+ const nextRecord = {};
32601
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey$1(keys, key) && (nextRecord[key] = record[key]);
32602
+ return nextRecord;
32603
+ }
32530
32604
  deleteSelfAttr(key) {
32605
+ this.deleteSelfAttrs([key]);
32606
+ }
32607
+ deleteSelfAttrs(keys) {
32531
32608
  var _a;
32532
- delete this.props[key], this.fromProps && delete this.fromProps[key];
32533
- const index = this.propKeys.indexOf(key);
32534
- -1 !== index && (this.propKeys.splice(index, 1), null === (_a = this.interpolateUpdateFunctions) || void 0 === _a || _a.splice(index, 1));
32609
+ if ((null == keys ? void 0 : keys.length) && (this.props = this.removeKeysFromRecord(this.props, keys), this.fromProps = this.removeKeysFromRecord(this.fromProps, keys), this.fromParsedProps = this.removeKeysFromRecord(this.fromParsedProps, keys), this.toParsedProps = this.removeKeysFromRecord(this.toParsedProps, keys), null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a.length)) {
32610
+ const funcs = this.interpolateUpdateFunctions;
32611
+ let writeIndex = 0;
32612
+ for (let readIndex = 0; readIndex < this.propKeys.length; readIndex++) {
32613
+ const propKey = this.propKeys[readIndex];
32614
+ includesKey$1(keys, propKey) || (writeIndex !== readIndex && (this.propKeys[writeIndex] = propKey, funcs && (funcs[writeIndex] = funcs[readIndex])), writeIndex++);
32615
+ }
32616
+ this.propKeys.length = writeIndex, funcs && (funcs.length = writeIndex);
32617
+ }
32535
32618
  }
32536
32619
  trySyncStartProps() {
32537
32620
  this.propKeys.forEach(key => {
@@ -32541,11 +32624,7 @@
32541
32624
  update(end, ratio, out) {
32542
32625
  if (this.onStart(), !this.props || !this.propKeys) return;
32543
32626
  const easedRatio = this.easing(ratio);
32544
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
32545
- if (!this.animate.validAttr(this.propKeys[index])) return;
32546
- const key = this.propKeys[index];
32547
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
32548
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
32627
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
32549
32628
  }
32550
32629
  onUpdate(end, ratio, out) {}
32551
32630
  onEnd(cb) {
@@ -32749,19 +32828,34 @@
32749
32828
  }), this.applyTransientFromAttributes();
32750
32829
  }
32751
32830
  deleteSelfAttr(key) {
32752
- super.deleteSelfAttr(key), delete this.from[key];
32831
+ this.deleteSelfAttrs([key]);
32832
+ }
32833
+ deleteSelfAttrs(keys) {
32834
+ super.deleteSelfAttrs(keys), this.from = this.removeKeysFromRecord(this.from, keys);
32753
32835
  }
32754
32836
  update(end, ratio, out) {
32755
32837
  if (this.onStart(), !this.props || !this.propKeys) return;
32756
32838
  const easedRatio = this.easing(ratio);
32757
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
32758
- if (!this.animate.validAttr(this.propKeys[index])) return;
32759
- const key = this.propKeys[index];
32760
- func(key, this.from[key], this.props[key], easedRatio, this, this.target);
32761
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
32839
+ this.runInterpolateUpdate(this.from, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
32762
32840
  }
32763
32841
  }
32764
32842
 
32843
+ function includesKey(keys, key) {
32844
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
32845
+ return !1;
32846
+ }
32847
+ function removeKeysFromRecord(record, keys) {
32848
+ if (!record) return record;
32849
+ let hasBlockedKey = !1;
32850
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey(keys, key)) {
32851
+ hasBlockedKey = !0;
32852
+ break;
32853
+ }
32854
+ if (!hasBlockedKey) return record;
32855
+ const nextRecord = {};
32856
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey(keys, key) && (nextRecord[key] = record[key]);
32857
+ return nextRecord;
32858
+ }
32765
32859
  class Animate {
32766
32860
  constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
32767
32861
  this.id = id, this.status = exports.AnimateStatus.INITIAL, this._timeline = timeline, timeline.addAnimate(this), this.slience = slience, this._startTime = 0, this._duration = 0, this._totalDuration = 0, this._loopCount = 0, this._currentLoop = 0, this._bounce = !1, this._firstStep = null, this._lastStep = null, this._startProps = {}, this._endProps = {}, this._preventAttrs = new Set(), this.currentTime = 0, this.interpolateUpdateFunction = null, this.priority = 0;
@@ -32849,12 +32943,14 @@
32849
32943
  cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
32850
32944
  }
32851
32945
  preventAttr(key) {
32852
- this._preventAttrs.add(key), delete this._startProps[key], delete this._endProps[key];
32853
- let step = this._firstStep;
32854
- for (; step;) step.deleteSelfAttr(key), step = step.next;
32946
+ this.preventAttrs([key]);
32855
32947
  }
32856
32948
  preventAttrs(keys) {
32857
- keys.forEach(key => this._preventAttrs.add(key));
32949
+ if (!(null == keys ? void 0 : keys.length)) return;
32950
+ for (let i = 0; i < keys.length; i++) this._preventAttrs.add(keys[i]);
32951
+ this._startProps = removeKeysFromRecord(this._startProps, keys), this._endProps = removeKeysFromRecord(this._endProps, keys);
32952
+ let step = this._firstStep;
32953
+ for (; step;) step.deleteSelfAttrs(keys), step = step.next;
32858
32954
  }
32859
32955
  validAttr(key) {
32860
32956
  return !this._preventAttrs.has(key);
@@ -33854,8 +33950,11 @@
33854
33950
  }), this));
33855
33951
  }
33856
33952
  deleteSelfAttr(key) {
33953
+ this.deleteSelfAttrs([key]);
33954
+ }
33955
+ deleteSelfAttrs(keys) {
33857
33956
  this.tasks.forEach(task => {
33858
- task.animate && task.animate.forEach(animate => animate.preventAttr(key));
33957
+ task.animate && task.animate.forEach(animate => animate.preventAttrs(keys));
33859
33958
  });
33860
33959
  }
33861
33960
  stop(type) {
@@ -34449,6 +34548,25 @@
34449
34548
  }
34450
34549
  }
34451
34550
 
34551
+ function buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs) {
34552
+ var _a;
34553
+ const commitTarget = target,
34554
+ contextFinalAttrs = null === (_a = commitTarget.context) || void 0 === _a ? void 0 : _a.finalAttrs,
34555
+ finalAttribute = "function" == typeof commitTarget.getFinalAttribute ? commitTarget.getFinalAttribute() : commitTarget.finalAttribute;
34556
+ let commitAttrs = null;
34557
+ for (let i = 0; i < keys.length; i++) {
34558
+ const key = keys[i];
34559
+ animate && !animate.validAttr(key) || (contextFinalAttrs && Object.prototype.hasOwnProperty.call(contextFinalAttrs, key) ? (null != commitAttrs || (commitAttrs = {}), commitAttrs[key] = contextFinalAttrs[key]) : finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, key) ? (null != commitAttrs || (commitAttrs = {}), commitAttrs[key] = finalAttribute[key]) : fallbackAttrs && Object.prototype.hasOwnProperty.call(fallbackAttrs, key) && (null != commitAttrs || (commitAttrs = {}), commitAttrs[key] = fallbackAttrs[key]));
34560
+ }
34561
+ return commitAttrs;
34562
+ }
34563
+ function commitAnimationStaticAttrs(target, keys, animate, fallbackAttrs) {
34564
+ const commitAttrs = buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs);
34565
+ return !!commitAttrs && (target.setAttributes(commitAttrs, !1, {
34566
+ type: exports.AttributeUpdateType.ANIMATE_END
34567
+ }), !0);
34568
+ }
34569
+
34452
34570
  class TagPointsUpdate extends ACustomAnimate {
34453
34571
  constructor(from, to, duration, easing, params) {
34454
34572
  var _a, _b;
@@ -34467,21 +34585,9 @@
34467
34585
  }
34468
34586
  onBind() {
34469
34587
  super.onBind();
34470
- const {
34471
- points: points,
34472
- segments: segments
34473
- } = this.target.attribute,
34474
- {
34475
- points: pointsTo,
34476
- segments: segmentsTo
34477
- } = this.target.getFinalAttribute();
34478
- this.from = {
34479
- points: points,
34480
- segments: segments
34481
- }, this.to = {
34482
- points: pointsTo,
34483
- segments: segmentsTo
34484
- }, this.props = this.to;
34588
+ const currentAttribute = this.target.attribute,
34589
+ finalAttribute = this.target.getFinalAttribute();
34590
+ this.from = {}, this.to = {}, Object.prototype.hasOwnProperty.call(currentAttribute, "points") && (this.from.points = currentAttribute.points), Object.prototype.hasOwnProperty.call(currentAttribute, "segments") && (this.from.segments = currentAttribute.segments), finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, "points") && (this.to.points = finalAttribute.points), finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, "segments") && (this.to.segments = finalAttribute.segments), this.props = this.to;
34485
34591
  const originFromPoints = this.getPoints(this.from),
34486
34592
  originToPoints = this.getPoints(this.to, !0);
34487
34593
  this.fromPoints = originFromPoints ? Array.isArray(originFromPoints) ? originFromPoints : [originFromPoints] : [], this.toPoints = originToPoints ? Array.isArray(originToPoints) ? originToPoints : [originToPoints] : [];
@@ -34517,31 +34623,42 @@
34517
34623
  const lastClipRange = this.target.attribute.clipRange;
34518
34624
  isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
34519
34625
  }
34626
+ onEnd(cb) {
34627
+ cb ? super.onEnd(cb) : (this.to && commitAnimationStaticAttrs(this.target, Object.keys(this.to), this.animate, this.to), super.onEnd());
34628
+ }
34629
+ applyPointTransientAttributes(attributes) {
34630
+ const validAttrs = {};
34631
+ Object.keys(attributes).forEach(key => {
34632
+ this.animate.validAttr(key) && (validAttrs[key] = attributes[key]);
34633
+ }), Object.keys(validAttrs).length && (applyAnimationFrameAttributes(this.target, validAttrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
34634
+ }
34520
34635
  onUpdate(end, ratio, out) {
34521
- if (end) return Object.keys(this.to).forEach(k => {
34522
- this.target.attribute[k] = this.to[k];
34523
- }), this.target.addUpdatePositionTag(), void this.target.addUpdateShapeAndBoundsTag();
34524
- if (this.points = this.points.map((point, index) => {
34525
- const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
34526
- return newPoint.context = point.context, newPoint;
34527
- }), this.clipRange) {
34528
- if (this.shrinkClipRange) return void (end ? (out.points = this.toPoints, out.clipRange = 1) : (out.points = this.fromPoints, out.clipRange = this.clipRange - (this.clipRange - this.shrinkClipRange) * ratio));
34529
- applyAnimationTransientAttributes(this.target, {
34530
- clipRange: this.clipRange + (1 - this.clipRange) * ratio
34531
- });
34532
- }
34533
- if (this.segmentsCache && this.to.segments) {
34534
- let start = 0;
34535
- const segments = this.to.segments.map((segment, index) => {
34536
- const end = start + this.segmentsCache[index],
34537
- points = this.points.slice(start, end);
34538
- return start = end, Object.assign(Object.assign({}, segment), {
34539
- points: points
34636
+ if (end) this.applyPointTransientAttributes(this.to);else {
34637
+ if (this.points = this.points.map((point, index) => {
34638
+ const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
34639
+ return newPoint.context = point.context, newPoint;
34640
+ }), this.clipRange) {
34641
+ if (this.shrinkClipRange) return void (end ? (out.points = this.toPoints, out.clipRange = 1) : (out.points = this.fromPoints, out.clipRange = this.clipRange - (this.clipRange - this.shrinkClipRange) * ratio));
34642
+ applyAnimationTransientAttributes(this.target, {
34643
+ clipRange: this.clipRange + (1 - this.clipRange) * ratio
34644
+ });
34645
+ }
34646
+ if (this.segmentsCache && this.to.segments) {
34647
+ let start = 0;
34648
+ const segments = this.to.segments.map((segment, index) => {
34649
+ const end = start + this.segmentsCache[index],
34650
+ points = this.points.slice(start, end);
34651
+ return start = end, Object.assign(Object.assign({}, segment), {
34652
+ points: points
34653
+ });
34654
+ });
34655
+ this.applyPointTransientAttributes({
34656
+ segments: segments
34540
34657
  });
34658
+ } else this.applyPointTransientAttributes({
34659
+ points: this.points
34541
34660
  });
34542
- this.target.attribute.segments = segments;
34543
- } else this.target.attribute.points = this.points;
34544
- this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34661
+ }
34545
34662
  }
34546
34663
  }
34547
34664
 
@@ -34562,10 +34679,10 @@
34562
34679
  }), null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && applyAppearStartAttributes(this.target, from);
34563
34680
  }
34564
34681
  onUpdate(end, ratio, out) {
34565
- const attribute = this.target.attribute;
34682
+ const attrs = {};
34566
34683
  this.propKeys.forEach(key => {
34567
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34568
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34684
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34685
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34569
34686
  }
34570
34687
  }
34571
34688
  class CommonOut extends ACustomAnimate {
@@ -34580,16 +34697,16 @@
34580
34697
  this.keys.forEach(key => {
34581
34698
  var _a;
34582
34699
  to[key] = 0, from[key] = null !== (_a = attrs[key]) && void 0 !== _a ? _a : 1;
34583
- }), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, Object.assign(this.target.attribute, from), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
34700
+ }), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, applyAnimationTransientAttributes(this.target, from, exports.AttributeUpdateType.ANIMATE_BIND), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
34584
34701
  }
34585
34702
  onEnd(cb) {
34586
34703
  super.onEnd(cb);
34587
34704
  }
34588
34705
  onUpdate(end, ratio, out) {
34589
- const attribute = this.target.attribute;
34706
+ const attrs = {};
34590
34707
  this.propKeys.forEach(key => {
34591
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34592
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34708
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34709
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34593
34710
  }
34594
34711
  }
34595
34712
 
@@ -34632,8 +34749,7 @@
34632
34749
  onEnd() {}
34633
34750
  onUpdate(end, ratio, out) {
34634
34751
  if (null == this.phi || null == this.theta) return;
34635
- const target = this.target,
34636
- {
34752
+ const {
34637
34753
  center: center,
34638
34754
  r: r,
34639
34755
  cb: cb
@@ -34644,8 +34760,15 @@
34644
34760
  x = r * Math.sin(phi) * Math.cos(theta) + center.x,
34645
34761
  y = r * Math.cos(phi) + center.y,
34646
34762
  z = r * Math.sin(phi) * Math.sin(theta) + center.z;
34647
- for (target.attribute.x = x, target.attribute.y = y, target.attribute.z = z, target.attribute.alpha = theta + pi / 2; target.attribute.alpha > pi2;) target.attribute.alpha -= pi2;
34648
- target.attribute.alpha = pi2 - target.attribute.alpha, target.attribute.zIndex = -1e4 * target.attribute.z, cb && cb(out);
34763
+ let alpha = theta + pi / 2;
34764
+ for (; alpha > pi2;) alpha -= pi2;
34765
+ alpha = pi2 - alpha, applyAnimationFrameAttributes(this.target, {
34766
+ x: x,
34767
+ y: y,
34768
+ z: z,
34769
+ alpha: alpha,
34770
+ zIndex: -1e4 * z
34771
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag(), cb && cb(out);
34649
34772
  }
34650
34773
  }
34651
34774
 
@@ -34787,15 +34910,23 @@
34787
34910
  this.propKeys ? this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : "startAngle" === this.propKeys[0] ? this._updateFunction = this.updateStartAngle : "endAngle" === this.propKeys[0] ? this._updateFunction = this.updateEndAngle : this.valid = !1 : this.valid = !1;
34788
34911
  }
34789
34912
  deleteSelfAttr(key) {
34790
- delete this.props[key], this.fromProps && delete this.fromProps[key];
34791
- const index = this.propKeys.indexOf(key);
34792
- -1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : "startAngle" === this.propKeys[0] ? this._updateFunction = this.updateStartAngle : "endAngle" === this.propKeys[0] ? this._updateFunction = this.updateEndAngle : this._updateFunction = null;
34913
+ this.deleteSelfAttrs([key]);
34914
+ }
34915
+ deleteSelfAttrs(keys) {
34916
+ var _a;
34917
+ super.deleteSelfAttrs(keys);
34918
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
34919
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : this._updateFunction = "startAngle" === firstKey ? this.updateStartAngle : "endAngle" === firstKey ? this.updateEndAngle : null;
34793
34920
  }
34794
34921
  updateStartAngle(ratio) {
34795
- this.target.attribute.startAngle = this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
34922
+ applyAnimationFrameAttributes(this.target, {
34923
+ startAngle: this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio
34924
+ });
34796
34925
  }
34797
34926
  updateEndAngle(ratio) {
34798
- this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
34927
+ applyAnimationFrameAttributes(this.target, {
34928
+ endAngle: this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio
34929
+ });
34799
34930
  }
34800
34931
  updateAngle(ratio) {
34801
34932
  this.updateStartAngle(ratio), this.updateEndAngle(ratio);
@@ -34969,10 +35100,10 @@
34969
35100
  super.onEnd(cb);
34970
35101
  }
34971
35102
  onUpdate(end, ratio, out) {
34972
- const attribute = this.target.attribute;
35103
+ const attrs = {};
34973
35104
  this.propKeys.forEach(key => {
34974
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34975
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35105
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35106
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34976
35107
  }
34977
35108
  }
34978
35109
  class GrowCenterOut extends ACustomAnimate {
@@ -34991,10 +35122,10 @@
34991
35122
  super.onEnd(cb);
34992
35123
  }
34993
35124
  onUpdate(end, ratio, out) {
34994
- const attribute = this.target.attribute;
35125
+ const attrs = {};
34995
35126
  this.propKeys.forEach(key => {
34996
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34997
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35127
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35128
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34998
35129
  }
34999
35130
  }
35000
35131
 
@@ -35074,10 +35205,10 @@
35074
35205
  super.onEnd(cb);
35075
35206
  }
35076
35207
  onUpdate(end, ratio, out) {
35077
- const attribute = this.target.attribute;
35208
+ const attrs = {};
35078
35209
  this.propKeys.forEach(key => {
35079
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35080
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35210
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35211
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35081
35212
  }
35082
35213
  }
35083
35214
  function growHeightOutIndividual(graphic, options, animationParameters) {
@@ -35135,10 +35266,10 @@
35135
35266
  super.onEnd(cb);
35136
35267
  }
35137
35268
  onUpdate(end, ratio, out) {
35138
- const attribute = this.target.attribute;
35269
+ const attrs = {};
35139
35270
  this.propKeys.forEach(key => {
35140
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35141
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35271
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35272
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35142
35273
  }
35143
35274
  }
35144
35275
 
@@ -35171,7 +35302,9 @@
35171
35302
  var _a, _b;
35172
35303
  const fromPoints = null === (_a = this.from) || void 0 === _a ? void 0 : _a.points,
35173
35304
  toPoints = null === (_b = this.to) || void 0 === _b ? void 0 : _b.points;
35174
- fromPoints && toPoints && (this.target.attribute.points = fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio)), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
35305
+ fromPoints && toPoints && (applyAnimationFrameAttributes(this.target, {
35306
+ points: fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio))
35307
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
35175
35308
  }
35176
35309
  }
35177
35310
  class GrowPointsIn extends GworPointsBase {
@@ -35403,10 +35536,10 @@
35403
35536
  super(from, to, duration, easing, params);
35404
35537
  }
35405
35538
  onUpdate(end, ratio, out) {
35406
- const attribute = this.target.attribute;
35539
+ const attrs = {};
35407
35540
  this.propKeys.forEach(key => {
35408
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35409
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35541
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35542
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35410
35543
  }
35411
35544
  }
35412
35545
  class GrowRadiusIn extends GrowPointsBase {
@@ -35546,10 +35679,10 @@
35546
35679
  super.onEnd(cb);
35547
35680
  }
35548
35681
  onUpdate(end, ratio, out) {
35549
- const attribute = this.target.attribute;
35682
+ const attrs = {};
35550
35683
  this.propKeys.forEach(key => {
35551
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35552
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35684
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35685
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35553
35686
  }
35554
35687
  }
35555
35688
  class GrowWidthOut extends ACustomAnimate {
@@ -35569,10 +35702,10 @@
35569
35702
  super.onEnd(cb);
35570
35703
  }
35571
35704
  onUpdate(end, ratio, out) {
35572
- const attribute = this.target.attribute;
35705
+ const attrs = {};
35573
35706
  this.propKeys.forEach(key => {
35574
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35575
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35707
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35708
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35576
35709
  }
35577
35710
  }
35578
35711
 
@@ -36345,18 +36478,26 @@
36345
36478
  super.onEnd(cb);
36346
36479
  }
36347
36480
  updateX(ratio) {
36348
- this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
36481
+ this.applyScaleTransientAttrs(ratio, !0, !1);
36349
36482
  }
36350
36483
  updateY(ratio) {
36351
- this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
36484
+ this.applyScaleTransientAttrs(ratio, !1, !0);
36352
36485
  }
36353
36486
  updateXY(ratio) {
36354
- this.updateX(ratio), this.updateY(ratio);
36487
+ this.applyScaleTransientAttrs(ratio, !0, !0);
36488
+ }
36489
+ applyScaleTransientAttrs(ratio, scaleX, scaleY) {
36490
+ const attrs = {};
36491
+ scaleX && (attrs.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio), scaleY && (attrs.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio), applyAnimationFrameAttributes(this.target, attrs);
36355
36492
  }
36356
36493
  deleteSelfAttr(key) {
36357
- delete this.props[key], this.fromProps && delete this.fromProps[key];
36358
- const index = this.propKeys.indexOf(key);
36359
- -1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : "scaleX" === this.propKeys[0] ? this._updateFunction = this.updateX : "scaleY" === this.propKeys[0] ? this._updateFunction = this.updateY : this._updateFunction = null;
36494
+ this.deleteSelfAttrs([key]);
36495
+ }
36496
+ deleteSelfAttrs(keys) {
36497
+ var _a;
36498
+ super.deleteSelfAttrs(keys);
36499
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
36500
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : this._updateFunction = "scaleX" === firstKey ? this.updateX : "scaleY" === firstKey ? this.updateY : null;
36360
36501
  }
36361
36502
  onUpdate(end, ratio, out) {
36362
36503
  this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag());
@@ -36401,10 +36542,10 @@
36401
36542
  super.onEnd(cb);
36402
36543
  }
36403
36544
  onUpdate(end, ratio, out) {
36404
- const attribute = this.target.attribute;
36545
+ const attrs = {};
36405
36546
  this.propKeys.forEach(key => {
36406
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36407
- }), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
36547
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36548
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
36408
36549
  }
36409
36550
  }
36410
36551
 
@@ -36415,14 +36556,19 @@
36415
36556
  update(end, ratio, out) {
36416
36557
  if (this.onStart(), !this.props || !this.propKeys) return;
36417
36558
  const easedRatio = this.easing(ratio);
36418
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
36419
- if (!this.animate.validAttr(this.propKeys[index])) return;
36420
- const key = this.propKeys[index];
36421
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
36422
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
36559
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
36423
36560
  }
36424
36561
  }
36425
36562
 
36563
+ function buildInterpolatedAttrs(keys, from, to, ratio) {
36564
+ const attrs = {};
36565
+ return keys.forEach(key => {
36566
+ attrs[key] = from[key] + (to[key] - from[key]) * ratio;
36567
+ }), attrs;
36568
+ }
36569
+ function applyStoryFrame(target, attrs) {
36570
+ applyAnimationFrameAttributes(target, attrs), target.addUpdatePositionTag(), target.addUpdateShapeAndBoundsTag();
36571
+ }
36426
36572
  class SlideIn extends ACustomAnimate {
36427
36573
  constructor(from, to, duration, easing, params) {
36428
36574
  super(from, to, duration, easing, params);
@@ -36445,10 +36591,7 @@
36445
36591
  "top" === direction ? (from.y = (null !== (_e = attrs.y) && void 0 !== _e ? _e : 0) - distance, to.y = null !== (_f = attrs.y) && void 0 !== _f ? _f : 0, this.propKeys = ["opacity", "baseOpacity", "y"]) : "bottom" === direction ? (from.y = (null !== (_g = attrs.y) && void 0 !== _g ? _g : 0) + distance, to.y = null !== (_h = attrs.y) && void 0 !== _h ? _h : 0, this.propKeys = ["opacity", "baseOpacity", "y"]) : "left" === direction ? (from.x = (null !== (_j = attrs.x) && void 0 !== _j ? _j : 0) - distance, to.x = null !== (_k = attrs.x) && void 0 !== _k ? _k : 0, this.propKeys = ["opacity", "baseOpacity", "x"]) : (from.x = (null !== (_l = attrs.x) && void 0 !== _l ? _l : 0) + distance, to.x = null !== (_m = attrs.x) && void 0 !== _m ? _m : 0, this.propKeys = ["opacity", "baseOpacity", "x"]), this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
36446
36592
  }
36447
36593
  onUpdate(end, ratio, out) {
36448
- const attribute = this.target.attribute;
36449
- this.propKeys.forEach(key => {
36450
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36451
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36594
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36452
36595
  }
36453
36596
  }
36454
36597
  class GrowIn extends ACustomAnimate {
@@ -36473,10 +36616,7 @@
36473
36616
  this.propKeys = ["opacity", "baseOpacity"], "x" !== direction && "xy" !== direction || (from.scaleX = fromScale, to.scaleX = null !== (_f = attrs.scaleX) && void 0 !== _f ? _f : 1, this.propKeys.push("scaleX")), "y" !== direction && "xy" !== direction || (from.scaleY = fromScale, to.scaleY = null !== (_g = attrs.scaleY) && void 0 !== _g ? _g : 1, this.propKeys.push("scaleY")), this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
36474
36617
  }
36475
36618
  onUpdate(end, ratio, out) {
36476
- const attribute = this.target.attribute;
36477
- this.propKeys.forEach(key => {
36478
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36479
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36619
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36480
36620
  }
36481
36621
  }
36482
36622
  class SpinIn extends ACustomAnimate {
@@ -36507,10 +36647,7 @@
36507
36647
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
36508
36648
  }
36509
36649
  onUpdate(end, ratio, out) {
36510
- const attribute = this.target.attribute;
36511
- this.propKeys.forEach(key => {
36512
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36513
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36650
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36514
36651
  }
36515
36652
  }
36516
36653
  class StrokeIn extends ACustomAnimate {
@@ -36555,8 +36692,10 @@
36555
36692
  }
36556
36693
  onUpdate(end, ratio, out) {
36557
36694
  var _a;
36558
- const attribute = this.target.attribute;
36559
- attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio, (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio);
36695
+ const attrs = {
36696
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
36697
+ };
36698
+ (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attrs.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio), applyAnimationTransientAttributes(this.target, attrs);
36560
36699
  }
36561
36700
  onEnd() {
36562
36701
  var _a;
@@ -36607,8 +36746,10 @@
36607
36746
  }
36608
36747
  onUpdate(end, ratio, out) {
36609
36748
  var _a;
36610
- const attribute = this.target.attribute;
36611
- attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio, (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio);
36749
+ const attrs = {
36750
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
36751
+ };
36752
+ (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attrs.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio), applyAnimationTransientAttributes(this.target, attrs);
36612
36753
  }
36613
36754
  }
36614
36755
  class MoveScaleIn extends ACustomAnimate {
@@ -36705,10 +36846,7 @@
36705
36846
  "top" === direction ? (from.y = null !== (_g = attrs.y) && void 0 !== _g ? _g : 0, to.y = (null !== (_h = attrs.y) && void 0 !== _h ? _h : 0) - distance, this.propKeys = ["opacity", "baseOpacity", "y"]) : "bottom" === direction ? (from.y = null !== (_j = attrs.y) && void 0 !== _j ? _j : 0, to.y = (null !== (_k = attrs.y) && void 0 !== _k ? _k : 0) + distance, this.propKeys = ["opacity", "baseOpacity", "y"]) : "left" === direction ? (from.x = null !== (_l = attrs.x) && void 0 !== _l ? _l : 0, to.x = (null !== (_m = attrs.x) && void 0 !== _m ? _m : 0) - distance, this.propKeys = ["opacity", "baseOpacity", "x"]) : (from.x = null !== (_o = attrs.x) && void 0 !== _o ? _o : 0, to.x = (null !== (_p = attrs.x) && void 0 !== _p ? _p : 0) + distance, this.propKeys = ["opacity", "baseOpacity", "x"]), this.from = from, this.to = to, this.props = to;
36706
36847
  }
36707
36848
  onUpdate(end, ratio, out) {
36708
- const attribute = this.target.attribute;
36709
- this.propKeys.forEach(key => {
36710
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36711
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36849
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36712
36850
  }
36713
36851
  }
36714
36852
  class GrowOut extends ACustomAnimate {
@@ -36733,10 +36871,7 @@
36733
36871
  this.propKeys = ["opacity", "baseOpacity"], "x" !== direction && "xy" !== direction || (from.scaleX = null !== (_h = attrs.scaleX) && void 0 !== _h ? _h : 1, to.scaleX = toScale, this.propKeys.push("scaleX")), "y" !== direction && "xy" !== direction || (from.scaleY = null !== (_j = attrs.scaleY) && void 0 !== _j ? _j : 1, to.scaleY = toScale, this.propKeys.push("scaleY")), this.from = from, this.to = to, this.props = to;
36734
36872
  }
36735
36873
  onUpdate(end, ratio, out) {
36736
- const attribute = this.target.attribute;
36737
- this.propKeys.forEach(key => {
36738
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36739
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36874
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36740
36875
  }
36741
36876
  }
36742
36877
  class SpinOut extends ACustomAnimate {
@@ -36767,10 +36902,7 @@
36767
36902
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to;
36768
36903
  }
36769
36904
  onUpdate(end, ratio, out) {
36770
- const attribute = this.target.attribute;
36771
- this.propKeys.forEach(key => {
36772
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36773
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36905
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36774
36906
  }
36775
36907
  }
36776
36908
  class MoveScaleOut extends ACustomAnimate {
@@ -36855,20 +36987,20 @@
36855
36987
  onUpdate(end, ratio, out) {
36856
36988
  const angle = ratio * Math.PI * this.pulseCount,
36857
36989
  pulseValue = Math.abs(Math.sin(angle)),
36858
- attribute = this.target.attribute;
36990
+ attrs = {};
36859
36991
  if (this.useOpacity) {
36860
36992
  const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
36861
- this.useStroke && (attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
36993
+ this.useStroke && (attrs.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attrs.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
36862
36994
  }
36863
36995
  if (this.useScale) {
36864
36996
  const scale = 1 + (this.pulseScale - 1) * pulseValue;
36865
- attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale, attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
36997
+ attrs.scaleX = (this.originalAttributes.scaleX || 1) * scale, attrs.scaleY = (this.originalAttributes.scaleY || 1) * scale;
36866
36998
  }
36867
- this.useColor && this.pulseColor && this.applyColorPulse(attribute, pulseValue), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
36999
+ this.useColor && this.pulseColor && this.applyColorPulse(attrs, pulseValue), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
36868
37000
  }
36869
- applyColorPulse(attribute, pulseValue) {
37001
+ applyColorPulse(attrs, pulseValue) {
36870
37002
  const colorRatio = this.pulseColorIntensity * pulseValue;
36871
- this.useFill && this.originalFill && this.pulseColor && (attribute.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, !0)), this.useStroke && this.originalStroke && this.pulseColor && (attribute.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, !0));
37003
+ this.useFill && this.originalFill && this.pulseColor && (attrs.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, !0)), this.useStroke && this.originalStroke && this.pulseColor && (attrs.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, !0));
36872
37004
  }
36873
37005
  onEnd() {
36874
37006
  super.onEnd(), this.target.setAttributes(this.originalAttributes);
@@ -36883,52 +37015,52 @@
36883
37015
  width: !0,
36884
37016
  height: !0
36885
37017
  };
37018
+ function includesChannel(channels, key) {
37019
+ for (let i = 0; i < channels.length; i++) if (channels[i] === key) return !0;
37020
+ return !1;
37021
+ }
37022
+ function filterExcludedChannels(diffAttrs, excludeChannels) {
37023
+ if (!(null == excludeChannels ? void 0 : excludeChannels.length)) return diffAttrs;
37024
+ const nextAttrs = {};
37025
+ for (const key in diffAttrs) Object.prototype.hasOwnProperty.call(diffAttrs, key) && !includesChannel(excludeChannels, key) && (nextAttrs[key] = diffAttrs[key]);
37026
+ return nextAttrs;
37027
+ }
36886
37028
  class Update extends ACustomAnimate {
36887
37029
  constructor(from, to, duration, easing, params) {
36888
- super(from, to, duration, easing, params), this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
37030
+ super(from, to, duration, easing, params), this.updateFromAttrs = null, this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
36889
37031
  }
36890
37032
  onBind() {
36891
- var _a, _b;
37033
+ var _a;
36892
37034
  super.onBind();
37035
+ const targetContext = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
36893
37036
  let {
36894
37037
  diffAttrs = {}
36895
- } = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
37038
+ } = targetContext;
36896
37039
  const {
36897
- options: options
36898
- } = this.params;
36899
- diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
36900
- delete diffAttrs[channel];
36901
- }), this.props = diffAttrs, this.clipPathSyncKeys = Object.keys(diffAttrs).filter(key => clipPathGeometryAttrs[key]), this.clipPathSyncDisabled = !this.clipPathSyncKeys.length, this.syncParentClipPathToTarget();
37040
+ options: options
37041
+ } = this.params,
37042
+ rawDiffAttrs = diffAttrs;
37043
+ diffAttrs = filterExcludedChannels(diffAttrs, null == options ? void 0 : options.excludeChannels), this.props = diffAttrs;
37044
+ const consumeTransientFromAttrs = this.target.consumeTransientFromAttrsBeforePreventAnimate;
37045
+ this.updateFromAttrs = "function" == typeof consumeTransientFromAttrs ? consumeTransientFromAttrs.call(this.target, rawDiffAttrs, diffAttrs) : null, this.clipPathSyncKeys = Object.keys(diffAttrs).filter(key => clipPathGeometryAttrs[key]), this.clipPathSyncDisabled = !this.clipPathSyncKeys.length, this.syncParentClipPathToTarget();
36902
37046
  }
36903
- getStaticCommitAttrs() {
36904
- var _a;
36905
- if (!this.props) return null;
36906
- const target = this.target,
36907
- contextFinalAttrs = null === (_a = target.context) || void 0 === _a ? void 0 : _a.finalAttrs,
36908
- finalAttribute = "function" == typeof target.getFinalAttribute ? target.getFinalAttribute() : target.finalAttribute,
36909
- commitAttrs = {};
36910
- return Object.keys(this.props).forEach(key => {
36911
- contextFinalAttrs && Object.prototype.hasOwnProperty.call(contextFinalAttrs, key) ? commitAttrs[key] = contextFinalAttrs[key] : finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, key) ? commitAttrs[key] = finalAttribute[key] : this.animate.validAttr(key) && (commitAttrs[key] = this.props[key]);
36912
- }), Object.keys(commitAttrs).length ? commitAttrs : null;
37047
+ trySyncStartProps() {
37048
+ const updateFromAttrs = this.updateFromAttrs;
37049
+ this.propKeys.forEach(key => {
37050
+ this.fromProps[key] = updateFromAttrs && Object.prototype.hasOwnProperty.call(updateFromAttrs, key) ? updateFromAttrs[key] : this.animate.target.getComputedAttribute(key);
37051
+ });
36913
37052
  }
36914
37053
  onEnd(cb) {
36915
- if (cb) return void super.onEnd(cb);
36916
- const commitAttrs = this.getStaticCommitAttrs();
36917
- commitAttrs && this.target.setAttributes(commitAttrs, !1, {
36918
- type: exports.AttributeUpdateType.ANIMATE_END
36919
- }), this.syncParentClipPathToTarget(), super.onEnd();
37054
+ var _a;
37055
+ cb ? super.onEnd(cb) : (this.props && commitAnimationStaticAttrs(this.target, null !== (_a = this.propKeys) && void 0 !== _a ? _a : Object.keys(this.props), this.animate, this.props), this.syncParentClipPathToTarget(), super.onEnd());
36920
37056
  }
36921
37057
  update(end, ratio, out) {
36922
37058
  if (this.onStart(), !this.props || !this.propKeys) return;
36923
37059
  const easedRatio = this.easing(ratio);
36924
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
36925
- if (!this.animate.validAttr(this.propKeys[index])) return;
36926
- const key = this.propKeys[index];
36927
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
36928
- }), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
37060
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
36929
37061
  }
36930
37062
  syncParentClipPathToTarget() {
36931
- var _a, _b;
37063
+ var _a, _b, _c, _d;
36932
37064
  if (this.clipPathSyncDisabled) return;
36933
37065
  const target = this.target,
36934
37066
  parent = target.parent,
@@ -36939,7 +37071,7 @@
36939
37071
  const clipGraphic = path[childIndex];
36940
37072
  if (!(null == clipGraphic ? void 0 : clipGraphic.attribute) || clipGraphic.type !== target.type || !this.isClipPathStaticTarget(clipGraphic)) return;
36941
37073
  const syncAttrs = this.buildClipPathTransientAttrs(clipGraphic);
36942
- syncAttrs && applyAnimationTransientAttributes(clipGraphic, syncAttrs, exports.AttributeUpdateType.ANIMATE_UPDATE);
37074
+ syncAttrs && (applyAnimationFrameAttributes(clipGraphic, syncAttrs), null === (_c = clipGraphic.addUpdatePositionTag) || void 0 === _c || _c.call(clipGraphic), null === (_d = clipGraphic.addUpdateShapeAndBoundsTag) || void 0 === _d || _d.call(clipGraphic));
36943
37075
  }
36944
37076
  getClipPathSyncChildIndex(parent) {
36945
37077
  var _a;
@@ -37083,10 +37215,10 @@
37083
37215
  super(from, to, duration, easing, params);
37084
37216
  }
37085
37217
  onUpdate(end, ratio, out) {
37086
- const attribute = this.target.attribute;
37218
+ const attrs = {};
37087
37219
  this.propKeys.forEach(key => {
37088
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37089
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37220
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37221
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37090
37222
  }
37091
37223
  }
37092
37224
  class MoveIn extends MoveBase {
@@ -37142,10 +37274,10 @@
37142
37274
  super(from, to, duration, easing, params);
37143
37275
  }
37144
37276
  onUpdate(end, ratio, out) {
37145
- const attribute = this.target.attribute;
37277
+ const attrs = {};
37146
37278
  this.propKeys.forEach(key => {
37147
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37148
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37279
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37280
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37149
37281
  }
37150
37282
  }
37151
37283
  class RotateIn extends RotateBase {
@@ -37188,7 +37320,7 @@
37188
37320
  pos: pos,
37189
37321
  angle: angle
37190
37322
  } = this.path.getAttrAt(at);
37191
- attrs.x = pos.x, attrs.y = pos.y, this.changeAngle && (attrs.angle = angle + this.initAngle), this.cb && this.cb(this.from, this.to, ratio, this.target), end && this.commitOnEnd ? this.target.setAttributes(attrs) : applyAnimationTransientAttributes(this.target, attrs);
37323
+ attrs.x = pos.x, attrs.y = pos.y, this.changeAngle && (attrs.angle = angle + this.initAngle), this.cb && this.cb(this.from, this.to, ratio, this.target), end && this.commitOnEnd ? this.target.setAttributes(attrs) : (applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
37192
37324
  }
37193
37325
  }
37194
37326
 
@@ -40941,11 +41073,7 @@
40941
41073
  if (!graphic || !targetAttrs) return;
40942
41074
  const committedTargetAttrs = cloneDeep(targetAttrs),
40943
41075
  transientStartAttrs = cloneDeep(null != startAttrs ? startAttrs : graphic.attribute);
40944
- graphic.setAttributes(committedTargetAttrs);
40945
- const baseAttributes = graphic.baseAttributes;
40946
- baseAttributes && "object" == typeof baseAttributes && Object.keys(committedTargetAttrs).forEach(key => {
40947
- baseAttributes[key] = cloneDeep(committedTargetAttrs[key]);
40948
- }), null === (_b = (_a = graphic).setFinalAttributes) || void 0 === _b || _b.call(_a, committedTargetAttrs), null === (_d = (_c = graphic).setAttributesAndPreventAnimate) || void 0 === _d || _d.call(_c, transientStartAttrs, !1, {
41076
+ graphic.setAttributes(committedTargetAttrs), null === (_b = (_a = graphic).setFinalAttributes) || void 0 === _b || _b.call(_a, committedTargetAttrs), null === (_d = (_c = graphic).setAttributesAndPreventAnimate) || void 0 === _d || _d.call(_c, transientStartAttrs, !1, {
40949
41077
  type: exports.AttributeUpdateType.ANIMATE_BIND
40950
41078
  });
40951
41079
  }
@@ -41685,7 +41813,10 @@
41685
41813
  }), this.completeBind(animator);
41686
41814
  }
41687
41815
  deleteSelfAttr(key) {
41688
- super.deleteSelfAttr(key), this._animator.deleteSelfAttr(key);
41816
+ this.deleteSelfAttrs([key]);
41817
+ }
41818
+ deleteSelfAttrs(keys) {
41819
+ super.deleteSelfAttrs(keys), this._animator.deleteSelfAttrs(keys);
41689
41820
  }
41690
41821
  tryPreventConflict() {}
41691
41822
  }
@@ -54543,7 +54674,7 @@
54543
54674
  return resolveLegacyApp().createStage(params);
54544
54675
  }
54545
54676
 
54546
- const version = "1.1.0-alpha.11";
54677
+ const version = "1.1.0-alpha.13";
54547
54678
 
54548
54679
  exports.AComponentAnimate = AComponentAnimate;
54549
54680
  exports.ACustomAnimate = ACustomAnimate;