@visactor/vrender-animate 1.0.0-alpha.2 → 1.0.0-alpha.21
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/cjs/animate-extension.d.ts +3 -2
- package/cjs/animate-extension.js +5 -2
- package/cjs/animate-extension.js.map +1 -1
- package/cjs/animate.d.ts +1 -0
- package/cjs/animate.js +8 -5
- package/cjs/animate.js.map +1 -1
- package/cjs/config/morphing.d.ts +2 -0
- package/cjs/config/morphing.js +9 -0
- package/cjs/config/morphing.js.map +1 -0
- package/cjs/custom/clip-graphic.js +1 -1
- package/cjs/custom/clip-graphic.js.map +1 -1
- package/cjs/custom/clip.d.ts +1 -0
- package/cjs/custom/clip.js +9 -1
- package/cjs/custom/clip.js.map +1 -1
- package/cjs/custom/common.d.ts +0 -1
- package/cjs/custom/common.js +6 -9
- package/cjs/custom/common.js.map +1 -1
- package/cjs/custom/fade.js +7 -2
- package/cjs/custom/fade.js.map +1 -1
- package/cjs/custom/{from-to.js → fromTo.js} +6 -9
- package/cjs/custom/fromTo.js.map +1 -0
- package/cjs/custom/{group-fade.js → groupFade.js} +4 -3
- package/cjs/custom/groupFade.js.map +1 -0
- package/cjs/custom/growAngle.js +3 -2
- package/cjs/custom/growAngle.js.map +1 -1
- package/cjs/custom/growCenter.js +1 -1
- package/cjs/custom/growCenter.js.map +1 -1
- package/cjs/custom/growHeight.js +5 -5
- package/cjs/custom/growHeight.js.map +1 -1
- package/cjs/custom/growPoints.js +22 -21
- package/cjs/custom/growPoints.js.map +1 -1
- package/cjs/custom/growRadius.js +1 -1
- package/cjs/custom/growRadius.js.map +1 -1
- package/cjs/custom/growWidth.js +1 -1
- package/cjs/custom/growWidth.js.map +1 -1
- package/cjs/custom/morphing.d.ts +51 -0
- package/cjs/custom/morphing.js +298 -0
- package/cjs/custom/morphing.js.map +1 -0
- package/cjs/custom/motionPath.d.ts +21 -0
- package/cjs/custom/motionPath.js +31 -0
- package/cjs/custom/motionPath.js.map +1 -0
- package/cjs/custom/move.d.ts +4 -0
- package/cjs/custom/move.js +11 -11
- package/cjs/custom/move.js.map +1 -1
- package/cjs/custom/register.d.ts +27 -0
- package/cjs/custom/register.js +394 -4
- package/cjs/custom/register.js.map +1 -1
- package/cjs/custom/richtext/input-richtext.d.ts +4 -2
- package/cjs/custom/richtext/input-richtext.js +20 -10
- package/cjs/custom/richtext/input-richtext.js.map +1 -1
- package/cjs/custom/richtext/slide-richtext.js +1 -1
- package/cjs/custom/rotate.js +2 -1
- package/cjs/custom/rotate.js.map +1 -1
- package/cjs/custom/scale.js +7 -7
- package/cjs/custom/scale.js.map +1 -1
- package/cjs/custom/story.d.ts +68 -0
- package/cjs/custom/story.js +149 -3
- package/cjs/custom/story.js.map +1 -1
- package/cjs/custom/streamLight.d.ts +27 -0
- package/cjs/custom/streamLight.js +161 -0
- package/cjs/custom/streamLight.js.map +1 -0
- package/cjs/custom/tag-points.js +4 -1
- package/cjs/custom/tag-points.js.map +1 -1
- package/cjs/custom/update.js +2 -3
- package/cjs/custom/update.js.map +1 -1
- package/cjs/executor/animate-executor.d.ts +1 -1
- package/cjs/executor/animate-executor.js +69 -63
- package/cjs/executor/animate-executor.js.map +1 -1
- package/cjs/index.d.ts +3 -2
- package/cjs/index.js +34 -14
- package/cjs/index.js.map +1 -1
- package/cjs/state/animation-states-registry.js +18 -0
- package/cjs/state/animation-states-registry.js.map +1 -1
- package/cjs/step.d.ts +2 -0
- package/cjs/step.js +10 -2
- package/cjs/step.js.map +1 -1
- package/cjs/ticker/default-ticker.d.ts +3 -2
- package/cjs/ticker/default-ticker.js +9 -6
- package/cjs/ticker/default-ticker.js.map +1 -1
- package/cjs/ticker/manual-ticker.d.ts +6 -1
- package/cjs/ticker/manual-ticker.js +26 -4
- package/cjs/ticker/manual-ticker.js.map +1 -1
- package/cjs/timeline.d.ts +13 -5
- package/cjs/timeline.js +31 -18
- package/cjs/timeline.js.map +1 -1
- package/cjs/utils/transform.d.ts +2 -0
- package/cjs/utils/transform.js +10 -0
- package/cjs/utils/transform.js.map +1 -0
- package/dist/index.es.js +1374 -186
- package/es/animate-extension.d.ts +3 -2
- package/es/animate-extension.js +5 -2
- package/es/animate-extension.js.map +1 -1
- package/es/animate.d.ts +1 -0
- package/es/animate.js +8 -5
- package/es/animate.js.map +1 -1
- package/es/config/morphing.d.ts +2 -0
- package/es/config/morphing.js +5 -0
- package/es/config/morphing.js.map +1 -0
- package/es/custom/clip-graphic.js +1 -1
- package/es/custom/clip-graphic.js.map +1 -1
- package/es/custom/clip.d.ts +1 -0
- package/es/custom/clip.js +9 -1
- package/es/custom/clip.js.map +1 -1
- package/es/custom/common.d.ts +0 -1
- package/es/custom/common.js +6 -9
- package/es/custom/common.js.map +1 -1
- package/es/custom/fade.js +7 -2
- package/es/custom/fade.js.map +1 -1
- package/es/custom/{from-to.js → fromTo.js} +6 -9
- package/es/custom/fromTo.js.map +1 -0
- package/es/custom/{group-fade.js → groupFade.js} +4 -3
- package/es/custom/groupFade.js.map +1 -0
- package/es/custom/growAngle.js +3 -2
- package/es/custom/growAngle.js.map +1 -1
- package/es/custom/growCenter.js +1 -1
- package/es/custom/growCenter.js.map +1 -1
- package/es/custom/growHeight.js +5 -5
- package/es/custom/growHeight.js.map +1 -1
- package/es/custom/growPoints.js +22 -21
- package/es/custom/growPoints.js.map +1 -1
- package/es/custom/growRadius.js +1 -1
- package/es/custom/growRadius.js.map +1 -1
- package/es/custom/growWidth.js +1 -1
- package/es/custom/growWidth.js.map +1 -1
- package/es/custom/morphing.d.ts +51 -0
- package/es/custom/morphing.js +289 -0
- package/es/custom/morphing.js.map +1 -0
- package/es/custom/motionPath.d.ts +21 -0
- package/es/custom/motionPath.js +23 -0
- package/es/custom/motionPath.js.map +1 -0
- package/es/custom/move.d.ts +4 -0
- package/es/custom/move.js +10 -10
- package/es/custom/move.js.map +1 -1
- package/es/custom/register.d.ts +27 -0
- package/es/custom/register.js +15 -5
- package/es/custom/register.js.map +1 -1
- package/es/custom/richtext/input-richtext.d.ts +4 -2
- package/es/custom/richtext/input-richtext.js +20 -10
- package/es/custom/richtext/input-richtext.js.map +1 -1
- package/es/custom/richtext/slide-richtext.js +1 -1
- package/es/custom/rotate.js +2 -1
- package/es/custom/rotate.js.map +1 -1
- package/es/custom/scale.js +7 -7
- package/es/custom/scale.js.map +1 -1
- package/es/custom/story.d.ts +68 -0
- package/es/custom/story.js +142 -1
- package/es/custom/story.js.map +1 -1
- package/es/custom/streamLight.d.ts +27 -0
- package/es/custom/streamLight.js +157 -0
- package/es/custom/streamLight.js.map +1 -0
- package/es/custom/tag-points.js +4 -1
- package/es/custom/tag-points.js.map +1 -1
- package/es/custom/update.js +2 -3
- package/es/custom/update.js.map +1 -1
- package/es/executor/animate-executor.d.ts +1 -1
- package/es/executor/animate-executor.js +68 -61
- package/es/executor/animate-executor.js.map +1 -1
- package/es/index.d.ts +3 -2
- package/es/index.js +4 -2
- package/es/index.js.map +1 -1
- package/es/state/animation-states-registry.js +18 -0
- package/es/state/animation-states-registry.js.map +1 -1
- package/es/step.d.ts +2 -0
- package/es/step.js +10 -2
- package/es/step.js.map +1 -1
- package/es/ticker/default-ticker.d.ts +3 -2
- package/es/ticker/default-ticker.js +9 -6
- package/es/ticker/default-ticker.js.map +1 -1
- package/es/ticker/manual-ticker.d.ts +6 -1
- package/es/ticker/manual-ticker.js +27 -3
- package/es/ticker/manual-ticker.js.map +1 -1
- package/es/timeline.d.ts +13 -5
- package/es/timeline.js +32 -17
- package/es/timeline.js.map +1 -1
- package/es/utils/transform.d.ts +2 -0
- package/es/utils/transform.js +4 -0
- package/es/utils/transform.js.map +1 -0
- package/package.json +5 -5
- package/cjs/custom/from-to.js.map +0 -1
- package/cjs/custom/group-fade.js.map +0 -1
- package/es/custom/from-to.js.map +0 -1
- package/es/custom/group-fade.js.map +0 -1
- /package/cjs/custom/{from-to.d.ts → fromTo.d.ts} +0 -0
- /package/cjs/custom/{group-fade.d.ts → groupFade.d.ts} +0 -0
- /package/es/custom/{from-to.d.ts → fromTo.d.ts} +0 -0
- /package/es/custom/{group-fade.d.ts → groupFade.d.ts} +0 -0
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { interpolateColor, interpolatePureColorArrayToStr, pointsInterpolation, Generator, ColorStore, ColorType, AnimateStatus, AnimateStepType, PerformanceRAF, STATUS, application, CustomPath2D, CurveContext, Graphic, AttributeUpdateType, pointInterpolation, RichText } from '@visactor/vrender-core';
|
|
2
|
-
import { pi2, isString, EventEmitter, isArray, isFunction, mixin, isValidNumber, clamp, Point, pi, isNumber, isValid,
|
|
1
|
+
import { interpolateColor, interpolatePureColorArrayToStr, pointsInterpolation, Generator, ColorStore, ColorType, AnimateStatus, AnimateStepType, PerformanceRAF, STATUS, application, CustomPath2D, CurveContext, Graphic, splitRect, splitArc, splitCircle, splitLine, splitPolygon, splitArea, splitPath, AttributeUpdateType, pathToBezierCurves, applyTransformOnBezierCurves, alignBezierCurves, findBestMorphingRotation, pointInterpolation, RichText, divideCubic } from '@visactor/vrender-core';
|
|
2
|
+
import { pi2, isString, EventEmitter, isArray, isFunction, mixin, isNil, isValidNumber, clamp, Point, pi, isNumber, isValid, isNumberClose, PointService } from '@visactor/vutils';
|
|
3
3
|
|
|
4
4
|
class Easing {
|
|
5
5
|
constructor() {
|
|
@@ -347,6 +347,7 @@ function noop() {
|
|
|
347
347
|
}
|
|
348
348
|
class Step {
|
|
349
349
|
constructor(type, props, duration, easing) {
|
|
350
|
+
var _a;
|
|
350
351
|
this._startTime = 0;
|
|
351
352
|
this._hasFirstRun = false;
|
|
352
353
|
this._syncAttributeUpdate = () => {
|
|
@@ -356,7 +357,7 @@ class Step {
|
|
|
356
357
|
this.props = props;
|
|
357
358
|
this.duration = duration;
|
|
358
359
|
if (easing) {
|
|
359
|
-
this.easing = typeof easing === 'function' ? easing : Easing[easing];
|
|
360
|
+
this.easing = typeof easing === 'function' ? easing : (_a = Easing[easing]) !== null && _a !== void 0 ? _a : Easing.linear;
|
|
360
361
|
}
|
|
361
362
|
else {
|
|
362
363
|
this.easing = Easing.linear;
|
|
@@ -477,7 +478,7 @@ class Step {
|
|
|
477
478
|
const animate = this.animate;
|
|
478
479
|
const target = this.target;
|
|
479
480
|
target.animates.forEach((a) => {
|
|
480
|
-
if (a === animate || a.priority > animate.priority) {
|
|
481
|
+
if (a === animate || a.priority > animate.priority || a.priority === Infinity) {
|
|
481
482
|
return;
|
|
482
483
|
}
|
|
483
484
|
const fromProps = a.getStartProps();
|
|
@@ -550,6 +551,13 @@ class WaitStep extends Step {
|
|
|
550
551
|
constructor(type, props, duration, easing) {
|
|
551
552
|
super(type, props, duration, easing);
|
|
552
553
|
}
|
|
554
|
+
onStart() {
|
|
555
|
+
super.onStart();
|
|
556
|
+
}
|
|
557
|
+
onFirstRun() {
|
|
558
|
+
const fromProps = this.getFromProps();
|
|
559
|
+
this.target.setAttributes(fromProps);
|
|
560
|
+
}
|
|
553
561
|
update(end, ratio, out) {
|
|
554
562
|
this.onStart();
|
|
555
563
|
}
|
|
@@ -558,34 +566,55 @@ class WaitStep extends Step {
|
|
|
558
566
|
}
|
|
559
567
|
}
|
|
560
568
|
|
|
561
|
-
class DefaultTimeline {
|
|
569
|
+
class DefaultTimeline extends EventEmitter {
|
|
562
570
|
get animateCount() {
|
|
563
|
-
return this.
|
|
571
|
+
return this._animateCount;
|
|
564
572
|
}
|
|
565
573
|
constructor() {
|
|
566
|
-
|
|
574
|
+
super();
|
|
575
|
+
this.head = null;
|
|
576
|
+
this.tail = null;
|
|
577
|
+
this.animateMap = new Map();
|
|
578
|
+
this._animateCount = 0;
|
|
567
579
|
this._playSpeed = 1;
|
|
568
580
|
this._totalDuration = 0;
|
|
569
581
|
this._startTime = 0;
|
|
570
582
|
this._currentTime = 0;
|
|
571
|
-
this._endAnimatePtr = -1;
|
|
572
583
|
this.id = Generator.GenAutoIncrementId();
|
|
573
|
-
this.animates = [];
|
|
574
584
|
this.paused = false;
|
|
575
585
|
}
|
|
576
586
|
isRunning() {
|
|
577
|
-
return !this.paused && this.
|
|
587
|
+
return !this.paused && this._animateCount > 0;
|
|
578
588
|
}
|
|
579
589
|
forEachAccessAnimate(cb) {
|
|
580
|
-
|
|
581
|
-
|
|
590
|
+
let current = this.head;
|
|
591
|
+
let index = 0;
|
|
592
|
+
while (current) {
|
|
593
|
+
const next = current.next;
|
|
594
|
+
cb(current.animate, index);
|
|
595
|
+
index++;
|
|
596
|
+
current = next;
|
|
582
597
|
}
|
|
583
598
|
}
|
|
584
599
|
addAnimate(animate) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
600
|
+
const newNode = {
|
|
601
|
+
animate,
|
|
602
|
+
next: null,
|
|
603
|
+
prev: null
|
|
604
|
+
};
|
|
605
|
+
if (!this.head) {
|
|
606
|
+
this.head = newNode;
|
|
607
|
+
this.tail = newNode;
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
if (this.tail) {
|
|
611
|
+
this.tail.next = newNode;
|
|
612
|
+
newNode.prev = this.tail;
|
|
613
|
+
this.tail = newNode;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
this.animateMap.set(animate, newNode);
|
|
617
|
+
this._animateCount++;
|
|
589
618
|
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
590
619
|
}
|
|
591
620
|
pause() {
|
|
@@ -602,36 +631,57 @@ class DefaultTimeline {
|
|
|
602
631
|
this._currentTime += scaledDelta;
|
|
603
632
|
this.forEachAccessAnimate((animate, i) => {
|
|
604
633
|
if (animate.status === AnimateStatus.END) {
|
|
605
|
-
this.removeAnimate(animate, true
|
|
634
|
+
this.removeAnimate(animate, true);
|
|
606
635
|
}
|
|
607
636
|
else if (animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL) {
|
|
608
637
|
animate.advance(scaledDelta);
|
|
609
638
|
}
|
|
610
639
|
});
|
|
640
|
+
if (this._animateCount === 0) {
|
|
641
|
+
this.emit('animationEnd');
|
|
642
|
+
}
|
|
611
643
|
}
|
|
612
644
|
clear() {
|
|
613
645
|
this.forEachAccessAnimate(animate => {
|
|
614
646
|
animate.release();
|
|
615
647
|
});
|
|
616
|
-
this.
|
|
648
|
+
this.head = null;
|
|
649
|
+
this.tail = null;
|
|
650
|
+
this.animateMap.clear();
|
|
651
|
+
this._animateCount = 0;
|
|
617
652
|
this._totalDuration = 0;
|
|
618
653
|
}
|
|
619
|
-
removeAnimate(animate, release = true
|
|
620
|
-
|
|
654
|
+
removeAnimate(animate, release = true) {
|
|
655
|
+
const node = this.animateMap.get(animate);
|
|
656
|
+
if (!node) {
|
|
621
657
|
return;
|
|
622
658
|
}
|
|
623
659
|
if (release) {
|
|
624
660
|
animate._onRemove && animate._onRemove.forEach(cb => cb());
|
|
625
661
|
animate.release();
|
|
626
662
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
663
|
+
if (node.prev) {
|
|
664
|
+
node.prev.next = node.next;
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
this.head = node.next;
|
|
668
|
+
}
|
|
669
|
+
if (node.next) {
|
|
670
|
+
node.next.prev = node.prev;
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
this.tail = node.prev;
|
|
674
|
+
}
|
|
675
|
+
this.animateMap.delete(animate);
|
|
676
|
+
this._animateCount--;
|
|
677
|
+
if (animate.getStartTime() + animate.getDuration() >= this._totalDuration) {
|
|
678
|
+
this.recalculateTotalDuration();
|
|
679
|
+
}
|
|
630
680
|
return;
|
|
631
681
|
}
|
|
632
682
|
recalculateTotalDuration() {
|
|
633
683
|
this._totalDuration = 0;
|
|
634
|
-
this.
|
|
684
|
+
this.forEachAccessAnimate(animate => {
|
|
635
685
|
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
636
686
|
});
|
|
637
687
|
}
|
|
@@ -885,8 +935,10 @@ class Animate {
|
|
|
885
935
|
step.stop();
|
|
886
936
|
step = step.next;
|
|
887
937
|
}
|
|
938
|
+
if (this.status !== AnimateStatus.END) {
|
|
939
|
+
this.onEnd();
|
|
940
|
+
}
|
|
888
941
|
this.status = AnimateStatus.END;
|
|
889
|
-
this.onEnd();
|
|
890
942
|
if (!this.target) {
|
|
891
943
|
return;
|
|
892
944
|
}
|
|
@@ -957,7 +1009,7 @@ class Animate {
|
|
|
957
1009
|
return this;
|
|
958
1010
|
}
|
|
959
1011
|
advance(delta) {
|
|
960
|
-
var _a;
|
|
1012
|
+
var _a, _b, _c;
|
|
961
1013
|
if (this.status === AnimateStatus.END) {
|
|
962
1014
|
console.warn('aaa 动画已经结束,不能推进');
|
|
963
1015
|
return;
|
|
@@ -968,7 +1020,8 @@ class Animate {
|
|
|
968
1020
|
return;
|
|
969
1021
|
}
|
|
970
1022
|
if (nextTime >= this._startTime + this._totalDuration) {
|
|
971
|
-
(_a = this._lastStep) === null || _a === void 0 ? void 0 : _a.
|
|
1023
|
+
(_a = this._lastStep) === null || _a === void 0 ? void 0 : _a.onUpdate(true, 1, {});
|
|
1024
|
+
(_b = this._lastStep) === null || _b === void 0 ? void 0 : _b.onEnd();
|
|
972
1025
|
this.onEnd();
|
|
973
1026
|
this.status = AnimateStatus.END;
|
|
974
1027
|
return;
|
|
@@ -1014,6 +1067,10 @@ class Animate {
|
|
|
1014
1067
|
if (!targetStep) {
|
|
1015
1068
|
return;
|
|
1016
1069
|
}
|
|
1070
|
+
if (targetStep !== this.lastRunStep) {
|
|
1071
|
+
(_c = this.lastRunStep) === null || _c === void 0 ? void 0 : _c.onEnd();
|
|
1072
|
+
}
|
|
1073
|
+
this.lastRunStep = targetStep;
|
|
1017
1074
|
const stepStartTime = targetStep.getStartTime();
|
|
1018
1075
|
const stepDuration = targetStep.getDuration();
|
|
1019
1076
|
const ratio = (cycleTime - stepStartTime) / stepDuration;
|
|
@@ -1021,6 +1078,7 @@ class Animate {
|
|
|
1021
1078
|
targetStep.update(isEnd, ratio, {});
|
|
1022
1079
|
if (isEnd) {
|
|
1023
1080
|
targetStep.onEnd();
|
|
1081
|
+
this.lastRunStep = null;
|
|
1024
1082
|
}
|
|
1025
1083
|
}
|
|
1026
1084
|
updateDuration() {
|
|
@@ -1064,13 +1122,6 @@ class DefaultTicker extends EventEmitter {
|
|
|
1064
1122
|
super();
|
|
1065
1123
|
this.timelines = [];
|
|
1066
1124
|
this.frameTimeHistory = [];
|
|
1067
|
-
this.checkSkip = (delta) => {
|
|
1068
|
-
if (this.stage.params.optimize.tickRenderMode === 'performance') {
|
|
1069
|
-
return false;
|
|
1070
|
-
}
|
|
1071
|
-
const skip = delta < this.interval + (Math.random() - 0.5) * 2 * this._jitter;
|
|
1072
|
-
return skip;
|
|
1073
|
-
};
|
|
1074
1125
|
this.handleTick = (handler, params) => {
|
|
1075
1126
|
const { once = false } = params !== null && params !== void 0 ? params : {};
|
|
1076
1127
|
if (this.ifCanStop()) {
|
|
@@ -1113,6 +1164,9 @@ class DefaultTicker extends EventEmitter {
|
|
|
1113
1164
|
this.interval = 16;
|
|
1114
1165
|
this.computeTimeOffsetAndJitter();
|
|
1115
1166
|
}
|
|
1167
|
+
bindStage(stage) {
|
|
1168
|
+
this.stage = stage;
|
|
1169
|
+
}
|
|
1116
1170
|
computeTimeOffsetAndJitter() {
|
|
1117
1171
|
this.timeOffset = Math.floor(Math.random() * this.interval);
|
|
1118
1172
|
this._jitter = Math.min(Math.max(this.interval * 0.2, 6), this.interval * 0.7);
|
|
@@ -1238,19 +1292,25 @@ class DefaultTicker extends EventEmitter {
|
|
|
1238
1292
|
this.tickerHandler = null;
|
|
1239
1293
|
this.lastFrameTime = -1;
|
|
1240
1294
|
}
|
|
1295
|
+
checkSkip(delta) {
|
|
1296
|
+
if (this.stage.params.optimize.tickRenderMode === 'performance') {
|
|
1297
|
+
return false;
|
|
1298
|
+
}
|
|
1299
|
+
const skip = delta < this.interval + (Math.random() - 0.5) * 2 * this._jitter;
|
|
1300
|
+
return skip;
|
|
1301
|
+
}
|
|
1241
1302
|
}
|
|
1242
1303
|
|
|
1243
1304
|
class ManualTickHandler {
|
|
1244
1305
|
constructor() {
|
|
1245
1306
|
this.released = false;
|
|
1246
|
-
this.startTime = -1;
|
|
1247
1307
|
this.currentTime = -1;
|
|
1248
1308
|
}
|
|
1249
1309
|
tick(interval, cb) {
|
|
1250
|
-
if (this.
|
|
1251
|
-
this.
|
|
1310
|
+
if (this.currentTime < 0) {
|
|
1311
|
+
this.currentTime = 0;
|
|
1252
1312
|
}
|
|
1253
|
-
this.currentTime
|
|
1313
|
+
this.currentTime += interval;
|
|
1254
1314
|
cb(this);
|
|
1255
1315
|
}
|
|
1256
1316
|
release() {
|
|
@@ -1259,8 +1319,20 @@ class ManualTickHandler {
|
|
|
1259
1319
|
getTime() {
|
|
1260
1320
|
return this.currentTime;
|
|
1261
1321
|
}
|
|
1322
|
+
tickTo(time, cb) {
|
|
1323
|
+
if (this.currentTime < 0) {
|
|
1324
|
+
this.currentTime = 0;
|
|
1325
|
+
}
|
|
1326
|
+
const interval = time - this.currentTime;
|
|
1327
|
+
this.tick(interval, cb);
|
|
1328
|
+
}
|
|
1262
1329
|
}
|
|
1263
1330
|
class ManualTicker extends DefaultTicker {
|
|
1331
|
+
constructor(stage) {
|
|
1332
|
+
super(stage);
|
|
1333
|
+
this.lastFrameTime = 0;
|
|
1334
|
+
this.status = STATUS.RUNNING;
|
|
1335
|
+
}
|
|
1264
1336
|
setupTickHandler() {
|
|
1265
1337
|
const handler = new ManualTickHandler();
|
|
1266
1338
|
if (this.tickerHandler) {
|
|
@@ -1269,9 +1341,33 @@ class ManualTicker extends DefaultTicker {
|
|
|
1269
1341
|
this.tickerHandler = handler;
|
|
1270
1342
|
return true;
|
|
1271
1343
|
}
|
|
1344
|
+
checkSkip(delta) {
|
|
1345
|
+
return false;
|
|
1346
|
+
}
|
|
1272
1347
|
getTime() {
|
|
1273
1348
|
return this.tickerHandler.getTime();
|
|
1274
1349
|
}
|
|
1350
|
+
tickAt(time) {
|
|
1351
|
+
this.tickTo(time);
|
|
1352
|
+
}
|
|
1353
|
+
start(force = false) {
|
|
1354
|
+
if (this.status === STATUS.RUNNING) {
|
|
1355
|
+
return false;
|
|
1356
|
+
}
|
|
1357
|
+
if (!this.tickerHandler) {
|
|
1358
|
+
return false;
|
|
1359
|
+
}
|
|
1360
|
+
if (!force) {
|
|
1361
|
+
if (this.status === STATUS.PAUSE) {
|
|
1362
|
+
return false;
|
|
1363
|
+
}
|
|
1364
|
+
if (this.ifCanStop()) {
|
|
1365
|
+
return false;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
this.status = STATUS.RUNNING;
|
|
1369
|
+
return true;
|
|
1370
|
+
}
|
|
1275
1371
|
}
|
|
1276
1372
|
|
|
1277
1373
|
function generatorPathEasingFunc(path) {
|
|
@@ -1367,6 +1463,30 @@ class AnimationTransitionRegistry {
|
|
|
1367
1463
|
allowTransition: true,
|
|
1368
1464
|
stopOriginalTransition: true
|
|
1369
1465
|
}));
|
|
1466
|
+
this.registerTransition('update', '*', () => ({
|
|
1467
|
+
allowTransition: true,
|
|
1468
|
+
stopOriginalTransition: false
|
|
1469
|
+
}));
|
|
1470
|
+
this.registerTransition('update', 'disappear', () => ({
|
|
1471
|
+
allowTransition: true,
|
|
1472
|
+
stopOriginalTransition: true
|
|
1473
|
+
}));
|
|
1474
|
+
this.registerTransition('update', 'exit', () => ({
|
|
1475
|
+
allowTransition: true,
|
|
1476
|
+
stopOriginalTransition: true
|
|
1477
|
+
}));
|
|
1478
|
+
this.registerTransition('state', '*', () => ({
|
|
1479
|
+
allowTransition: true,
|
|
1480
|
+
stopOriginalTransition: false
|
|
1481
|
+
}));
|
|
1482
|
+
this.registerTransition('state', 'disappear', () => ({
|
|
1483
|
+
allowTransition: true,
|
|
1484
|
+
stopOriginalTransition: true
|
|
1485
|
+
}));
|
|
1486
|
+
this.registerTransition('state', 'exit', () => ({
|
|
1487
|
+
allowTransition: true,
|
|
1488
|
+
stopOriginalTransition: true
|
|
1489
|
+
}));
|
|
1370
1490
|
}
|
|
1371
1491
|
isTransitionAllowed(fromState, toState, graphic) {
|
|
1372
1492
|
var _a, _b, _c, _d;
|
|
@@ -1456,7 +1576,7 @@ class AnimateExecutor {
|
|
|
1456
1576
|
}
|
|
1457
1577
|
});
|
|
1458
1578
|
}
|
|
1459
|
-
parseParams(params, isTimeline) {
|
|
1579
|
+
parseParams(params, isTimeline, child) {
|
|
1460
1580
|
var _a, _b;
|
|
1461
1581
|
const totalTime = this.resolveValue(params.totalTime, undefined, undefined);
|
|
1462
1582
|
const startTime = this.resolveValue(params.startTime, undefined, 0);
|
|
@@ -1464,59 +1584,57 @@ class AnimateExecutor {
|
|
|
1464
1584
|
parsedParams.oneByOneDelay = 0;
|
|
1465
1585
|
parsedParams.startTime = startTime;
|
|
1466
1586
|
parsedParams.totalTime = totalTime;
|
|
1467
|
-
const oneByOne = this.resolveValue(params.oneByOne,
|
|
1587
|
+
const oneByOne = this.resolveValue(params.oneByOne, child, false);
|
|
1468
1588
|
if (isTimeline) {
|
|
1469
1589
|
const timeSlices = parsedParams.timeSlices;
|
|
1470
1590
|
if (!isArray(timeSlices)) {
|
|
1471
1591
|
parsedParams.timeSlices = [timeSlices];
|
|
1472
1592
|
}
|
|
1473
1593
|
let sliceTime = 0;
|
|
1474
|
-
parsedParams.timeSlices.
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
sliceTime +=
|
|
1594
|
+
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
1595
|
+
const delay = this.resolveValue(slice.delay, child, 0);
|
|
1596
|
+
const delayAfter = this.resolveValue(slice.delayAfter, child, 0);
|
|
1597
|
+
const duration = this.resolveValue(slice.duration, child, 300);
|
|
1598
|
+
sliceTime += delay + duration + delayAfter;
|
|
1599
|
+
return Object.assign(Object.assign({}, slice), { delay,
|
|
1600
|
+
delayAfter,
|
|
1601
|
+
duration });
|
|
1479
1602
|
});
|
|
1480
1603
|
let oneByOneDelay = 0;
|
|
1481
|
-
let oneByOneTime = 0;
|
|
1482
1604
|
if (oneByOne) {
|
|
1483
|
-
|
|
1484
|
-
oneByOneDelay = oneByOneTime;
|
|
1605
|
+
oneByOneDelay = typeof oneByOne === 'number' ? oneByOne : oneByOne ? sliceTime : 0;
|
|
1485
1606
|
}
|
|
1486
|
-
parsedParams.oneByOne = oneByOneTime;
|
|
1487
1607
|
parsedParams.oneByOneDelay = oneByOneDelay;
|
|
1608
|
+
let scale = 1;
|
|
1488
1609
|
if (totalTime) {
|
|
1489
1610
|
const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);
|
|
1490
|
-
|
|
1491
|
-
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
1492
|
-
let effects = slice.effects;
|
|
1493
|
-
if (!Array.isArray(effects)) {
|
|
1494
|
-
effects = [effects];
|
|
1495
|
-
}
|
|
1496
|
-
return Object.assign(Object.assign({}, slice), { delay: slice.delay * scale, delayAfter: slice.delayAfter * scale, duration: slice.duration * scale, effects: effects.map(effect => {
|
|
1497
|
-
var _a, _b;
|
|
1498
|
-
const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[(_b = effect.type) !== null && _b !== void 0 ? _b : 'fromTo'];
|
|
1499
|
-
const customType = custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0;
|
|
1500
|
-
return Object.assign(Object.assign({}, effect), { custom,
|
|
1501
|
-
customType });
|
|
1502
|
-
}) });
|
|
1503
|
-
});
|
|
1504
|
-
parsedParams.oneByOne = oneByOneTime * scale;
|
|
1505
|
-
parsedParams.oneByOneDelay = oneByOneDelay * scale;
|
|
1506
|
-
parsedParams.startTime = startTime * scale;
|
|
1611
|
+
scale = totalTime ? totalTime / _totalTime : 1;
|
|
1507
1612
|
}
|
|
1613
|
+
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
1614
|
+
let effects = slice.effects;
|
|
1615
|
+
if (!Array.isArray(effects)) {
|
|
1616
|
+
effects = [effects];
|
|
1617
|
+
}
|
|
1618
|
+
return Object.assign(Object.assign({}, slice), { delay: slice.delay * scale, delayAfter: slice.delayAfter * scale, duration: slice.duration * scale, effects: effects.map(effect => {
|
|
1619
|
+
var _a, _b;
|
|
1620
|
+
const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[(_b = effect.type) !== null && _b !== void 0 ? _b : 'fromTo'];
|
|
1621
|
+
const customType = custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0;
|
|
1622
|
+
return Object.assign(Object.assign({}, effect), { custom,
|
|
1623
|
+
customType });
|
|
1624
|
+
}) });
|
|
1625
|
+
});
|
|
1626
|
+
parsedParams.oneByOneDelay = oneByOneDelay * scale;
|
|
1627
|
+
parsedParams.startTime = startTime * scale;
|
|
1508
1628
|
}
|
|
1509
1629
|
else {
|
|
1510
|
-
const delay = this.resolveValue(params.delay,
|
|
1511
|
-
const delayAfter = this.resolveValue(params.delayAfter,
|
|
1512
|
-
const duration = this.resolveValue(params.duration,
|
|
1630
|
+
const delay = this.resolveValue(params.delay, child, 0);
|
|
1631
|
+
const delayAfter = this.resolveValue(params.delayAfter, child, 0);
|
|
1632
|
+
const duration = this.resolveValue(params.duration, child, 300);
|
|
1633
|
+
const loopTime = delay + delayAfter + duration;
|
|
1513
1634
|
let oneByOneDelay = 0;
|
|
1514
|
-
let oneByOneTime = 0;
|
|
1515
1635
|
if (oneByOne) {
|
|
1516
|
-
|
|
1517
|
-
oneByOneDelay = duration + oneByOneTime;
|
|
1636
|
+
oneByOneDelay = typeof oneByOne === 'number' ? oneByOne : oneByOne ? loopTime : 0;
|
|
1518
1637
|
}
|
|
1519
|
-
parsedParams.oneByOne = oneByOneTime;
|
|
1520
1638
|
parsedParams.oneByOneDelay = oneByOneDelay;
|
|
1521
1639
|
parsedParams.custom =
|
|
1522
1640
|
(_a = params.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[(_b = params.type) !== null && _b !== void 0 ? _b : 'fromTo'];
|
|
@@ -1532,7 +1650,6 @@ class AnimateExecutor {
|
|
|
1532
1650
|
parsedParams.delay = delay * scale;
|
|
1533
1651
|
parsedParams.delayAfter = delayAfter * scale;
|
|
1534
1652
|
parsedParams.duration = duration * scale;
|
|
1535
|
-
parsedParams.oneByOne = oneByOneTime * scale;
|
|
1536
1653
|
parsedParams.oneByOneDelay = oneByOneDelay * scale;
|
|
1537
1654
|
parsedParams.startTime = startTime;
|
|
1538
1655
|
}
|
|
@@ -1555,26 +1672,27 @@ class AnimateExecutor {
|
|
|
1555
1672
|
let filteredChildren;
|
|
1556
1673
|
if (isTimeline && params.partitioner) {
|
|
1557
1674
|
filteredChildren = (filteredChildren !== null && filteredChildren !== void 0 ? filteredChildren : this._target.getChildren()).filter(child => {
|
|
1558
|
-
var _a;
|
|
1559
|
-
return params.partitioner((_a = child.context) === null || _a === void 0 ? void 0 : _a.data, child, {});
|
|
1675
|
+
var _a, _b;
|
|
1676
|
+
return params.partitioner((_b = (_a = child.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], child, {});
|
|
1560
1677
|
});
|
|
1561
1678
|
}
|
|
1562
1679
|
if (isTimeline && params.sort) {
|
|
1563
1680
|
filteredChildren = filteredChildren !== null && filteredChildren !== void 0 ? filteredChildren : this._target.getChildren();
|
|
1564
1681
|
filteredChildren.sort((a, b) => {
|
|
1565
|
-
var _a, _b;
|
|
1566
|
-
return params.sort((_a = a.context) === null || _a === void 0 ? void 0 : _a.data, (
|
|
1682
|
+
var _a, _b, _c, _d;
|
|
1683
|
+
return params.sort((_b = (_a = a.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], (_d = (_c = b.context) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[0], a, b, {});
|
|
1567
1684
|
});
|
|
1568
1685
|
}
|
|
1569
|
-
const parsedParams = this.parseParams(params, isTimeline);
|
|
1570
1686
|
const cb = isTimeline
|
|
1571
1687
|
? (child, index, count) => {
|
|
1688
|
+
const parsedParams = this.parseParams(params, isTimeline, child);
|
|
1572
1689
|
const animate = this.executeTimelineItem(parsedParams, child, index, count);
|
|
1573
1690
|
if (animate) {
|
|
1574
1691
|
this._trackAnimation(animate);
|
|
1575
1692
|
}
|
|
1576
1693
|
}
|
|
1577
1694
|
: (child, index, count) => {
|
|
1695
|
+
const parsedParams = this.parseParams(params, isTimeline, child);
|
|
1578
1696
|
const animate = this.executeTypeConfigItem(parsedParams, child, index, count);
|
|
1579
1697
|
if (animate) {
|
|
1580
1698
|
this._trackAnimation(animate);
|
|
@@ -1602,8 +1720,8 @@ class AnimateExecutor {
|
|
|
1602
1720
|
if (datum && indexKey) {
|
|
1603
1721
|
index = (_f = datum[indexKey]) !== null && _f !== void 0 ? _f : index;
|
|
1604
1722
|
}
|
|
1605
|
-
animate.startAt(startTime
|
|
1606
|
-
const wait = index * oneByOneDelay;
|
|
1723
|
+
animate.startAt(startTime);
|
|
1724
|
+
const wait = index * oneByOneDelay + delayValue;
|
|
1607
1725
|
wait > 0 && animate.wait(wait);
|
|
1608
1726
|
let parsedFromProps = null;
|
|
1609
1727
|
let props = params.to;
|
|
@@ -1620,13 +1738,17 @@ class AnimateExecutor {
|
|
|
1620
1738
|
}
|
|
1621
1739
|
from = parsedFromProps.from;
|
|
1622
1740
|
}
|
|
1623
|
-
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic);
|
|
1741
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
1742
|
+
let totalDelay = 0;
|
|
1624
1743
|
if (oneByOneDelay) {
|
|
1625
|
-
|
|
1744
|
+
totalDelay = oneByOneDelay * (count - index - 1);
|
|
1626
1745
|
}
|
|
1627
1746
|
const delayAfterValue = isFunction(delayAfter) ? delayAfter((_h = (_g = graphic.context) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h[0], graphic, {}) : delayAfter;
|
|
1628
1747
|
if (delayAfterValue > 0) {
|
|
1629
|
-
|
|
1748
|
+
totalDelay += delayAfterValue;
|
|
1749
|
+
}
|
|
1750
|
+
if (totalDelay > 0) {
|
|
1751
|
+
animate.wait(totalDelay);
|
|
1630
1752
|
}
|
|
1631
1753
|
if (loop && loop > 0) {
|
|
1632
1754
|
animate.loop(loop);
|
|
@@ -1636,14 +1758,15 @@ class AnimateExecutor {
|
|
|
1636
1758
|
}
|
|
1637
1759
|
return animate;
|
|
1638
1760
|
}
|
|
1639
|
-
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic) {
|
|
1761
|
+
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
|
|
1640
1762
|
var _a, _b, _c, _d;
|
|
1641
1763
|
if (custom && customType) {
|
|
1642
1764
|
const customParams = this.resolveValue(customParameters, graphic, {});
|
|
1643
1765
|
const objOptions = isFunction(options)
|
|
1644
|
-
? options.call(null, (_b = (
|
|
1766
|
+
? options.call(null, (_b = (customParams && ((_a = customParams.data) === null || _a === void 0 ? void 0 : _a[0]))) !== null && _b !== void 0 ? _b : (_d = (_c = graphic.context) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[0], graphic, customParams)
|
|
1645
1767
|
: options;
|
|
1646
1768
|
customParams.options = objOptions;
|
|
1769
|
+
customParams.controlOptions = controlOptions;
|
|
1647
1770
|
if (customType === 1) {
|
|
1648
1771
|
this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams);
|
|
1649
1772
|
}
|
|
@@ -1678,14 +1801,14 @@ class AnimateExecutor {
|
|
|
1678
1801
|
}
|
|
1679
1802
|
const slices = Array.isArray(timeSlices) ? timeSlices : [timeSlices];
|
|
1680
1803
|
slices.forEach(slice => {
|
|
1681
|
-
this.applyTimeSliceToAnimate(slice, animate, graphic);
|
|
1804
|
+
this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
|
|
1682
1805
|
});
|
|
1683
1806
|
if (oneByOneDelay) {
|
|
1684
1807
|
animate.wait(oneByOneDelay * (count - index - 1));
|
|
1685
1808
|
}
|
|
1686
1809
|
return animate;
|
|
1687
1810
|
}
|
|
1688
|
-
applyTimeSliceToAnimate(slice, animate, graphic) {
|
|
1811
|
+
applyTimeSliceToAnimate(slice, animate, graphic, controlOptions) {
|
|
1689
1812
|
var _a, _b, _c, _d;
|
|
1690
1813
|
const { effects, duration = 300, delay = 0, delayAfter = 0 } = slice;
|
|
1691
1814
|
const delayValue = isFunction(delay) ? delay((_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], graphic, {}) : delay;
|
|
@@ -1695,7 +1818,7 @@ class AnimateExecutor {
|
|
|
1695
1818
|
}
|
|
1696
1819
|
const effectsArray = Array.isArray(effects) ? effects : [effects];
|
|
1697
1820
|
effectsArray.forEach(effect => {
|
|
1698
|
-
var _a
|
|
1821
|
+
var _a;
|
|
1699
1822
|
const { type = 'fromTo', channel, customParameters, easing = 'linear', options } = effect;
|
|
1700
1823
|
let parsedFromProps = null;
|
|
1701
1824
|
let props = effect.to;
|
|
@@ -1713,8 +1836,8 @@ class AnimateExecutor {
|
|
|
1713
1836
|
from = parsedFromProps.from;
|
|
1714
1837
|
}
|
|
1715
1838
|
const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[type];
|
|
1716
|
-
const customType =
|
|
1717
|
-
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic);
|
|
1839
|
+
const customType = effect.customType;
|
|
1840
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
1718
1841
|
});
|
|
1719
1842
|
if (delayAfterValue > 0) {
|
|
1720
1843
|
animate.wait(delayAfterValue);
|
|
@@ -1745,11 +1868,12 @@ class AnimateExecutor {
|
|
|
1745
1868
|
};
|
|
1746
1869
|
}
|
|
1747
1870
|
if (!Array.isArray(channel)) {
|
|
1748
|
-
Object.
|
|
1749
|
-
var _a, _b;
|
|
1871
|
+
Object.keys(channel).forEach(key => {
|
|
1872
|
+
var _a, _b, _c, _d;
|
|
1873
|
+
const config = channel[key];
|
|
1750
1874
|
if (config.to !== undefined) {
|
|
1751
1875
|
if (typeof config.to === 'function') {
|
|
1752
|
-
props[key] = config.to((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data, graphic, {});
|
|
1876
|
+
props[key] = config.to((_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], graphic, {});
|
|
1753
1877
|
}
|
|
1754
1878
|
else {
|
|
1755
1879
|
props[key] = config.to;
|
|
@@ -1760,7 +1884,7 @@ class AnimateExecutor {
|
|
|
1760
1884
|
from = {};
|
|
1761
1885
|
}
|
|
1762
1886
|
if (typeof config.from === 'function') {
|
|
1763
|
-
from[key] = config.from((
|
|
1887
|
+
from[key] = config.from((_d = (_c = graphic.context) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[0], graphic, {});
|
|
1764
1888
|
}
|
|
1765
1889
|
else {
|
|
1766
1890
|
from[key] = config.from;
|
|
@@ -1783,12 +1907,12 @@ class AnimateExecutor {
|
|
|
1783
1907
|
};
|
|
1784
1908
|
}
|
|
1785
1909
|
resolveValue(value, graphic, defaultValue) {
|
|
1786
|
-
var _a;
|
|
1910
|
+
var _a, _b;
|
|
1787
1911
|
if (value === undefined) {
|
|
1788
1912
|
return defaultValue;
|
|
1789
1913
|
}
|
|
1790
1914
|
if (typeof value === 'function' && graphic) {
|
|
1791
|
-
return value((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data, graphic, {});
|
|
1915
|
+
return value((_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], graphic, {});
|
|
1792
1916
|
}
|
|
1793
1917
|
return value;
|
|
1794
1918
|
}
|
|
@@ -2057,13 +2181,13 @@ class AnimateExtension {
|
|
|
2057
2181
|
createTicker(stage) {
|
|
2058
2182
|
return new DefaultTicker(stage);
|
|
2059
2183
|
}
|
|
2060
|
-
|
|
2184
|
+
setFinalAttributes(finalAttribute) {
|
|
2061
2185
|
if (!this.finalAttribute) {
|
|
2062
2186
|
this.finalAttribute = {};
|
|
2063
2187
|
}
|
|
2064
2188
|
Object.assign(this.finalAttribute, finalAttribute);
|
|
2065
2189
|
}
|
|
2066
|
-
|
|
2190
|
+
initFinalAttributes(finalAttribute) {
|
|
2067
2191
|
this.finalAttribute = finalAttribute;
|
|
2068
2192
|
}
|
|
2069
2193
|
initAnimateExecutor() {
|
|
@@ -2086,6 +2210,12 @@ class AnimateExtension {
|
|
|
2086
2210
|
getFinalAttribute() {
|
|
2087
2211
|
return this.finalAttribute;
|
|
2088
2212
|
}
|
|
2213
|
+
getGraphicAttribute(key, prev = false) {
|
|
2214
|
+
if (!prev && this.finalAttribute) {
|
|
2215
|
+
return this.finalAttribute[key];
|
|
2216
|
+
}
|
|
2217
|
+
return this.attribute[key];
|
|
2218
|
+
}
|
|
2089
2219
|
}
|
|
2090
2220
|
|
|
2091
2221
|
function registerAnimate() {
|
|
@@ -2386,6 +2516,471 @@ class IncreaseCount extends ACustomAnimate {
|
|
|
2386
2516
|
}
|
|
2387
2517
|
}
|
|
2388
2518
|
|
|
2519
|
+
const DefaultMorphingAnimateConfig = {
|
|
2520
|
+
duration: 1000,
|
|
2521
|
+
easing: 'quadInOut'
|
|
2522
|
+
};
|
|
2523
|
+
|
|
2524
|
+
const transformKeys = [
|
|
2525
|
+
'x',
|
|
2526
|
+
'y',
|
|
2527
|
+
'dx',
|
|
2528
|
+
'dy',
|
|
2529
|
+
'scaleX',
|
|
2530
|
+
'scaleY',
|
|
2531
|
+
'angle',
|
|
2532
|
+
'anchor',
|
|
2533
|
+
'postMatrix',
|
|
2534
|
+
'scrollX',
|
|
2535
|
+
'scrollY'
|
|
2536
|
+
];
|
|
2537
|
+
const isTransformKey = (key) => {
|
|
2538
|
+
return transformKeys.includes(key);
|
|
2539
|
+
};
|
|
2540
|
+
|
|
2541
|
+
const interpolateOtherAttrs = (attrs, out, ratio) => {
|
|
2542
|
+
attrs.forEach(entry => {
|
|
2543
|
+
if (Number.isFinite(entry.to)) {
|
|
2544
|
+
out[entry.key] = entry.from + (entry.to - entry.from) * ratio;
|
|
2545
|
+
}
|
|
2546
|
+
else if (entry.key === 'fill' || entry.key === 'stroke') {
|
|
2547
|
+
const color = interpolateColor(entry.from, entry.to, ratio, false);
|
|
2548
|
+
if (color) {
|
|
2549
|
+
out[entry.key] = color;
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
});
|
|
2553
|
+
};
|
|
2554
|
+
const interpolateMorphingData = (morphingData, path, ratio) => {
|
|
2555
|
+
const tmpArr = [];
|
|
2556
|
+
const newCp = [];
|
|
2557
|
+
path.clear();
|
|
2558
|
+
for (let i = 0; i < morphingData.length; i++) {
|
|
2559
|
+
const item = morphingData[i];
|
|
2560
|
+
const from = item.from;
|
|
2561
|
+
const to = item.to;
|
|
2562
|
+
const angle = item.rotation * ratio;
|
|
2563
|
+
const fromCp = item.fromCp;
|
|
2564
|
+
const toCp = item.toCp;
|
|
2565
|
+
const sa = Math.sin(angle);
|
|
2566
|
+
const ca = Math.cos(angle);
|
|
2567
|
+
newCp[0] = fromCp[0] + (toCp[0] - fromCp[0]) * ratio;
|
|
2568
|
+
newCp[1] = fromCp[1] + (toCp[1] - fromCp[1]) * ratio;
|
|
2569
|
+
for (let m = 0; m < from.length; m += 2) {
|
|
2570
|
+
const x0 = from[m];
|
|
2571
|
+
const y0 = from[m + 1];
|
|
2572
|
+
const x1 = to[m];
|
|
2573
|
+
const y1 = to[m + 1];
|
|
2574
|
+
const x = x0 * (1 - ratio) + x1 * ratio;
|
|
2575
|
+
const y = y0 * (1 - ratio) + y1 * ratio;
|
|
2576
|
+
tmpArr[m] = x * ca - y * sa + newCp[0];
|
|
2577
|
+
tmpArr[m + 1] = x * sa + y * ca + newCp[1];
|
|
2578
|
+
}
|
|
2579
|
+
let x0 = tmpArr[0];
|
|
2580
|
+
let y0 = tmpArr[1];
|
|
2581
|
+
path.moveTo(x0, y0);
|
|
2582
|
+
for (let m = 2; m < from.length; m += 6) {
|
|
2583
|
+
const x1 = tmpArr[m];
|
|
2584
|
+
const y1 = tmpArr[m + 1];
|
|
2585
|
+
const x2 = tmpArr[m + 2];
|
|
2586
|
+
const y2 = tmpArr[m + 3];
|
|
2587
|
+
const x3 = tmpArr[m + 4];
|
|
2588
|
+
const y3 = tmpArr[m + 5];
|
|
2589
|
+
if (x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3) {
|
|
2590
|
+
path.lineTo(x3, y3);
|
|
2591
|
+
}
|
|
2592
|
+
else {
|
|
2593
|
+
path.bezierCurveTo(x1, y1, x2, y2, x3, y3);
|
|
2594
|
+
}
|
|
2595
|
+
x0 = x3;
|
|
2596
|
+
y0 = y3;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
const parseMorphingData = (fromPath, toPath, config) => {
|
|
2601
|
+
const fromBezier = fromPath ? pathToBezierCurves(fromPath) : [];
|
|
2602
|
+
const toBezier = pathToBezierCurves(toPath);
|
|
2603
|
+
if (config && fromBezier) {
|
|
2604
|
+
config.fromTransform && applyTransformOnBezierCurves(fromBezier, config.fromTransform.clone().getInverse());
|
|
2605
|
+
applyTransformOnBezierCurves(fromBezier, config.toTransfrom);
|
|
2606
|
+
}
|
|
2607
|
+
const [fromBezierCurves, toBezierCurves] = alignBezierCurves(fromBezier, toBezier);
|
|
2608
|
+
return fromPath
|
|
2609
|
+
? findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI)
|
|
2610
|
+
: toBezierCurves.map((to, index) => {
|
|
2611
|
+
return {
|
|
2612
|
+
from: fromBezierCurves[index],
|
|
2613
|
+
to,
|
|
2614
|
+
fromCp: [0, 0],
|
|
2615
|
+
toCp: [0, 0],
|
|
2616
|
+
rotation: 0
|
|
2617
|
+
};
|
|
2618
|
+
});
|
|
2619
|
+
};
|
|
2620
|
+
const validateOtherAttrs = [
|
|
2621
|
+
'fill',
|
|
2622
|
+
'fillOpacity',
|
|
2623
|
+
'shadowBlur',
|
|
2624
|
+
'shadowColor',
|
|
2625
|
+
'shadowOffsetX',
|
|
2626
|
+
'shadowOffsetY',
|
|
2627
|
+
'stroke',
|
|
2628
|
+
'strokeOpacity',
|
|
2629
|
+
'lineDashOffset'
|
|
2630
|
+
];
|
|
2631
|
+
const parseOtherAnimateAttrs = (fromAttrs, toAttrs) => {
|
|
2632
|
+
if (!fromAttrs || !toAttrs) {
|
|
2633
|
+
return null;
|
|
2634
|
+
}
|
|
2635
|
+
const res = [];
|
|
2636
|
+
let hasAttr = false;
|
|
2637
|
+
Object.keys(fromAttrs).forEach(fromKey => {
|
|
2638
|
+
if (!validateOtherAttrs.includes(fromKey)) {
|
|
2639
|
+
return;
|
|
2640
|
+
}
|
|
2641
|
+
const toValue = toAttrs[fromKey];
|
|
2642
|
+
if (!isNil(toValue) && !isNil(fromAttrs[fromKey]) && toValue !== fromAttrs[fromKey]) {
|
|
2643
|
+
if (fromKey === 'fill' || fromKey === 'stroke') {
|
|
2644
|
+
const parseColor = (color) => {
|
|
2645
|
+
return typeof color === 'string' ? ColorStore.Get(color, ColorType.Color255) : color;
|
|
2646
|
+
};
|
|
2647
|
+
res.push({
|
|
2648
|
+
from: isArray(fromAttrs[fromKey])
|
|
2649
|
+
? fromAttrs[fromKey].map(parseColor)
|
|
2650
|
+
: parseColor(fromAttrs[fromKey]),
|
|
2651
|
+
to: isArray(toValue) ? toValue.map(parseColor) : parseColor(toValue),
|
|
2652
|
+
key: fromKey
|
|
2653
|
+
});
|
|
2654
|
+
}
|
|
2655
|
+
else {
|
|
2656
|
+
res.push({ from: fromAttrs[fromKey], to: toValue, key: fromKey });
|
|
2657
|
+
}
|
|
2658
|
+
hasAttr = true;
|
|
2659
|
+
}
|
|
2660
|
+
});
|
|
2661
|
+
return hasAttr ? res : null;
|
|
2662
|
+
};
|
|
2663
|
+
class MorphingPath extends ACustomAnimate {
|
|
2664
|
+
constructor(config, duration, easing) {
|
|
2665
|
+
super({}, {}, duration, easing);
|
|
2666
|
+
this.morphingData = config.morphingData;
|
|
2667
|
+
this.otherAttrs = config.otherAttrs;
|
|
2668
|
+
this.saveOnEnd = config.saveOnEnd;
|
|
2669
|
+
}
|
|
2670
|
+
getEndProps() {
|
|
2671
|
+
return {};
|
|
2672
|
+
}
|
|
2673
|
+
onBind() {
|
|
2674
|
+
this.target.createPathProxy();
|
|
2675
|
+
this.onUpdate(false, 0, this.target.attribute);
|
|
2676
|
+
}
|
|
2677
|
+
onEnd() {
|
|
2678
|
+
return;
|
|
2679
|
+
}
|
|
2680
|
+
onUpdate(end, ratio, out) {
|
|
2681
|
+
const target = this.target;
|
|
2682
|
+
const pathProxy = typeof target.pathProxy === 'function' ? target.pathProxy(target.attribute) : target.pathProxy;
|
|
2683
|
+
interpolateMorphingData(this.morphingData, pathProxy, ratio);
|
|
2684
|
+
if (this.otherAttrs && this.otherAttrs.length) {
|
|
2685
|
+
interpolateOtherAttrs(this.otherAttrs, out, ratio);
|
|
2686
|
+
}
|
|
2687
|
+
this.target.setAttributes(out);
|
|
2688
|
+
if (end && !this.saveOnEnd) {
|
|
2689
|
+
this.target.pathProxy = null;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
const morphPath = (fromGraphic, toGraphic, animationConfig, fromGraphicTransform) => {
|
|
2694
|
+
var _a, _b, _c;
|
|
2695
|
+
if (fromGraphic && (!fromGraphic.valid || !fromGraphic.toCustomPath)) {
|
|
2696
|
+
if (__DEV__) {
|
|
2697
|
+
console.error(fromGraphic, ' is not validate');
|
|
2698
|
+
}
|
|
2699
|
+
return null;
|
|
2700
|
+
}
|
|
2701
|
+
if (!toGraphic.valid || !toGraphic.toCustomPath) {
|
|
2702
|
+
if (__DEV__) {
|
|
2703
|
+
console.error(toGraphic, ' is not validate');
|
|
2704
|
+
}
|
|
2705
|
+
return null;
|
|
2706
|
+
}
|
|
2707
|
+
let fromTransform = fromGraphic === null || fromGraphic === void 0 ? void 0 : fromGraphic.globalTransMatrix;
|
|
2708
|
+
if (fromGraphicTransform && fromTransform) {
|
|
2709
|
+
fromTransform = fromGraphicTransform
|
|
2710
|
+
.clone()
|
|
2711
|
+
.multiply(fromTransform.a, fromTransform.b, fromTransform.c, fromTransform.d, fromTransform.e, fromTransform.f);
|
|
2712
|
+
}
|
|
2713
|
+
const morphingData = parseMorphingData((_a = fromGraphic === null || fromGraphic === void 0 ? void 0 : fromGraphic.toCustomPath) === null || _a === void 0 ? void 0 : _a.call(fromGraphic), toGraphic.toCustomPath(), {
|
|
2714
|
+
fromTransform,
|
|
2715
|
+
toTransfrom: toGraphic.globalTransMatrix
|
|
2716
|
+
});
|
|
2717
|
+
const attrs = parseOtherAnimateAttrs(fromGraphic === null || fromGraphic === void 0 ? void 0 : fromGraphic.attribute, toGraphic.attribute);
|
|
2718
|
+
const animate = toGraphic.animate(animationConfig);
|
|
2719
|
+
if (animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.delay) {
|
|
2720
|
+
animate.wait(animationConfig.delay);
|
|
2721
|
+
}
|
|
2722
|
+
const morphingPath = new MorphingPath({ morphingData, otherAttrs: attrs }, (_b = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.duration) !== null && _b !== void 0 ? _b : DefaultMorphingAnimateConfig.duration, (_c = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.easing) !== null && _c !== void 0 ? _c : DefaultMorphingAnimateConfig.easing);
|
|
2723
|
+
animate.play(morphingPath);
|
|
2724
|
+
return animate;
|
|
2725
|
+
};
|
|
2726
|
+
const oneToMultiMorph = (fromGraphic, toGraphics, animationConfig) => {
|
|
2727
|
+
var _a;
|
|
2728
|
+
const validateToGraphics = toGraphics.filter(graphic => graphic && graphic.toCustomPath && graphic.valid);
|
|
2729
|
+
if (!validateToGraphics.length) {
|
|
2730
|
+
if (__DEV__) {
|
|
2731
|
+
console.error(validateToGraphics, ' is not validate');
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
if (!fromGraphic.valid || !fromGraphic.toCustomPath) {
|
|
2735
|
+
if (__DEV__) {
|
|
2736
|
+
console.error(fromGraphic, ' is not validate');
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
const childGraphics = ((animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.splitPath) === 'clone' ? cloneGraphic : (_a = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.splitPath) !== null && _a !== void 0 ? _a : splitGraphic)(fromGraphic, validateToGraphics.length, false);
|
|
2740
|
+
const oldOnEnd = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.onEnd;
|
|
2741
|
+
let count = validateToGraphics.length;
|
|
2742
|
+
const onEachEnd = () => {
|
|
2743
|
+
count--;
|
|
2744
|
+
if (count === 0 && oldOnEnd) {
|
|
2745
|
+
oldOnEnd();
|
|
2746
|
+
}
|
|
2747
|
+
};
|
|
2748
|
+
validateToGraphics.forEach((toChild, index) => {
|
|
2749
|
+
var _a;
|
|
2750
|
+
const fromChild = childGraphics[index];
|
|
2751
|
+
const delay = ((_a = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.delay) !== null && _a !== void 0 ? _a : 0) +
|
|
2752
|
+
((animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.individualDelay)
|
|
2753
|
+
? animationConfig.individualDelay(index, validateToGraphics.length, fromChild, toChild)
|
|
2754
|
+
: 0);
|
|
2755
|
+
morphPath(fromChild, toChild, Object.assign({}, animationConfig, { onEnd: onEachEnd, delay }), fromGraphic.globalTransMatrix);
|
|
2756
|
+
});
|
|
2757
|
+
};
|
|
2758
|
+
class MultiToOneMorphingPath extends ACustomAnimate {
|
|
2759
|
+
constructor(config, duration, easing) {
|
|
2760
|
+
super({}, {}, duration, easing);
|
|
2761
|
+
this.morphingData = config.morphingData;
|
|
2762
|
+
this.otherAttrs = config.otherAttrs;
|
|
2763
|
+
}
|
|
2764
|
+
getEndProps() {
|
|
2765
|
+
return {};
|
|
2766
|
+
}
|
|
2767
|
+
onBind() {
|
|
2768
|
+
this.addPathProxy();
|
|
2769
|
+
}
|
|
2770
|
+
addPathProxy() {
|
|
2771
|
+
const shadowRoot = this.target.shadowRoot;
|
|
2772
|
+
shadowRoot.forEachChildren(child => {
|
|
2773
|
+
child.createPathProxy();
|
|
2774
|
+
});
|
|
2775
|
+
this.onUpdate(false, 0, this.target.attribute);
|
|
2776
|
+
}
|
|
2777
|
+
clearPathProxy() {
|
|
2778
|
+
const shadowRoot = this.target.shadowRoot;
|
|
2779
|
+
shadowRoot.forEachChildren(child => {
|
|
2780
|
+
child.pathProxy = null;
|
|
2781
|
+
});
|
|
2782
|
+
}
|
|
2783
|
+
onEnd() {
|
|
2784
|
+
return;
|
|
2785
|
+
}
|
|
2786
|
+
onUpdate(end, ratio, out) {
|
|
2787
|
+
const shadowRoot = this.target.shadowRoot;
|
|
2788
|
+
shadowRoot.forEachChildren((child, index) => {
|
|
2789
|
+
var _a;
|
|
2790
|
+
interpolateMorphingData(this.morphingData[index], typeof child.pathProxy === 'function' ? child.pathProxy(child.attribute) : child.pathProxy, ratio);
|
|
2791
|
+
if (((_a = this.otherAttrs) === null || _a === void 0 ? void 0 : _a[index]) && this.otherAttrs[index].length) {
|
|
2792
|
+
interpolateOtherAttrs(this.otherAttrs[index], child.attribute, ratio);
|
|
2793
|
+
}
|
|
2794
|
+
});
|
|
2795
|
+
if (end) {
|
|
2796
|
+
this.clearPathProxy();
|
|
2797
|
+
this.morphingData = null;
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
const parseShadowChildAttrs = (graphicAttrs) => {
|
|
2802
|
+
const attrs = {};
|
|
2803
|
+
Object.keys(graphicAttrs).forEach(key => {
|
|
2804
|
+
if (!isTransformKey(key)) {
|
|
2805
|
+
attrs[key] = graphicAttrs[key];
|
|
2806
|
+
}
|
|
2807
|
+
});
|
|
2808
|
+
return attrs;
|
|
2809
|
+
};
|
|
2810
|
+
const appendShadowChildrenToGraphic = (graphic, children, count) => {
|
|
2811
|
+
const childAttrs = parseShadowChildAttrs(graphic.attribute);
|
|
2812
|
+
const shadowRoot = graphic.attachShadow();
|
|
2813
|
+
if (children.length) {
|
|
2814
|
+
shadowRoot.setTheme({
|
|
2815
|
+
[children[0].type]: childAttrs
|
|
2816
|
+
});
|
|
2817
|
+
children.forEach(element => {
|
|
2818
|
+
element.setAttributes({ pickable: false });
|
|
2819
|
+
shadowRoot.appendChild(element);
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
else {
|
|
2823
|
+
const box = graphic.AABBBounds;
|
|
2824
|
+
const width = box.width();
|
|
2825
|
+
const height = box.height();
|
|
2826
|
+
shadowRoot.setTheme({
|
|
2827
|
+
rect: childAttrs
|
|
2828
|
+
});
|
|
2829
|
+
new Array(count).fill(0).forEach(el => {
|
|
2830
|
+
const child = application.graphicService.creator.rect({
|
|
2831
|
+
x: 0,
|
|
2832
|
+
y: 0,
|
|
2833
|
+
width,
|
|
2834
|
+
height: height,
|
|
2835
|
+
pickable: false
|
|
2836
|
+
});
|
|
2837
|
+
shadowRoot.appendChild(child);
|
|
2838
|
+
children.push(child);
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2841
|
+
};
|
|
2842
|
+
const cloneGraphic = (graphic, count, needAppend) => {
|
|
2843
|
+
const children = [];
|
|
2844
|
+
const childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);
|
|
2845
|
+
const path = graphic.toCustomPath();
|
|
2846
|
+
for (let i = 0; i < count; i++) {
|
|
2847
|
+
const element = {
|
|
2848
|
+
path: new CustomPath2D().fromCustomPath2D(path)
|
|
2849
|
+
};
|
|
2850
|
+
children.push(application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
2851
|
+
}
|
|
2852
|
+
if (needAppend) {
|
|
2853
|
+
appendShadowChildrenToGraphic(graphic, children, count);
|
|
2854
|
+
}
|
|
2855
|
+
return children;
|
|
2856
|
+
};
|
|
2857
|
+
const splitGraphic = (graphic, count, needAppend) => {
|
|
2858
|
+
const children = [];
|
|
2859
|
+
const childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);
|
|
2860
|
+
if (graphic.type === 'rect') {
|
|
2861
|
+
const childrenAttrs = splitRect(graphic, count);
|
|
2862
|
+
childrenAttrs.forEach(element => {
|
|
2863
|
+
children.push(application.graphicService.creator.rect(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
2864
|
+
});
|
|
2865
|
+
}
|
|
2866
|
+
else if (graphic.type === 'arc') {
|
|
2867
|
+
const childrenAttrs = splitArc(graphic, count);
|
|
2868
|
+
childrenAttrs.forEach(element => {
|
|
2869
|
+
children.push(application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
else if (graphic.type === 'circle') {
|
|
2873
|
+
const childrenAttrs = splitCircle(graphic, count);
|
|
2874
|
+
childrenAttrs.forEach(element => {
|
|
2875
|
+
children.push(application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
else if (graphic.type === 'line') {
|
|
2879
|
+
const childrenAttrs = splitLine(graphic, count);
|
|
2880
|
+
const defaultSymbol = { size: 10, symbolType: 'circle' };
|
|
2881
|
+
childrenAttrs.forEach(element => {
|
|
2882
|
+
children.push(application.graphicService.creator.symbol(needAppend ? Object.assign({}, element, defaultSymbol) : Object.assign({}, childAttrs, element, defaultSymbol)));
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
else if (graphic.type === 'polygon') {
|
|
2886
|
+
const childrenAttrs = splitPolygon(graphic, count);
|
|
2887
|
+
childrenAttrs.forEach(element => {
|
|
2888
|
+
children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
2889
|
+
});
|
|
2890
|
+
}
|
|
2891
|
+
else if (graphic.type === 'area') {
|
|
2892
|
+
const childrenAttrs = splitArea(graphic, count);
|
|
2893
|
+
childrenAttrs.forEach(element => {
|
|
2894
|
+
children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
else if (graphic.type === 'path') {
|
|
2898
|
+
const childrenAttrs = splitPath(graphic, count);
|
|
2899
|
+
childrenAttrs.forEach(element => {
|
|
2900
|
+
if ('path' in element) {
|
|
2901
|
+
children.push(application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
2902
|
+
}
|
|
2903
|
+
else {
|
|
2904
|
+
children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
2905
|
+
}
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
if (needAppend) {
|
|
2909
|
+
appendShadowChildrenToGraphic(graphic, children, count);
|
|
2910
|
+
}
|
|
2911
|
+
return children;
|
|
2912
|
+
};
|
|
2913
|
+
const multiToOneMorph = (fromGraphics, toGraphic, animationConfig) => {
|
|
2914
|
+
var _a, _b, _c;
|
|
2915
|
+
const validateFromGraphics = fromGraphics.filter(graphic => graphic.toCustomPath && graphic.valid);
|
|
2916
|
+
if (!validateFromGraphics.length) {
|
|
2917
|
+
if (__DEV__) {
|
|
2918
|
+
console.error(fromGraphics, ' is not validate');
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
if (!toGraphic.valid || !toGraphic.toCustomPath) {
|
|
2922
|
+
if (__DEV__) {
|
|
2923
|
+
console.error(toGraphic, ' is not validate');
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
const childGraphics = ((animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.splitPath) === 'clone' ? cloneGraphic : (_a = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.splitPath) !== null && _a !== void 0 ? _a : splitGraphic)(toGraphic, validateFromGraphics.length, true);
|
|
2927
|
+
const toAttrs = toGraphic.attribute;
|
|
2928
|
+
toGraphic.setAttribute('visible', false);
|
|
2929
|
+
const morphingData = validateFromGraphics.map((graphic, index) => {
|
|
2930
|
+
return parseMorphingData(graphic.toCustomPath(), childGraphics[index].toCustomPath(), {
|
|
2931
|
+
fromTransform: graphic.globalTransMatrix,
|
|
2932
|
+
toTransfrom: childGraphics[index].globalTransMatrix
|
|
2933
|
+
});
|
|
2934
|
+
});
|
|
2935
|
+
const otherAttrs = validateFromGraphics.map((graphic, index) => {
|
|
2936
|
+
return parseOtherAnimateAttrs(graphic.attribute, toAttrs);
|
|
2937
|
+
});
|
|
2938
|
+
if (animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.individualDelay) {
|
|
2939
|
+
const oldOnEnd = animationConfig.onEnd;
|
|
2940
|
+
let count = validateFromGraphics.length;
|
|
2941
|
+
const onEachEnd = () => {
|
|
2942
|
+
count--;
|
|
2943
|
+
if (count === 0) {
|
|
2944
|
+
toGraphic.setAttributes({ visible: true, ratio: null }, false, {
|
|
2945
|
+
type: AttributeUpdateType.ANIMATE_END
|
|
2946
|
+
});
|
|
2947
|
+
toGraphic.detachShadow();
|
|
2948
|
+
if (oldOnEnd) {
|
|
2949
|
+
oldOnEnd();
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
};
|
|
2953
|
+
childGraphics.forEach((to, index) => {
|
|
2954
|
+
var _a, _b, _c;
|
|
2955
|
+
const delay = ((_a = animationConfig.delay) !== null && _a !== void 0 ? _a : 0) +
|
|
2956
|
+
animationConfig.individualDelay(index, validateFromGraphics.length, fromGraphics[index], to);
|
|
2957
|
+
const animate = to.animate(Object.assign({}, animationConfig, { onEnd: onEachEnd }));
|
|
2958
|
+
animate.wait(delay);
|
|
2959
|
+
animate.play(new MorphingPath({
|
|
2960
|
+
morphingData: morphingData[index],
|
|
2961
|
+
saveOnEnd: true,
|
|
2962
|
+
otherAttrs: otherAttrs[index]
|
|
2963
|
+
}, (_b = animationConfig.duration) !== null && _b !== void 0 ? _b : DefaultMorphingAnimateConfig.duration, (_c = animationConfig.easing) !== null && _c !== void 0 ? _c : DefaultMorphingAnimateConfig.easing));
|
|
2964
|
+
});
|
|
2965
|
+
}
|
|
2966
|
+
else {
|
|
2967
|
+
const oldOnEnd = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.onEnd;
|
|
2968
|
+
const config = animationConfig ? Object.assign({}, animationConfig) : {};
|
|
2969
|
+
config.onEnd = () => {
|
|
2970
|
+
toGraphic.setAttribute('visible', true, false, { type: AttributeUpdateType.ANIMATE_END });
|
|
2971
|
+
toGraphic.detachShadow();
|
|
2972
|
+
if (oldOnEnd) {
|
|
2973
|
+
oldOnEnd();
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
const animate = toGraphic.animate(config);
|
|
2977
|
+
if (animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.delay) {
|
|
2978
|
+
animate.wait(animationConfig.delay);
|
|
2979
|
+
}
|
|
2980
|
+
animate.play(new MultiToOneMorphingPath({ morphingData, otherAttrs }, (_b = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.duration) !== null && _b !== void 0 ? _b : DefaultMorphingAnimateConfig.duration, (_c = animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.easing) !== null && _c !== void 0 ? _c : DefaultMorphingAnimateConfig.easing));
|
|
2981
|
+
}
|
|
2982
|
+
};
|
|
2983
|
+
|
|
2389
2984
|
class InputText extends ACustomAnimate {
|
|
2390
2985
|
constructor(from, to, duration, easing, params) {
|
|
2391
2986
|
super(from, to, duration, easing, params);
|
|
@@ -2482,7 +3077,7 @@ class InputText extends ACustomAnimate {
|
|
|
2482
3077
|
|
|
2483
3078
|
class ClipGraphicAnimate extends ACustomAnimate {
|
|
2484
3079
|
constructor(from, to, duration, easing, params) {
|
|
2485
|
-
super(null,
|
|
3080
|
+
super(null, {}, duration, easing, params);
|
|
2486
3081
|
this.clipFromAttribute = from;
|
|
2487
3082
|
this.clipToAttribute = to;
|
|
2488
3083
|
this._group = params === null || params === void 0 ? void 0 : params.group;
|
|
@@ -2749,6 +3344,14 @@ class TagPointsUpdate extends ACustomAnimate {
|
|
|
2749
3344
|
}
|
|
2750
3345
|
}
|
|
2751
3346
|
onUpdate(end, ratio, out) {
|
|
3347
|
+
if (end) {
|
|
3348
|
+
Object.keys(this.to).forEach(k => {
|
|
3349
|
+
this.target.attribute[k] = this.to[k];
|
|
3350
|
+
});
|
|
3351
|
+
this.target.addUpdatePositionTag();
|
|
3352
|
+
this.target.addUpdateShapeAndBoundsTag();
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
2752
3355
|
this.points = this.points.map((point, index) => {
|
|
2753
3356
|
const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
|
|
2754
3357
|
newPoint.context = point.context;
|
|
@@ -2776,7 +3379,7 @@ class TagPointsUpdate extends ACustomAnimate {
|
|
|
2776
3379
|
start = end;
|
|
2777
3380
|
return Object.assign(Object.assign({}, segment), { points });
|
|
2778
3381
|
});
|
|
2779
|
-
this.target.attribute.
|
|
3382
|
+
this.target.attribute.segments = segments;
|
|
2780
3383
|
}
|
|
2781
3384
|
else {
|
|
2782
3385
|
this.target.attribute.points = this.points;
|
|
@@ -2791,29 +3394,28 @@ class CommonIn extends ACustomAnimate {
|
|
|
2791
3394
|
super(from, to, duration, easing, params);
|
|
2792
3395
|
}
|
|
2793
3396
|
onBind() {
|
|
2794
|
-
var _a;
|
|
3397
|
+
var _a, _b, _c;
|
|
2795
3398
|
super.onBind();
|
|
2796
3399
|
const attrs = this.target.getFinalAttribute();
|
|
2797
3400
|
const fromAttrs = (_a = this.target.attribute) !== null && _a !== void 0 ? _a : {};
|
|
2798
3401
|
const to = {};
|
|
2799
|
-
const from = {};
|
|
3402
|
+
const from = (_b = this.from) !== null && _b !== void 0 ? _b : {};
|
|
2800
3403
|
this.keys.forEach(key => {
|
|
2801
|
-
var _a, _b;
|
|
3404
|
+
var _a, _b, _c;
|
|
2802
3405
|
to[key] = (_a = attrs === null || attrs === void 0 ? void 0 : attrs[key]) !== null && _a !== void 0 ? _a : 1;
|
|
2803
|
-
from[key] = (_b =
|
|
3406
|
+
from[key] = (_c = (_b = from[key]) !== null && _b !== void 0 ? _b : fromAttrs[key]) !== null && _c !== void 0 ? _c : 0;
|
|
2804
3407
|
});
|
|
2805
3408
|
const finalAttribute = this.target.getFinalAttribute();
|
|
2806
3409
|
if (finalAttribute) {
|
|
2807
|
-
|
|
3410
|
+
this.target.setAttributes(finalAttribute);
|
|
2808
3411
|
}
|
|
2809
3412
|
this.props = to;
|
|
2810
3413
|
this.propKeys = this.keys;
|
|
2811
3414
|
this.from = from;
|
|
2812
3415
|
this.to = to;
|
|
2813
|
-
this.
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
super.onEnd(cb);
|
|
3416
|
+
if (((_c = this.params.controlOptions) === null || _c === void 0 ? void 0 : _c.immediatelyApply) !== false) {
|
|
3417
|
+
this.target.setAttributes(from);
|
|
3418
|
+
}
|
|
2817
3419
|
}
|
|
2818
3420
|
onUpdate(end, ratio, out) {
|
|
2819
3421
|
const attribute = this.target.attribute;
|
|
@@ -2863,6 +3465,7 @@ class GroupFadeIn extends CommonIn {
|
|
|
2863
3465
|
constructor(from, to, duration, easing, params) {
|
|
2864
3466
|
super(from, to, duration, easing, params);
|
|
2865
3467
|
this.keys = ['baseOpacity'];
|
|
3468
|
+
this.from = { baseOpacity: 0 };
|
|
2866
3469
|
}
|
|
2867
3470
|
}
|
|
2868
3471
|
class GroupFadeOut extends CommonOut {
|
|
@@ -2921,6 +3524,15 @@ class ClipIn extends CommonIn {
|
|
|
2921
3524
|
constructor(from, to, duration, easing, params) {
|
|
2922
3525
|
super(from, to, duration, easing, params);
|
|
2923
3526
|
this.keys = ['clipRange'];
|
|
3527
|
+
this.from = { clipRange: 0 };
|
|
3528
|
+
}
|
|
3529
|
+
onFirstRun() {
|
|
3530
|
+
var _a;
|
|
3531
|
+
super.onFirstRun();
|
|
3532
|
+
const { clipDimension } = ((_a = this.params) === null || _a === void 0 ? void 0 : _a.options) || {};
|
|
3533
|
+
if (clipDimension) {
|
|
3534
|
+
this.target.attribute.clipRangeByDimension = clipDimension;
|
|
3535
|
+
}
|
|
2924
3536
|
}
|
|
2925
3537
|
}
|
|
2926
3538
|
class ClipOut extends CommonOut {
|
|
@@ -2933,13 +3545,14 @@ class ClipOut extends CommonOut {
|
|
|
2933
3545
|
class FadeIn extends CommonIn {
|
|
2934
3546
|
constructor(from, to, duration, easing, params) {
|
|
2935
3547
|
super(from, to, duration, easing, params);
|
|
2936
|
-
this.keys = ['opacity'];
|
|
3548
|
+
this.keys = ['opacity', 'fillOpacity', 'strokeOpacity'];
|
|
3549
|
+
this.from = { opacity: 0, fillOpacity: 0, strokeOpacity: 0 };
|
|
2937
3550
|
}
|
|
2938
3551
|
}
|
|
2939
3552
|
class FadeOut extends CommonOut {
|
|
2940
3553
|
constructor(from, to, duration, easing, params) {
|
|
2941
3554
|
super(from, to, duration, easing, params);
|
|
2942
|
-
this.keys = ['opacity'];
|
|
3555
|
+
this.keys = ['opacity', 'fillOpacity', 'strokeOpacity'];
|
|
2943
3556
|
}
|
|
2944
3557
|
}
|
|
2945
3558
|
|
|
@@ -3106,7 +3719,7 @@ class GrowAngleIn extends GrowAngleBase {
|
|
|
3106
3719
|
this.to = to;
|
|
3107
3720
|
const finalAttribute = this.target.getFinalAttribute();
|
|
3108
3721
|
if (finalAttribute) {
|
|
3109
|
-
|
|
3722
|
+
this.target.setAttributes(finalAttribute);
|
|
3110
3723
|
}
|
|
3111
3724
|
this.target.setAttributes(fromAttrs);
|
|
3112
3725
|
this.determineUpdateFunction();
|
|
@@ -3291,7 +3904,7 @@ class GrowCenterIn extends ACustomAnimate {
|
|
|
3291
3904
|
this.to = to;
|
|
3292
3905
|
const finalAttribute = this.target.getFinalAttribute();
|
|
3293
3906
|
if (finalAttribute) {
|
|
3294
|
-
|
|
3907
|
+
this.target.setAttributes(finalAttribute);
|
|
3295
3908
|
}
|
|
3296
3909
|
this.target.setAttributes(fromAttrs);
|
|
3297
3910
|
}
|
|
@@ -3351,7 +3964,7 @@ function growHeightInIndividual(graphic, options, animationParameters) {
|
|
|
3351
3964
|
};
|
|
3352
3965
|
}
|
|
3353
3966
|
function growHeightInOverall(graphic, options, animationParameters) {
|
|
3354
|
-
var _a;
|
|
3967
|
+
var _a, _b, _c;
|
|
3355
3968
|
const attrs = graphic.getFinalAttribute();
|
|
3356
3969
|
const y = attrs.y;
|
|
3357
3970
|
const y1 = attrs.y1;
|
|
@@ -3362,7 +3975,8 @@ function growHeightInOverall(graphic, options, animationParameters) {
|
|
|
3362
3975
|
overallValue = options.overall;
|
|
3363
3976
|
}
|
|
3364
3977
|
else if (animationParameters.group) {
|
|
3365
|
-
overallValue =
|
|
3978
|
+
overallValue =
|
|
3979
|
+
(_c = (_a = animationParameters.groupHeight) !== null && _a !== void 0 ? _a : (_b = options.layoutRect) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : animationParameters.group.getBounds().height();
|
|
3366
3980
|
animationParameters.groupHeight = overallValue;
|
|
3367
3981
|
}
|
|
3368
3982
|
else {
|
|
@@ -3398,7 +4012,7 @@ class GrowHeightIn extends ACustomAnimate {
|
|
|
3398
4012
|
this.to = to;
|
|
3399
4013
|
const finalAttribute = this.target.getFinalAttribute();
|
|
3400
4014
|
if (finalAttribute) {
|
|
3401
|
-
|
|
4015
|
+
this.target.setAttributes(finalAttribute);
|
|
3402
4016
|
}
|
|
3403
4017
|
this.target.setAttributes(fromAttrs);
|
|
3404
4018
|
}
|
|
@@ -3431,7 +4045,7 @@ function growHeightOutIndividual(graphic, options, animationParameters) {
|
|
|
3431
4045
|
};
|
|
3432
4046
|
}
|
|
3433
4047
|
function growHeightOutOverall(graphic, options, animationParameters) {
|
|
3434
|
-
var _a;
|
|
4048
|
+
var _a, _b, _c;
|
|
3435
4049
|
const attrs = graphic.getFinalAttribute();
|
|
3436
4050
|
const y1 = attrs.y1;
|
|
3437
4051
|
const height = attrs.height;
|
|
@@ -3441,7 +4055,8 @@ function growHeightOutOverall(graphic, options, animationParameters) {
|
|
|
3441
4055
|
overallValue = options.overall;
|
|
3442
4056
|
}
|
|
3443
4057
|
else if (animationParameters.group) {
|
|
3444
|
-
overallValue =
|
|
4058
|
+
overallValue =
|
|
4059
|
+
(_c = (_a = animationParameters.groupHeight) !== null && _a !== void 0 ? _a : (_b = options.layoutRect) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : animationParameters.group.getBounds().height();
|
|
3445
4060
|
animationParameters.groupHeight = overallValue;
|
|
3446
4061
|
}
|
|
3447
4062
|
else {
|
|
@@ -3545,6 +4160,7 @@ class GworPointsBase extends ACustomAnimate {
|
|
|
3545
4160
|
}
|
|
3546
4161
|
class GrowPointsIn extends GworPointsBase {
|
|
3547
4162
|
onBind() {
|
|
4163
|
+
var _a;
|
|
3548
4164
|
super.onBind();
|
|
3549
4165
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3550
4166
|
const { from, to } = growPointsIn(this.target, this.params.options, this.params);
|
|
@@ -3554,9 +4170,11 @@ class GrowPointsIn extends GworPointsBase {
|
|
|
3554
4170
|
this.to = to;
|
|
3555
4171
|
const finalAttribute = this.target.getFinalAttribute();
|
|
3556
4172
|
if (finalAttribute) {
|
|
3557
|
-
|
|
4173
|
+
this.target.setAttributes(finalAttribute);
|
|
4174
|
+
}
|
|
4175
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
4176
|
+
this.target.setAttributes(from);
|
|
3558
4177
|
}
|
|
3559
|
-
this.target.setAttributes(from);
|
|
3560
4178
|
}
|
|
3561
4179
|
else {
|
|
3562
4180
|
this.valid = false;
|
|
@@ -3583,12 +4201,10 @@ const changePointsX = (graphic, options, animationParameters) => {
|
|
|
3583
4201
|
const attrs = graphic.getFinalAttribute();
|
|
3584
4202
|
const points = attrs.points;
|
|
3585
4203
|
return points.map((point) => {
|
|
3586
|
-
var _a;
|
|
3587
4204
|
if (options && options.orient === 'negative') {
|
|
3588
|
-
let groupRight =
|
|
3589
|
-
if (
|
|
3590
|
-
groupRight =
|
|
3591
|
-
animationParameters.groupWidth = groupRight;
|
|
4205
|
+
let groupRight = graphic.stage.viewWidth;
|
|
4206
|
+
if (graphic.parent.parent.parent) {
|
|
4207
|
+
groupRight = graphic.parent.parent.parent.AABBBounds.width();
|
|
3592
4208
|
}
|
|
3593
4209
|
return Object.assign(Object.assign({}, point), { x: groupRight, y: point.y, x1: groupRight, y1: point.y1, defined: point.defined !== false });
|
|
3594
4210
|
}
|
|
@@ -3598,7 +4214,7 @@ const changePointsX = (graphic, options, animationParameters) => {
|
|
|
3598
4214
|
const growPointsXIn = (graphic, options, animationParameters) => {
|
|
3599
4215
|
const attrs = graphic.getFinalAttribute();
|
|
3600
4216
|
return {
|
|
3601
|
-
from: { points: changePointsX(graphic, options
|
|
4217
|
+
from: { points: changePointsX(graphic, options) },
|
|
3602
4218
|
to: { points: attrs.points }
|
|
3603
4219
|
};
|
|
3604
4220
|
};
|
|
@@ -3606,11 +4222,12 @@ const growPointsXOut = (graphic, options, animationParameters) => {
|
|
|
3606
4222
|
const attrs = graphic.getFinalAttribute();
|
|
3607
4223
|
return {
|
|
3608
4224
|
from: { points: attrs.points },
|
|
3609
|
-
to: { points: changePointsX(graphic, options
|
|
4225
|
+
to: { points: changePointsX(graphic, options) }
|
|
3610
4226
|
};
|
|
3611
4227
|
};
|
|
3612
4228
|
class GrowPointsXIn extends GworPointsBase {
|
|
3613
4229
|
onBind() {
|
|
4230
|
+
var _a;
|
|
3614
4231
|
super.onBind();
|
|
3615
4232
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3616
4233
|
const { from, to } = growPointsXIn(this.target, this.params.options, this.params);
|
|
@@ -3620,9 +4237,11 @@ class GrowPointsXIn extends GworPointsBase {
|
|
|
3620
4237
|
this.to = to;
|
|
3621
4238
|
const finalAttribute = this.target.getFinalAttribute();
|
|
3622
4239
|
if (finalAttribute) {
|
|
3623
|
-
|
|
4240
|
+
this.target.setAttributes(finalAttribute);
|
|
4241
|
+
}
|
|
4242
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
4243
|
+
this.target.setAttributes(from);
|
|
3624
4244
|
}
|
|
3625
|
-
this.target.setAttributes(from);
|
|
3626
4245
|
}
|
|
3627
4246
|
else {
|
|
3628
4247
|
this.valid = false;
|
|
@@ -3649,12 +4268,10 @@ const changePointsY = (graphic, options, animationParameters) => {
|
|
|
3649
4268
|
const attrs = graphic.getFinalAttribute();
|
|
3650
4269
|
const points = attrs.points;
|
|
3651
4270
|
return points.map((point) => {
|
|
3652
|
-
var _a;
|
|
3653
4271
|
if (options && options.orient === 'negative') {
|
|
3654
|
-
let groupBottom =
|
|
3655
|
-
if (
|
|
3656
|
-
groupBottom =
|
|
3657
|
-
animationParameters.groupHeight = groupBottom;
|
|
4272
|
+
let groupBottom = graphic.stage.viewHeight;
|
|
4273
|
+
if (graphic.parent.parent.parent) {
|
|
4274
|
+
groupBottom = graphic.parent.parent.parent.AABBBounds.height();
|
|
3658
4275
|
}
|
|
3659
4276
|
return Object.assign(Object.assign({}, point), { x: point.x, y: groupBottom, x1: point.x1, y1: groupBottom, defined: point.defined !== false });
|
|
3660
4277
|
}
|
|
@@ -3664,7 +4281,7 @@ const changePointsY = (graphic, options, animationParameters) => {
|
|
|
3664
4281
|
const growPointsYIn = (graphic, options, animationParameters) => {
|
|
3665
4282
|
const attrs = graphic.getFinalAttribute();
|
|
3666
4283
|
return {
|
|
3667
|
-
from: { points: changePointsY(graphic, options
|
|
4284
|
+
from: { points: changePointsY(graphic, options) },
|
|
3668
4285
|
to: { points: attrs.points }
|
|
3669
4286
|
};
|
|
3670
4287
|
};
|
|
@@ -3672,11 +4289,12 @@ const growPointsYOut = (graphic, options, animationParameters) => {
|
|
|
3672
4289
|
const attrs = graphic.getFinalAttribute();
|
|
3673
4290
|
return {
|
|
3674
4291
|
from: { points: attrs.points },
|
|
3675
|
-
to: { points: changePointsY(graphic, options
|
|
4292
|
+
to: { points: changePointsY(graphic, options) }
|
|
3676
4293
|
};
|
|
3677
4294
|
};
|
|
3678
4295
|
class GrowPointsYIn extends GworPointsBase {
|
|
3679
4296
|
onBind() {
|
|
4297
|
+
var _a;
|
|
3680
4298
|
super.onBind();
|
|
3681
4299
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3682
4300
|
const { from, to } = growPointsYIn(this.target, this.params.options, this.params);
|
|
@@ -3686,9 +4304,11 @@ class GrowPointsYIn extends GworPointsBase {
|
|
|
3686
4304
|
this.to = to;
|
|
3687
4305
|
const finalAttribute = this.target.getFinalAttribute();
|
|
3688
4306
|
if (finalAttribute) {
|
|
3689
|
-
|
|
4307
|
+
this.target.setAttributes(finalAttribute);
|
|
4308
|
+
}
|
|
4309
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
4310
|
+
this.target.setAttributes(from);
|
|
3690
4311
|
}
|
|
3691
|
-
this.target.setAttributes(from);
|
|
3692
4312
|
}
|
|
3693
4313
|
else {
|
|
3694
4314
|
this.valid = false;
|
|
@@ -3802,7 +4422,7 @@ class GrowRadiusIn extends GrowPointsBase {
|
|
|
3802
4422
|
this.to = to;
|
|
3803
4423
|
const finalAttribute = this.target.getFinalAttribute();
|
|
3804
4424
|
if (finalAttribute) {
|
|
3805
|
-
|
|
4425
|
+
this.target.setAttributes(finalAttribute);
|
|
3806
4426
|
}
|
|
3807
4427
|
this.target.setAttributes(fromAttrs);
|
|
3808
4428
|
}
|
|
@@ -3931,7 +4551,7 @@ class GrowWidthIn extends ACustomAnimate {
|
|
|
3931
4551
|
this.to = to;
|
|
3932
4552
|
const finalAttribute = this.target.getFinalAttribute();
|
|
3933
4553
|
if (finalAttribute) {
|
|
3934
|
-
|
|
4554
|
+
this.target.setAttributes(finalAttribute);
|
|
3935
4555
|
}
|
|
3936
4556
|
this.target.setAttributes(fromAttrs);
|
|
3937
4557
|
}
|
|
@@ -4272,10 +4892,10 @@ class InputRichText extends ACustomAnimate {
|
|
|
4272
4892
|
this.showCursor = false;
|
|
4273
4893
|
this.cursorChar = '|';
|
|
4274
4894
|
this.blinkCursor = true;
|
|
4275
|
-
this.beforeText = '';
|
|
4276
|
-
this.afterText = '';
|
|
4277
4895
|
this.fadeInChars = false;
|
|
4278
4896
|
this.fadeInDuration = 0.3;
|
|
4897
|
+
this.strokeFirst = false;
|
|
4898
|
+
this.strokeToFillRatio = 0.3;
|
|
4279
4899
|
if ((params === null || params === void 0 ? void 0 : params.showCursor) !== undefined) {
|
|
4280
4900
|
this.showCursor = params.showCursor;
|
|
4281
4901
|
}
|
|
@@ -4285,18 +4905,18 @@ class InputRichText extends ACustomAnimate {
|
|
|
4285
4905
|
if ((params === null || params === void 0 ? void 0 : params.blinkCursor) !== undefined) {
|
|
4286
4906
|
this.blinkCursor = params.blinkCursor;
|
|
4287
4907
|
}
|
|
4288
|
-
if ((params === null || params === void 0 ? void 0 : params.beforeText) !== undefined) {
|
|
4289
|
-
this.beforeText = params.beforeText;
|
|
4290
|
-
}
|
|
4291
|
-
if ((params === null || params === void 0 ? void 0 : params.afterText) !== undefined) {
|
|
4292
|
-
this.afterText = params.afterText;
|
|
4293
|
-
}
|
|
4294
4908
|
if ((params === null || params === void 0 ? void 0 : params.fadeInChars) !== undefined) {
|
|
4295
4909
|
this.fadeInChars = params.fadeInChars;
|
|
4296
4910
|
}
|
|
4297
4911
|
if ((params === null || params === void 0 ? void 0 : params.fadeInDuration) !== undefined) {
|
|
4298
4912
|
this.fadeInDuration = params.fadeInDuration;
|
|
4299
4913
|
}
|
|
4914
|
+
if ((params === null || params === void 0 ? void 0 : params.strokeFirst) !== undefined) {
|
|
4915
|
+
this.strokeFirst = params.strokeFirst;
|
|
4916
|
+
}
|
|
4917
|
+
if ((params === null || params === void 0 ? void 0 : params.strokeToFillRatio) !== undefined) {
|
|
4918
|
+
this.strokeToFillRatio = params.strokeToFillRatio;
|
|
4919
|
+
}
|
|
4300
4920
|
}
|
|
4301
4921
|
onFirstRun() {
|
|
4302
4922
|
const fromProps = this.getLastProps();
|
|
@@ -4345,11 +4965,30 @@ class InputRichText extends ACustomAnimate {
|
|
|
4345
4965
|
}
|
|
4346
4966
|
else {
|
|
4347
4967
|
currentTextConfig = this.toTextConfig.slice(0, currentLength).map((item, index) => {
|
|
4348
|
-
if (
|
|
4349
|
-
const
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4968
|
+
if ('text' in item) {
|
|
4969
|
+
const newItem = Object.assign({}, item);
|
|
4970
|
+
if (this.strokeFirst) {
|
|
4971
|
+
const appearTime = (index / totalItems) * maxTextShowRatio;
|
|
4972
|
+
const itemLifetime = Math.max(0, ratio - appearTime);
|
|
4973
|
+
const maxLifetime = 1 - appearTime;
|
|
4974
|
+
const fillProgress = Math.min(1, itemLifetime / (this.strokeToFillRatio * maxLifetime));
|
|
4975
|
+
if ('fill' in newItem && newItem.fill) {
|
|
4976
|
+
newItem.stroke = newItem.fill;
|
|
4977
|
+
if (fillProgress < 1) {
|
|
4978
|
+
newItem.fillOpacity = fillProgress;
|
|
4979
|
+
}
|
|
4980
|
+
}
|
|
4981
|
+
if (this.fadeInChars) {
|
|
4982
|
+
const fadeProgress = Math.min(1, itemLifetime / (this.fadeInDuration * maxLifetime));
|
|
4983
|
+
newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
else if (this.fadeInChars) {
|
|
4987
|
+
const appearTime = (index / totalItems) * maxTextShowRatio;
|
|
4988
|
+
const fadeProgress = (ratio - appearTime) / this.fadeInDuration;
|
|
4989
|
+
newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
|
|
4990
|
+
}
|
|
4991
|
+
return newItem;
|
|
4353
4992
|
}
|
|
4354
4993
|
return item;
|
|
4355
4994
|
});
|
|
@@ -4958,7 +5597,7 @@ class ScaleIn extends ACustomAnimate {
|
|
|
4958
5597
|
super(from, to, duration, easing, params);
|
|
4959
5598
|
}
|
|
4960
5599
|
onBind() {
|
|
4961
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
5600
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
4962
5601
|
super.onBind();
|
|
4963
5602
|
let from;
|
|
4964
5603
|
let to;
|
|
@@ -4986,12 +5625,14 @@ class ScaleIn extends ACustomAnimate {
|
|
|
4986
5625
|
}
|
|
4987
5626
|
const finalAttribute = this.target.getFinalAttribute();
|
|
4988
5627
|
if (finalAttribute) {
|
|
4989
|
-
|
|
5628
|
+
this.target.setAttributes(finalAttribute);
|
|
4990
5629
|
}
|
|
4991
5630
|
this.props = to;
|
|
4992
5631
|
this.from = from;
|
|
4993
5632
|
this.to = to;
|
|
4994
|
-
this.
|
|
5633
|
+
if (((_l = this.params.controlOptions) === null || _l === void 0 ? void 0 : _l.immediatelyApply) !== false) {
|
|
5634
|
+
this.target.setAttributes(from);
|
|
5635
|
+
}
|
|
4995
5636
|
}
|
|
4996
5637
|
onEnd(cb) {
|
|
4997
5638
|
super.onEnd(cb);
|
|
@@ -5030,6 +5671,7 @@ class ScaleIn extends ACustomAnimate {
|
|
|
5030
5671
|
if (this._updateFunction) {
|
|
5031
5672
|
this._updateFunction(ratio);
|
|
5032
5673
|
this.target.addUpdatePositionTag();
|
|
5674
|
+
this.target.addUpdateBoundTag();
|
|
5033
5675
|
}
|
|
5034
5676
|
}
|
|
5035
5677
|
}
|
|
@@ -5073,6 +5715,7 @@ class ScaleOut extends ACustomAnimate {
|
|
|
5073
5715
|
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
5074
5716
|
});
|
|
5075
5717
|
this.target.addUpdatePositionTag();
|
|
5718
|
+
this.target.addUpdateBoundTag();
|
|
5076
5719
|
}
|
|
5077
5720
|
}
|
|
5078
5721
|
|
|
@@ -5227,6 +5870,155 @@ class SpinIn extends ACustomAnimate {
|
|
|
5227
5870
|
this.target.addUpdateShapeAndBoundsTag();
|
|
5228
5871
|
}
|
|
5229
5872
|
}
|
|
5873
|
+
class StrokeIn extends ACustomAnimate {
|
|
5874
|
+
constructor(from, to, duration, easing, params) {
|
|
5875
|
+
super(from, to, duration, easing, params);
|
|
5876
|
+
this.perimeter = 0;
|
|
5877
|
+
this.originalAttributes = {};
|
|
5878
|
+
}
|
|
5879
|
+
onBind() {
|
|
5880
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
5881
|
+
super.onBind();
|
|
5882
|
+
this.originalAttributes = Object.assign({}, this.target.getAttributes());
|
|
5883
|
+
if (this.target.type === 'rect') {
|
|
5884
|
+
const attr = this.target.attribute;
|
|
5885
|
+
const width = (_a = attr.width) !== null && _a !== void 0 ? _a : 100;
|
|
5886
|
+
const height = (_b = attr.height) !== null && _b !== void 0 ? _b : 100;
|
|
5887
|
+
this.perimeter = 2 * (width + height);
|
|
5888
|
+
}
|
|
5889
|
+
else if (this.target.type === 'circle') {
|
|
5890
|
+
const attr = this.target.attribute;
|
|
5891
|
+
const radius = (_c = attr.radius) !== null && _c !== void 0 ? _c : 50;
|
|
5892
|
+
this.perimeter = 2 * Math.PI * radius;
|
|
5893
|
+
}
|
|
5894
|
+
else if (this.target.type === 'ellipse') {
|
|
5895
|
+
const attr = this.target.attribute;
|
|
5896
|
+
const radiusX = (_d = attr.radiusX) !== null && _d !== void 0 ? _d : 50;
|
|
5897
|
+
const radiusY = (_e = attr.radiusY) !== null && _e !== void 0 ? _e : 50;
|
|
5898
|
+
this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
|
|
5899
|
+
}
|
|
5900
|
+
else {
|
|
5901
|
+
this.perimeter = 1000;
|
|
5902
|
+
}
|
|
5903
|
+
const lineWidth = (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.lineWidth) !== null && _g !== void 0 ? _g : 2;
|
|
5904
|
+
const strokeColor = (_j = (_h = this.params) === null || _h === void 0 ? void 0 : _h.strokeColor) !== null && _j !== void 0 ? _j : 'black';
|
|
5905
|
+
const fromOpacity = (_l = (_k = this.params) === null || _k === void 0 ? void 0 : _k.fromOpacity) !== null && _l !== void 0 ? _l : 1;
|
|
5906
|
+
const dashLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.dashLength) !== null && _o !== void 0 ? _o : this.perimeter;
|
|
5907
|
+
const showFill = (_q = (_p = this.params) === null || _p === void 0 ? void 0 : _p.showFill) !== null && _q !== void 0 ? _q : false;
|
|
5908
|
+
const fillOpacity = (_s = (_r = this.params) === null || _r === void 0 ? void 0 : _r.fillOpacity) !== null && _s !== void 0 ? _s : 0;
|
|
5909
|
+
this.from = {
|
|
5910
|
+
lineDash: [dashLength, dashLength],
|
|
5911
|
+
lineDashOffset: dashLength,
|
|
5912
|
+
lineWidth,
|
|
5913
|
+
stroke: strokeColor,
|
|
5914
|
+
strokeOpacity: fromOpacity
|
|
5915
|
+
};
|
|
5916
|
+
this.to = {
|
|
5917
|
+
lineDash: [dashLength, dashLength],
|
|
5918
|
+
lineDashOffset: 0,
|
|
5919
|
+
lineWidth,
|
|
5920
|
+
stroke: strokeColor,
|
|
5921
|
+
strokeOpacity: fromOpacity
|
|
5922
|
+
};
|
|
5923
|
+
if (showFill) {
|
|
5924
|
+
this.from.fillOpacity = fillOpacity;
|
|
5925
|
+
this.to.fillOpacity = (_t = this.originalAttributes.fillOpacity) !== null && _t !== void 0 ? _t : 1;
|
|
5926
|
+
}
|
|
5927
|
+
else {
|
|
5928
|
+
this.from.fillOpacity = 0;
|
|
5929
|
+
this.to.fillOpacity = 0;
|
|
5930
|
+
}
|
|
5931
|
+
this.propKeys = ['lineDash', 'lineDashOffset', 'lineWidth', 'stroke', 'strokeOpacity', 'fillOpacity'];
|
|
5932
|
+
this.props = this.to;
|
|
5933
|
+
this.target.setAttributes(this.from);
|
|
5934
|
+
}
|
|
5935
|
+
onUpdate(end, ratio, out) {
|
|
5936
|
+
var _a;
|
|
5937
|
+
const attribute = this.target.attribute;
|
|
5938
|
+
attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio;
|
|
5939
|
+
if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill) {
|
|
5940
|
+
attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio;
|
|
5941
|
+
}
|
|
5942
|
+
}
|
|
5943
|
+
onEnd() {
|
|
5944
|
+
var _a;
|
|
5945
|
+
super.onEnd();
|
|
5946
|
+
if (!((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill)) {
|
|
5947
|
+
const originalAttrs = Object.assign({}, this.originalAttributes);
|
|
5948
|
+
originalAttrs.fillOpacity = 0;
|
|
5949
|
+
this.target.setAttributes(originalAttrs);
|
|
5950
|
+
}
|
|
5951
|
+
}
|
|
5952
|
+
}
|
|
5953
|
+
class StrokeOut extends ACustomAnimate {
|
|
5954
|
+
constructor(from, to, duration, easing, params) {
|
|
5955
|
+
super(from, to, duration, easing, params);
|
|
5956
|
+
this.perimeter = 0;
|
|
5957
|
+
this.originalAttributes = {};
|
|
5958
|
+
}
|
|
5959
|
+
onFirstRun() {
|
|
5960
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
5961
|
+
this.originalAttributes = Object.assign({}, this.target.getAttributes());
|
|
5962
|
+
if (this.target.type === 'rect') {
|
|
5963
|
+
const attr = this.target.attribute;
|
|
5964
|
+
const width = (_a = attr.width) !== null && _a !== void 0 ? _a : 100;
|
|
5965
|
+
const height = (_b = attr.height) !== null && _b !== void 0 ? _b : 100;
|
|
5966
|
+
this.perimeter = 2 * (width + height);
|
|
5967
|
+
}
|
|
5968
|
+
else if (this.target.type === 'circle') {
|
|
5969
|
+
const attr = this.target.attribute;
|
|
5970
|
+
const radius = (_c = attr.radius) !== null && _c !== void 0 ? _c : 50;
|
|
5971
|
+
this.perimeter = 2 * Math.PI * radius;
|
|
5972
|
+
}
|
|
5973
|
+
else if (this.target.type === 'ellipse') {
|
|
5974
|
+
const attr = this.target.attribute;
|
|
5975
|
+
const radiusX = (_d = attr.radiusX) !== null && _d !== void 0 ? _d : 50;
|
|
5976
|
+
const radiusY = (_e = attr.radiusY) !== null && _e !== void 0 ? _e : 50;
|
|
5977
|
+
this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
|
|
5978
|
+
}
|
|
5979
|
+
else {
|
|
5980
|
+
this.perimeter = 1000;
|
|
5981
|
+
}
|
|
5982
|
+
const lineWidth = (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.lineWidth) !== null && _g !== void 0 ? _g : 2;
|
|
5983
|
+
const strokeColor = (_j = (_h = this.params) === null || _h === void 0 ? void 0 : _h.strokeColor) !== null && _j !== void 0 ? _j : 'black';
|
|
5984
|
+
const fromOpacity = (_l = (_k = this.params) === null || _k === void 0 ? void 0 : _k.fromOpacity) !== null && _l !== void 0 ? _l : 1;
|
|
5985
|
+
const dashLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.dashLength) !== null && _o !== void 0 ? _o : this.perimeter;
|
|
5986
|
+
const showFill = (_q = (_p = this.params) === null || _p === void 0 ? void 0 : _p.showFill) !== null && _q !== void 0 ? _q : false;
|
|
5987
|
+
this.from = {
|
|
5988
|
+
lineDash: [dashLength, dashLength],
|
|
5989
|
+
lineDashOffset: 0,
|
|
5990
|
+
lineWidth,
|
|
5991
|
+
stroke: strokeColor,
|
|
5992
|
+
strokeOpacity: fromOpacity
|
|
5993
|
+
};
|
|
5994
|
+
this.to = {
|
|
5995
|
+
lineDash: [dashLength, dashLength],
|
|
5996
|
+
lineDashOffset: -dashLength,
|
|
5997
|
+
lineWidth,
|
|
5998
|
+
stroke: strokeColor,
|
|
5999
|
+
strokeOpacity: fromOpacity
|
|
6000
|
+
};
|
|
6001
|
+
if (showFill) {
|
|
6002
|
+
this.from.fillOpacity = (_r = this.originalAttributes.fillOpacity) !== null && _r !== void 0 ? _r : 1;
|
|
6003
|
+
this.to.fillOpacity = 0;
|
|
6004
|
+
}
|
|
6005
|
+
else {
|
|
6006
|
+
this.from.fillOpacity = 0;
|
|
6007
|
+
this.to.fillOpacity = 0;
|
|
6008
|
+
}
|
|
6009
|
+
this.propKeys = ['lineDash', 'lineDashOffset', 'lineWidth', 'stroke', 'strokeOpacity', 'fillOpacity'];
|
|
6010
|
+
this.props = this.to;
|
|
6011
|
+
this.target.setAttributes(this.from);
|
|
6012
|
+
}
|
|
6013
|
+
onUpdate(end, ratio, out) {
|
|
6014
|
+
var _a;
|
|
6015
|
+
const attribute = this.target.attribute;
|
|
6016
|
+
attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio;
|
|
6017
|
+
if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill) {
|
|
6018
|
+
attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio;
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
6021
|
+
}
|
|
5230
6022
|
class MoveScaleIn extends ACustomAnimate {
|
|
5231
6023
|
constructor(from, to, duration, easing, params) {
|
|
5232
6024
|
var _a;
|
|
@@ -5505,6 +6297,121 @@ class MoveRotateOut extends ACustomAnimate {
|
|
|
5505
6297
|
onUpdate(end, ratio, out) {
|
|
5506
6298
|
}
|
|
5507
6299
|
}
|
|
6300
|
+
class PulseAnimate extends ACustomAnimate {
|
|
6301
|
+
constructor(from, to, duration, easing, params) {
|
|
6302
|
+
super(from, to, duration, easing, params);
|
|
6303
|
+
this.originalAttributes = {};
|
|
6304
|
+
this.pulseCount = 3;
|
|
6305
|
+
this.pulseOpacity = 0.3;
|
|
6306
|
+
this.pulseScale = 1.05;
|
|
6307
|
+
this.pulseColor = null;
|
|
6308
|
+
this.pulseColorIntensity = 0.2;
|
|
6309
|
+
this.strokeOnly = false;
|
|
6310
|
+
this.fillOnly = false;
|
|
6311
|
+
this.useScale = true;
|
|
6312
|
+
this.useOpacity = true;
|
|
6313
|
+
this.useStroke = true;
|
|
6314
|
+
this.useFill = true;
|
|
6315
|
+
this.useColor = false;
|
|
6316
|
+
this.originalFill = null;
|
|
6317
|
+
this.originalStroke = null;
|
|
6318
|
+
if ((params === null || params === void 0 ? void 0 : params.pulseCount) !== undefined) {
|
|
6319
|
+
this.pulseCount = params.pulseCount;
|
|
6320
|
+
}
|
|
6321
|
+
if ((params === null || params === void 0 ? void 0 : params.pulseScale) !== undefined) {
|
|
6322
|
+
this.pulseScale = params.pulseScale;
|
|
6323
|
+
}
|
|
6324
|
+
if ((params === null || params === void 0 ? void 0 : params.pulseColor) !== undefined) {
|
|
6325
|
+
this.pulseColor = params.pulseColor;
|
|
6326
|
+
}
|
|
6327
|
+
if ((params === null || params === void 0 ? void 0 : params.pulseColorIntensity) !== undefined) {
|
|
6328
|
+
this.pulseColorIntensity = params.pulseColorIntensity;
|
|
6329
|
+
}
|
|
6330
|
+
if ((params === null || params === void 0 ? void 0 : params.strokeOnly) !== undefined) {
|
|
6331
|
+
this.strokeOnly = params.strokeOnly;
|
|
6332
|
+
}
|
|
6333
|
+
if ((params === null || params === void 0 ? void 0 : params.fillOnly) !== undefined) {
|
|
6334
|
+
this.fillOnly = params.fillOnly;
|
|
6335
|
+
}
|
|
6336
|
+
if ((params === null || params === void 0 ? void 0 : params.useScale) !== undefined) {
|
|
6337
|
+
this.useScale = params.useScale;
|
|
6338
|
+
}
|
|
6339
|
+
if ((params === null || params === void 0 ? void 0 : params.useOpacity) !== undefined) {
|
|
6340
|
+
this.useOpacity = params.useOpacity;
|
|
6341
|
+
}
|
|
6342
|
+
if ((params === null || params === void 0 ? void 0 : params.useStroke) !== undefined) {
|
|
6343
|
+
this.useStroke = params.useStroke;
|
|
6344
|
+
}
|
|
6345
|
+
if ((params === null || params === void 0 ? void 0 : params.useFill) !== undefined) {
|
|
6346
|
+
this.useFill = params.useFill;
|
|
6347
|
+
}
|
|
6348
|
+
if ((params === null || params === void 0 ? void 0 : params.useColor) !== undefined) {
|
|
6349
|
+
this.useColor = params.useColor;
|
|
6350
|
+
}
|
|
6351
|
+
}
|
|
6352
|
+
onBind() {
|
|
6353
|
+
super.onBind();
|
|
6354
|
+
this.originalAttributes = Object.assign({}, this.target.getAttributes());
|
|
6355
|
+
if (this.useColor) {
|
|
6356
|
+
this.originalFill = this.originalAttributes.fill || null;
|
|
6357
|
+
this.originalStroke = this.originalAttributes.stroke || null;
|
|
6358
|
+
if (!this.pulseColor) {
|
|
6359
|
+
if (this.fillOnly && this.originalFill) {
|
|
6360
|
+
this.pulseColor = this.originalFill;
|
|
6361
|
+
}
|
|
6362
|
+
else if (this.strokeOnly && this.originalStroke) {
|
|
6363
|
+
this.pulseColor = this.originalStroke;
|
|
6364
|
+
}
|
|
6365
|
+
else if (this.originalFill) {
|
|
6366
|
+
this.pulseColor = this.originalFill;
|
|
6367
|
+
}
|
|
6368
|
+
else if (this.originalStroke) {
|
|
6369
|
+
this.pulseColor = this.originalStroke;
|
|
6370
|
+
}
|
|
6371
|
+
else {
|
|
6372
|
+
this.pulseColor = '#FFFFFF';
|
|
6373
|
+
}
|
|
6374
|
+
}
|
|
6375
|
+
}
|
|
6376
|
+
}
|
|
6377
|
+
onUpdate(end, ratio, out) {
|
|
6378
|
+
const angle = ratio * Math.PI * this.pulseCount;
|
|
6379
|
+
const pulseValue = Math.abs(Math.sin(angle));
|
|
6380
|
+
const attribute = this.target.attribute;
|
|
6381
|
+
if (this.useOpacity) {
|
|
6382
|
+
const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
|
|
6383
|
+
if (this.useStroke) {
|
|
6384
|
+
attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity;
|
|
6385
|
+
}
|
|
6386
|
+
if (this.useFill) {
|
|
6387
|
+
attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity;
|
|
6388
|
+
}
|
|
6389
|
+
}
|
|
6390
|
+
if (this.useScale) {
|
|
6391
|
+
const scale = 1 + (this.pulseScale - 1) * pulseValue;
|
|
6392
|
+
attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale;
|
|
6393
|
+
attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
|
|
6394
|
+
}
|
|
6395
|
+
if (this.useColor && this.pulseColor) {
|
|
6396
|
+
this.applyColorPulse(attribute, pulseValue);
|
|
6397
|
+
}
|
|
6398
|
+
this.target.addUpdateShapeAndBoundsTag();
|
|
6399
|
+
this.target.addUpdatePositionTag();
|
|
6400
|
+
}
|
|
6401
|
+
applyColorPulse(attribute, pulseValue) {
|
|
6402
|
+
const colorRatio = this.pulseColorIntensity * pulseValue;
|
|
6403
|
+
if (this.useFill && this.originalFill && this.pulseColor) {
|
|
6404
|
+
attribute.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, true);
|
|
6405
|
+
}
|
|
6406
|
+
if (this.useStroke && this.originalStroke && this.pulseColor) {
|
|
6407
|
+
attribute.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, true);
|
|
6408
|
+
}
|
|
6409
|
+
}
|
|
6410
|
+
onEnd() {
|
|
6411
|
+
super.onEnd();
|
|
6412
|
+
this.target.setAttributes(this.originalAttributes);
|
|
6413
|
+
}
|
|
6414
|
+
}
|
|
5508
6415
|
|
|
5509
6416
|
class Update extends ACustomAnimate {
|
|
5510
6417
|
constructor(from, to, duration, easing, params) {
|
|
@@ -5515,8 +6422,8 @@ class Update extends ACustomAnimate {
|
|
|
5515
6422
|
super.onBind();
|
|
5516
6423
|
let { diffAttrs = {} } = (_a = this.target.context) !== null && _a !== void 0 ? _a : {};
|
|
5517
6424
|
const { options } = this.params;
|
|
6425
|
+
diffAttrs = Object.assign({}, diffAttrs);
|
|
5518
6426
|
if ((_b = options === null || options === void 0 ? void 0 : options.excludeChannels) === null || _b === void 0 ? void 0 : _b.length) {
|
|
5519
|
-
diffAttrs = Object.assign({}, diffAttrs);
|
|
5520
6427
|
options.excludeChannels.forEach((channel) => {
|
|
5521
6428
|
delete diffAttrs[channel];
|
|
5522
6429
|
});
|
|
@@ -5545,25 +6452,19 @@ class Update extends ACustomAnimate {
|
|
|
5545
6452
|
}
|
|
5546
6453
|
|
|
5547
6454
|
const moveIn = (graphic, options, animationParameters) => {
|
|
5548
|
-
var _a, _b;
|
|
5549
|
-
const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [] } = options !== null && options !== void 0 ? options : {};
|
|
6455
|
+
var _a, _b, _c, _d;
|
|
6456
|
+
const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [], layoutRect = {} } = options !== null && options !== void 0 ? options : {};
|
|
5550
6457
|
let changedX = 0;
|
|
5551
6458
|
let changedY = 0;
|
|
5552
6459
|
if (orient === 'negative') {
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
changedY = (_b = animationParameters.groupHeight) !== null && _b !== void 0 ? _b : animationParameters.group.getBounds().height();
|
|
5556
|
-
animationParameters.groupWidth = changedX;
|
|
5557
|
-
animationParameters.groupHeight = changedY;
|
|
5558
|
-
}
|
|
5559
|
-
else {
|
|
5560
|
-
changedX = animationParameters.width;
|
|
5561
|
-
changedY = animationParameters.height;
|
|
5562
|
-
}
|
|
6460
|
+
changedX = (_a = layoutRect.width) !== null && _a !== void 0 ? _a : graphic.stage.viewWidth;
|
|
6461
|
+
changedY = (_b = layoutRect.height) !== null && _b !== void 0 ? _b : graphic.stage.viewHeight;
|
|
5563
6462
|
}
|
|
5564
6463
|
changedX += offset;
|
|
5565
6464
|
changedY += offset;
|
|
5566
|
-
const point = isFunction(pointOpt)
|
|
6465
|
+
const point = isFunction(pointOpt)
|
|
6466
|
+
? pointOpt.call(null, (_d = (_c = graphic.context) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[0], graphic, animationParameters)
|
|
6467
|
+
: pointOpt;
|
|
5567
6468
|
const fromX = point && isValidNumber(point.x) ? point.x : changedX;
|
|
5568
6469
|
const fromY = point && isValidNumber(point.y) ? point.y : changedY;
|
|
5569
6470
|
const finalAttrs = graphic.getFinalAttribute();
|
|
@@ -5592,14 +6493,15 @@ const moveIn = (graphic, options, animationParameters) => {
|
|
|
5592
6493
|
}
|
|
5593
6494
|
};
|
|
5594
6495
|
const moveOut = (graphic, options, animationParameters) => {
|
|
5595
|
-
var _a, _b;
|
|
6496
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5596
6497
|
const { offset = 0, orient, direction, point: pointOpt } = options !== null && options !== void 0 ? options : {};
|
|
5597
|
-
const
|
|
5598
|
-
const
|
|
5599
|
-
const groupHeight = (_b = groupBounds === null || groupBounds === void 0 ? void 0 : groupBounds.height()) !== null && _b !== void 0 ? _b : animationParameters.height;
|
|
6498
|
+
const groupWidth = (_b = (_a = options.layoutRect) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : graphic.stage.viewWidth;
|
|
6499
|
+
const groupHeight = (_d = (_c = options.layoutRect) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : graphic.stage.viewHeight;
|
|
5600
6500
|
const changedX = (orient === 'negative' ? groupWidth : 0) + offset;
|
|
5601
6501
|
const changedY = (orient === 'negative' ? groupHeight : 0) + offset;
|
|
5602
|
-
const point = isFunction(pointOpt)
|
|
6502
|
+
const point = isFunction(pointOpt)
|
|
6503
|
+
? pointOpt.call(null, (_f = (_e = graphic.context) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f[0], graphic, animationParameters)
|
|
6504
|
+
: pointOpt;
|
|
5603
6505
|
const fromX = point && isValidNumber(point.x) ? point.x : changedX;
|
|
5604
6506
|
const fromY = point && isValidNumber(point.y) ? point.y : changedY;
|
|
5605
6507
|
switch (direction) {
|
|
@@ -5639,6 +6541,7 @@ class MoveBase extends ACustomAnimate {
|
|
|
5639
6541
|
}
|
|
5640
6542
|
class MoveIn extends MoveBase {
|
|
5641
6543
|
onBind() {
|
|
6544
|
+
var _a;
|
|
5642
6545
|
super.onBind();
|
|
5643
6546
|
const { from, to } = moveIn(this.target, this.params.options, this.params);
|
|
5644
6547
|
this.props = to;
|
|
@@ -5647,9 +6550,11 @@ class MoveIn extends MoveBase {
|
|
|
5647
6550
|
this.to = to;
|
|
5648
6551
|
const finalAttribute = this.target.getFinalAttribute();
|
|
5649
6552
|
if (finalAttribute) {
|
|
5650
|
-
|
|
6553
|
+
this.target.setAttributes(finalAttribute);
|
|
6554
|
+
}
|
|
6555
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
6556
|
+
this.target.setAttributes(from);
|
|
5651
6557
|
}
|
|
5652
|
-
this.target.setAttributes(from);
|
|
5653
6558
|
}
|
|
5654
6559
|
}
|
|
5655
6560
|
class MoveOut extends MoveBase {
|
|
@@ -5722,6 +6627,7 @@ class RotateBase extends ACustomAnimate {
|
|
|
5722
6627
|
}
|
|
5723
6628
|
class RotateIn extends RotateBase {
|
|
5724
6629
|
onBind() {
|
|
6630
|
+
var _a;
|
|
5725
6631
|
super.onBind();
|
|
5726
6632
|
const { from, to } = rotateIn(this.target, this.params.options);
|
|
5727
6633
|
this.props = to;
|
|
@@ -5730,9 +6636,11 @@ class RotateIn extends RotateBase {
|
|
|
5730
6636
|
this.to = to;
|
|
5731
6637
|
const finalAttribute = this.target.getFinalAttribute();
|
|
5732
6638
|
if (finalAttribute) {
|
|
5733
|
-
|
|
6639
|
+
this.target.setAttributes(finalAttribute);
|
|
6640
|
+
}
|
|
6641
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
6642
|
+
this.target.setAttributes(from);
|
|
5734
6643
|
}
|
|
5735
|
-
this.target.setAttributes(from);
|
|
5736
6644
|
}
|
|
5737
6645
|
}
|
|
5738
6646
|
class RotateOut extends RotateBase {
|
|
@@ -5746,12 +6654,46 @@ class RotateOut extends RotateBase {
|
|
|
5746
6654
|
}
|
|
5747
6655
|
}
|
|
5748
6656
|
|
|
6657
|
+
class MotionPath extends ACustomAnimate {
|
|
6658
|
+
constructor(from, to, duration, easing, params) {
|
|
6659
|
+
var _a;
|
|
6660
|
+
super(from, to, duration, easing, params);
|
|
6661
|
+
if (params) {
|
|
6662
|
+
this.pathLength = params.path.getLength();
|
|
6663
|
+
this.path = params.path;
|
|
6664
|
+
this.distance = params.distance;
|
|
6665
|
+
this.totalLength = this.distance * this.pathLength;
|
|
6666
|
+
this.initAngle = (_a = params.initAngle) !== null && _a !== void 0 ? _a : 0;
|
|
6667
|
+
this.changeAngle = !!params.changeAngle;
|
|
6668
|
+
this.cb = params.cb;
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
onBind() {
|
|
6672
|
+
this.from = { x: 0, y: 0 };
|
|
6673
|
+
this.to = this.path.getAttrAt(this.totalLength).pos;
|
|
6674
|
+
this.props = this.to;
|
|
6675
|
+
}
|
|
6676
|
+
onUpdate(end, ratio, out) {
|
|
6677
|
+
const attrs = {};
|
|
6678
|
+
const at = this.totalLength * ratio;
|
|
6679
|
+
const { pos, angle } = this.path.getAttrAt(at);
|
|
6680
|
+
attrs.x = pos.x;
|
|
6681
|
+
attrs.y = pos.y;
|
|
6682
|
+
if (this.changeAngle) {
|
|
6683
|
+
attrs.angle = angle + this.initAngle;
|
|
6684
|
+
}
|
|
6685
|
+
this.cb && this.cb(this.from, this.to, ratio, this.target);
|
|
6686
|
+
this.target.setAttributes(attrs);
|
|
6687
|
+
}
|
|
6688
|
+
}
|
|
6689
|
+
|
|
5749
6690
|
class FromTo extends ACustomAnimate {
|
|
5750
6691
|
constructor(from, to, duration, easing, params) {
|
|
5751
6692
|
super(from, to, duration, easing, params);
|
|
5752
6693
|
this.from = from !== null && from !== void 0 ? from : {};
|
|
5753
6694
|
}
|
|
5754
6695
|
onBind() {
|
|
6696
|
+
var _a, _b;
|
|
5755
6697
|
super.onBind();
|
|
5756
6698
|
const finalAttribute = this.target.getFinalAttribute();
|
|
5757
6699
|
Object.keys(this.from).forEach(key => {
|
|
@@ -5759,9 +6701,16 @@ class FromTo extends ACustomAnimate {
|
|
|
5759
6701
|
this.props[key] = finalAttribute[key];
|
|
5760
6702
|
}
|
|
5761
6703
|
});
|
|
6704
|
+
if (((_a = this.target.context) === null || _a === void 0 ? void 0 : _a.animationState) === 'appear') {
|
|
6705
|
+
if (finalAttribute) {
|
|
6706
|
+
this.target.setAttributes(finalAttribute);
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
if (((_b = this.params.controlOptions) === null || _b === void 0 ? void 0 : _b.immediatelyApply) !== false) {
|
|
6710
|
+
this.target.setAttributes(this.from);
|
|
6711
|
+
}
|
|
5762
6712
|
}
|
|
5763
6713
|
onFirstRun() {
|
|
5764
|
-
var _a;
|
|
5765
6714
|
this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
|
|
5766
6715
|
const startProps = this.animate.getStartProps();
|
|
5767
6716
|
this.propKeys &&
|
|
@@ -5769,10 +6718,6 @@ class FromTo extends ACustomAnimate {
|
|
|
5769
6718
|
var _a;
|
|
5770
6719
|
this.from[key] = (_a = this.from[key]) !== null && _a !== void 0 ? _a : startProps[key];
|
|
5771
6720
|
});
|
|
5772
|
-
if (((_a = this.target.context) === null || _a === void 0 ? void 0 : _a.animationState) === 'appear') {
|
|
5773
|
-
const finalAttribute = this.target.getFinalAttribute();
|
|
5774
|
-
this.target.setAttributes(finalAttribute);
|
|
5775
|
-
}
|
|
5776
6721
|
this.target.setAttributes(this.from);
|
|
5777
6722
|
}
|
|
5778
6723
|
update(end, ratio, out) {
|
|
@@ -5797,6 +6742,244 @@ class FromTo extends ACustomAnimate {
|
|
|
5797
6742
|
}
|
|
5798
6743
|
}
|
|
5799
6744
|
|
|
6745
|
+
class StreamLight extends ACustomAnimate {
|
|
6746
|
+
constructor(from, to, duration, easing, params) {
|
|
6747
|
+
super(from, to, duration, easing, params);
|
|
6748
|
+
}
|
|
6749
|
+
getEndProps() {
|
|
6750
|
+
return {};
|
|
6751
|
+
}
|
|
6752
|
+
onStart() {
|
|
6753
|
+
if (!this.target) {
|
|
6754
|
+
return;
|
|
6755
|
+
}
|
|
6756
|
+
if (this.target.type === 'rect') {
|
|
6757
|
+
this.onStartRect();
|
|
6758
|
+
}
|
|
6759
|
+
else if (this.target.type === 'line') {
|
|
6760
|
+
this.onStartLineOrArea('line');
|
|
6761
|
+
}
|
|
6762
|
+
else if (this.target.type === 'area') {
|
|
6763
|
+
this.onStartLineOrArea('area');
|
|
6764
|
+
}
|
|
6765
|
+
}
|
|
6766
|
+
onStartLineOrArea(type) {
|
|
6767
|
+
var _a;
|
|
6768
|
+
const root = this.target.attachShadow();
|
|
6769
|
+
const line = application.graphicService.creator[type](Object.assign({}, (_a = this.params) === null || _a === void 0 ? void 0 : _a.attribute));
|
|
6770
|
+
this[type] = line;
|
|
6771
|
+
line.pathProxy = new CustomPath2D();
|
|
6772
|
+
root.add(line);
|
|
6773
|
+
}
|
|
6774
|
+
onStartRect() {
|
|
6775
|
+
var _a, _b, _c;
|
|
6776
|
+
const root = this.target.attachShadow();
|
|
6777
|
+
const isHorizontal = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.isHorizontal) !== null && _b !== void 0 ? _b : true;
|
|
6778
|
+
const sizeAttr = isHorizontal ? 'height' : 'width';
|
|
6779
|
+
const otherSizeAttr = isHorizontal ? 'width' : 'height';
|
|
6780
|
+
const size = this.target.AABBBounds[sizeAttr]();
|
|
6781
|
+
const y = isHorizontal ? 0 : this.target.AABBBounds.y1;
|
|
6782
|
+
const rect = application.graphicService.creator.rect(Object.assign(Object.assign({ [sizeAttr]: size, fill: '#bcdeff', shadowBlur: 30, shadowColor: '#bcdeff' }, (_c = this.params) === null || _c === void 0 ? void 0 : _c.attribute), { x: 0, y, [otherSizeAttr]: 0 }));
|
|
6783
|
+
this.rect = rect;
|
|
6784
|
+
root.add(rect);
|
|
6785
|
+
}
|
|
6786
|
+
onBind() {
|
|
6787
|
+
return;
|
|
6788
|
+
}
|
|
6789
|
+
onEnd() {
|
|
6790
|
+
this.target.detachShadow();
|
|
6791
|
+
}
|
|
6792
|
+
onUpdate(end, ratio, out) {
|
|
6793
|
+
if (this.rect) {
|
|
6794
|
+
return this.onUpdateRect(end, ratio, out);
|
|
6795
|
+
}
|
|
6796
|
+
else if (this.line || this.area) {
|
|
6797
|
+
return this.onUpdateLineOrArea(end, ratio, out);
|
|
6798
|
+
}
|
|
6799
|
+
}
|
|
6800
|
+
onUpdateRect(end, ratio, out) {
|
|
6801
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
6802
|
+
const isHorizontal = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.isHorizontal) !== null && _b !== void 0 ? _b : true;
|
|
6803
|
+
const parentAttr = this.target.attribute;
|
|
6804
|
+
if (isHorizontal) {
|
|
6805
|
+
const parentWidth = (_d = (_c = parentAttr.width) !== null && _c !== void 0 ? _c : Math.abs(parentAttr.x1 - parentAttr.x)) !== null && _d !== void 0 ? _d : 250;
|
|
6806
|
+
const streamLength = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.streamLength) !== null && _f !== void 0 ? _f : parentWidth;
|
|
6807
|
+
const maxLength = (_j = (_h = (_g = this.params) === null || _g === void 0 ? void 0 : _g.attribute) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 60;
|
|
6808
|
+
const startX = -maxLength;
|
|
6809
|
+
const currentX = startX + (streamLength - startX) * ratio;
|
|
6810
|
+
const x = Math.max(currentX, 0);
|
|
6811
|
+
const w = Math.min(Math.min(currentX + maxLength, maxLength), streamLength - currentX);
|
|
6812
|
+
const width = w + x > parentWidth ? Math.max(parentWidth - x, 0) : w;
|
|
6813
|
+
this.rect.setAttributes({
|
|
6814
|
+
x,
|
|
6815
|
+
width,
|
|
6816
|
+
dx: Math.min(parentAttr.x1 - parentAttr.x, 0)
|
|
6817
|
+
}, false, {
|
|
6818
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
6819
|
+
animationState: {
|
|
6820
|
+
ratio,
|
|
6821
|
+
end
|
|
6822
|
+
}
|
|
6823
|
+
});
|
|
6824
|
+
}
|
|
6825
|
+
else {
|
|
6826
|
+
const parentHeight = (_l = (_k = parentAttr.height) !== null && _k !== void 0 ? _k : Math.abs(parentAttr.y1 - parentAttr.y)) !== null && _l !== void 0 ? _l : 250;
|
|
6827
|
+
const streamLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.streamLength) !== null && _o !== void 0 ? _o : parentHeight;
|
|
6828
|
+
const maxLength = (_r = (_q = (_p = this.params) === null || _p === void 0 ? void 0 : _p.attribute) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : 60;
|
|
6829
|
+
const startY = parentHeight;
|
|
6830
|
+
const currentY = startY - (streamLength + maxLength) * ratio;
|
|
6831
|
+
let y = Math.min(currentY, parentHeight);
|
|
6832
|
+
const h = Math.min(parentHeight - currentY, maxLength);
|
|
6833
|
+
let height;
|
|
6834
|
+
if (y <= 0) {
|
|
6835
|
+
height = Math.max(y + h, 0);
|
|
6836
|
+
y = 0;
|
|
6837
|
+
}
|
|
6838
|
+
else {
|
|
6839
|
+
height = h;
|
|
6840
|
+
}
|
|
6841
|
+
this.rect.setAttributes({
|
|
6842
|
+
y,
|
|
6843
|
+
height,
|
|
6844
|
+
dy: Math.min(parentAttr.y1 - parentAttr.y, 0)
|
|
6845
|
+
}, false, {
|
|
6846
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
6847
|
+
animationState: {
|
|
6848
|
+
ratio,
|
|
6849
|
+
end
|
|
6850
|
+
}
|
|
6851
|
+
});
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6854
|
+
onUpdateLineOrArea(end, ratio, out) {
|
|
6855
|
+
const target = this.line || this.area;
|
|
6856
|
+
if (!target) {
|
|
6857
|
+
return;
|
|
6858
|
+
}
|
|
6859
|
+
const customPath = target.pathProxy;
|
|
6860
|
+
const targetLine = this.target;
|
|
6861
|
+
if (targetLine.cache || targetLine.cacheArea) {
|
|
6862
|
+
this._onUpdateLineOrAreaWithCache(customPath, targetLine, end, ratio, out);
|
|
6863
|
+
}
|
|
6864
|
+
else {
|
|
6865
|
+
this._onUpdateLineWithoutCache(customPath, targetLine, end, ratio, out);
|
|
6866
|
+
}
|
|
6867
|
+
const targetAttrs = targetLine.attribute;
|
|
6868
|
+
target.setAttributes(Object.assign({ stroke: targetAttrs.stroke }, target.attribute));
|
|
6869
|
+
target.addUpdateBoundTag();
|
|
6870
|
+
}
|
|
6871
|
+
_onUpdateLineOrAreaWithCache(customPath, g, end, ratio, out) {
|
|
6872
|
+
var _a, _b;
|
|
6873
|
+
customPath.clear();
|
|
6874
|
+
if (g.type === 'line') {
|
|
6875
|
+
let cache = g.cache;
|
|
6876
|
+
if (!Array.isArray(cache)) {
|
|
6877
|
+
cache = [cache];
|
|
6878
|
+
}
|
|
6879
|
+
const totalLen = cache.reduce((l, c) => l + c.getLength(), 0);
|
|
6880
|
+
const curves = [];
|
|
6881
|
+
cache.forEach((c) => {
|
|
6882
|
+
c.curves.forEach((ci) => curves.push(ci));
|
|
6883
|
+
});
|
|
6884
|
+
return this._updateCurves(customPath, curves, totalLen, ratio);
|
|
6885
|
+
}
|
|
6886
|
+
else if (g.type === 'area' && ((_b = (_a = g.cacheArea) === null || _a === void 0 ? void 0 : _a.top) === null || _b === void 0 ? void 0 : _b.curves)) {
|
|
6887
|
+
const cache = g.cacheArea;
|
|
6888
|
+
const totalLen = cache.top.curves.reduce((a, b) => a + b.getLength(), 0);
|
|
6889
|
+
return this._updateCurves(customPath, cache.top.curves, totalLen, ratio);
|
|
6890
|
+
}
|
|
6891
|
+
}
|
|
6892
|
+
_updateCurves(customPath, curves, totalLen, ratio) {
|
|
6893
|
+
var _a, _b;
|
|
6894
|
+
const startLen = totalLen * ratio;
|
|
6895
|
+
const endLen = Math.min(startLen + ((_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.streamLength) !== null && _b !== void 0 ? _b : 10), totalLen);
|
|
6896
|
+
let lastLen = 0;
|
|
6897
|
+
let start = false;
|
|
6898
|
+
for (let i = 0; i < curves.length; i++) {
|
|
6899
|
+
if (curves[i].defined !== false) {
|
|
6900
|
+
const curveItem = curves[i];
|
|
6901
|
+
const len = curveItem.getLength();
|
|
6902
|
+
const startPercent = 1 - (lastLen + len - startLen) / len;
|
|
6903
|
+
let endPercent = 1 - (lastLen + len - endLen) / len;
|
|
6904
|
+
let curveForStart;
|
|
6905
|
+
if (lastLen < startLen && lastLen + len > startLen) {
|
|
6906
|
+
start = true;
|
|
6907
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
6908
|
+
const [_, curve2] = divideCubic(curveItem, startPercent);
|
|
6909
|
+
customPath.moveTo(curve2.p0.x, curve2.p0.y);
|
|
6910
|
+
curveForStart = curve2;
|
|
6911
|
+
}
|
|
6912
|
+
else {
|
|
6913
|
+
const p = curveItem.getPointAt(startPercent);
|
|
6914
|
+
customPath.moveTo(p.x, p.y);
|
|
6915
|
+
}
|
|
6916
|
+
}
|
|
6917
|
+
if (lastLen < endLen && lastLen + len > endLen) {
|
|
6918
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
6919
|
+
if (curveForStart) {
|
|
6920
|
+
endPercent = (endLen - startLen) / curveForStart.getLength();
|
|
6921
|
+
}
|
|
6922
|
+
const [curve1] = divideCubic(curveForStart || curveItem, endPercent);
|
|
6923
|
+
customPath.bezierCurveTo(curve1.p1.x, curve1.p1.y, curve1.p2.x, curve1.p2.y, curve1.p3.x, curve1.p3.y);
|
|
6924
|
+
}
|
|
6925
|
+
else {
|
|
6926
|
+
const p = curveItem.getPointAt(endPercent);
|
|
6927
|
+
customPath.lineTo(p.x, p.y);
|
|
6928
|
+
}
|
|
6929
|
+
break;
|
|
6930
|
+
}
|
|
6931
|
+
else if (start) {
|
|
6932
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
6933
|
+
const curve = curveForStart || curveItem;
|
|
6934
|
+
customPath.bezierCurveTo(curve.p1.x, curve.p1.y, curve.p2.x, curve.p2.y, curve.p3.x, curve.p3.y);
|
|
6935
|
+
}
|
|
6936
|
+
else {
|
|
6937
|
+
customPath.lineTo(curveItem.p1.x, curveItem.p1.y);
|
|
6938
|
+
}
|
|
6939
|
+
}
|
|
6940
|
+
lastLen += len;
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
}
|
|
6944
|
+
_onUpdateLineWithoutCache(customPath, line, end, ratio, out) {
|
|
6945
|
+
var _a, _b;
|
|
6946
|
+
const { points, curveType } = line.attribute;
|
|
6947
|
+
if (!points || points.length < 2 || curveType !== 'linear') {
|
|
6948
|
+
return;
|
|
6949
|
+
}
|
|
6950
|
+
let totalLen = 0;
|
|
6951
|
+
for (let i = 1; i < points.length; i++) {
|
|
6952
|
+
totalLen += PointService.distancePP(points[i], points[i - 1]);
|
|
6953
|
+
}
|
|
6954
|
+
const startLen = totalLen * ratio;
|
|
6955
|
+
const endLen = Math.min(startLen + ((_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.streamLength) !== null && _b !== void 0 ? _b : 10), totalLen);
|
|
6956
|
+
const nextPoints = [];
|
|
6957
|
+
let lastLen = 0;
|
|
6958
|
+
for (let i = 1; i < points.length; i++) {
|
|
6959
|
+
const len = PointService.distancePP(points[i], points[i - 1]);
|
|
6960
|
+
if (lastLen < startLen && lastLen + len > startLen) {
|
|
6961
|
+
nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - startLen) / len));
|
|
6962
|
+
}
|
|
6963
|
+
if (lastLen < endLen && lastLen + len > endLen) {
|
|
6964
|
+
nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - endLen) / len));
|
|
6965
|
+
break;
|
|
6966
|
+
}
|
|
6967
|
+
else if (nextPoints.length) {
|
|
6968
|
+
nextPoints.push(points[i]);
|
|
6969
|
+
}
|
|
6970
|
+
lastLen += len;
|
|
6971
|
+
}
|
|
6972
|
+
if (!nextPoints.length || nextPoints.length < 2) {
|
|
6973
|
+
return;
|
|
6974
|
+
}
|
|
6975
|
+
customPath.clear();
|
|
6976
|
+
customPath.moveTo(nextPoints[0].x, nextPoints[0].y);
|
|
6977
|
+
for (let i = 1; i < nextPoints.length; i++) {
|
|
6978
|
+
customPath.lineTo(nextPoints[i].x, nextPoints[i].y);
|
|
6979
|
+
}
|
|
6980
|
+
}
|
|
6981
|
+
}
|
|
6982
|
+
|
|
5800
6983
|
const registerCustomAnimate = () => {
|
|
5801
6984
|
AnimateExecutor.registerBuiltInAnimate('increaseCount', IncreaseCount);
|
|
5802
6985
|
AnimateExecutor.registerBuiltInAnimate('fromTo', FromTo);
|
|
@@ -5842,11 +7025,16 @@ const registerCustomAnimate = () => {
|
|
|
5842
7025
|
AnimateExecutor.registerBuiltInAnimate('spinIn', SpinIn);
|
|
5843
7026
|
AnimateExecutor.registerBuiltInAnimate('moveScaleIn', MoveScaleIn);
|
|
5844
7027
|
AnimateExecutor.registerBuiltInAnimate('moveRotateIn', MoveRotateIn);
|
|
7028
|
+
AnimateExecutor.registerBuiltInAnimate('strokeIn', StrokeIn);
|
|
5845
7029
|
AnimateExecutor.registerBuiltInAnimate('slideOut', SlideOut);
|
|
5846
7030
|
AnimateExecutor.registerBuiltInAnimate('growOut', GrowOut);
|
|
5847
7031
|
AnimateExecutor.registerBuiltInAnimate('spinOut', SpinOut);
|
|
5848
7032
|
AnimateExecutor.registerBuiltInAnimate('moveScaleOut', MoveScaleOut);
|
|
5849
7033
|
AnimateExecutor.registerBuiltInAnimate('moveRotateOut', MoveRotateOut);
|
|
7034
|
+
AnimateExecutor.registerBuiltInAnimate('strokeOut', StrokeOut);
|
|
7035
|
+
AnimateExecutor.registerBuiltInAnimate('pulse', PulseAnimate);
|
|
7036
|
+
AnimateExecutor.registerBuiltInAnimate('MotionPath', MotionPath);
|
|
7037
|
+
AnimateExecutor.registerBuiltInAnimate('streamLight', StreamLight);
|
|
5850
7038
|
};
|
|
5851
7039
|
|
|
5852
|
-
export { AComponentAnimate, ACustomAnimate, Animate, AnimateExecutor, Step as AnimateStep, AnimationStateManager, AnimationStateStore, AnimationStates, AnimationTransitionRegistry, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ComponentAnimator, DefaultTicker, DefaultTimeline, GraphicStateExtension, GroupFadeIn, GroupFadeOut, IncreaseCount, InputText, ManualTicker, RotateBySphereAnimate, TagPointsUpdate, createComponentAnimator, generatorPathEasingFunc, registerAnimate, registerCustomAnimate, transitionRegistry };
|
|
7040
|
+
export { AComponentAnimate, ACustomAnimate, Animate, AnimateExecutor, Step as AnimateStep, AnimationStateManager, AnimationStateStore, AnimationStates, AnimationTransitionRegistry, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipIn, ClipOut, ClipRadiusAnimate, ComponentAnimator, DefaultTicker, DefaultTimeline, FadeIn, FadeOut, FromTo, GraphicStateExtension, GroupFadeIn, GroupFadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowIn, GrowOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, InputRichText, InputText, LabelItemAppear, LabelItemDisappear, ManualTicker, MorphingPath, MotionPath, MoveIn, MoveOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, MultiToOneMorphingPath, OutputRichText, PoptipAppear, PoptipDisappear, PulseAnimate, RotateBySphereAnimate, RotateIn, RotateOut, ScaleIn, ScaleOut, SlideIn, SlideOut, SlideOutRichText, SlideRichText, SpinIn, SpinOut, State, StreamLight, StrokeIn, StrokeOut, TagPointsUpdate, Update, createComponentAnimator, generatorPathEasingFunc, morphPath, multiToOneMorph, oneToMultiMorph, registerAnimate, registerCustomAnimate, transitionRegistry };
|