@visactor/vrender-animate 1.0.0-alpha.3 → 1.0.0-alpha.5
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 +1 -0
- package/cjs/animate-extension.js +3 -0
- package/cjs/animate-extension.js.map +1 -1
- package/cjs/animate.d.ts +1 -0
- package/cjs/animate.js +6 -4
- package/cjs/animate.js.map +1 -1
- package/cjs/custom/clip.js +3 -1
- package/cjs/custom/clip.js.map +1 -1
- package/cjs/custom/common.d.ts +0 -1
- package/cjs/custom/common.js +5 -8
- package/cjs/custom/common.js.map +1 -1
- package/cjs/custom/fade.js +3 -1
- package/cjs/custom/fade.js.map +1 -1
- package/cjs/custom/fromTo.js +5 -2
- package/cjs/custom/fromTo.js.map +1 -1
- package/cjs/custom/groupFade.js +3 -1
- package/cjs/custom/groupFade.js.map +1 -1
- package/cjs/custom/growAngle.js +1 -2
- package/cjs/custom/growPoints.js +22 -21
- package/cjs/custom/growPoints.js.map +1 -1
- package/cjs/custom/move.js +7 -8
- package/cjs/custom/move.js.map +1 -1
- package/cjs/custom/register.d.ts +2 -2
- package/cjs/custom/register.js +19 -1
- 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 +18 -9
- package/cjs/custom/richtext/input-richtext.js.map +1 -1
- package/cjs/custom/rotate.js +2 -1
- package/cjs/custom/rotate.js.map +1 -1
- package/cjs/custom/scale.js +4 -3
- package/cjs/custom/scale.js.map +1 -1
- package/cjs/custom/state.js +1 -2
- package/cjs/custom/story.d.ts +68 -0
- package/cjs/custom/story.js +147 -2
- package/cjs/custom/story.js.map +1 -1
- package/cjs/executor/animate-executor.d.ts +1 -1
- package/cjs/executor/animate-executor.js +56 -52
- package/cjs/executor/animate-executor.js.map +1 -1
- package/cjs/step.d.ts +2 -0
- package/cjs/step.js +8 -1
- package/cjs/step.js.map +1 -1
- package/cjs/ticker/default-ticker.d.ts +3 -2
- package/cjs/ticker/default-ticker.js +8 -4
- 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 +11 -4
- package/cjs/timeline.js +28 -15
- package/cjs/timeline.js.map +1 -1
- package/dist/index.es.js +544 -137
- package/es/animate-extension.d.ts +1 -0
- package/es/animate-extension.js +3 -0
- package/es/animate-extension.js.map +1 -1
- package/es/animate.d.ts +1 -0
- package/es/animate.js +6 -4
- package/es/animate.js.map +1 -1
- package/es/custom/clip.js +3 -1
- package/es/custom/clip.js.map +1 -1
- package/es/custom/common.d.ts +0 -1
- package/es/custom/common.js +5 -8
- package/es/custom/common.js.map +1 -1
- package/es/custom/fade.js +3 -1
- package/es/custom/fade.js.map +1 -1
- package/es/custom/fromTo.js +5 -2
- package/es/custom/fromTo.js.map +1 -1
- package/es/custom/groupFade.js +3 -1
- package/es/custom/groupFade.js.map +1 -1
- package/es/custom/growAngle.js +1 -2
- package/es/custom/growPoints.js +22 -21
- package/es/custom/growPoints.js.map +1 -1
- package/es/custom/move.js +6 -7
- package/es/custom/move.js.map +1 -1
- package/es/custom/register.d.ts +2 -2
- package/es/custom/register.js +7 -6
- 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 +18 -9
- package/es/custom/richtext/input-richtext.js.map +1 -1
- package/es/custom/rotate.js +2 -1
- package/es/custom/rotate.js.map +1 -1
- package/es/custom/scale.js +4 -3
- package/es/custom/scale.js.map +1 -1
- package/es/custom/state.js +1 -2
- package/es/custom/story.d.ts +68 -0
- package/es/custom/story.js +140 -0
- package/es/custom/story.js.map +1 -1
- package/es/executor/animate-executor.d.ts +1 -1
- package/es/executor/animate-executor.js +55 -51
- package/es/executor/animate-executor.js.map +1 -1
- package/es/step.d.ts +2 -0
- package/es/step.js +8 -1
- package/es/step.js.map +1 -1
- package/es/ticker/default-ticker.d.ts +3 -2
- package/es/ticker/default-ticker.js +8 -4
- 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 +11 -4
- package/es/timeline.js +28 -15
- package/es/timeline.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { interpolateColor, interpolatePureColorArrayToStr, pointsInterpolation, Generator, ColorStore, ColorType, AnimateStatus, AnimateStepType, PerformanceRAF, STATUS, application, CustomPath2D, CurveContext, Graphic, AttributeUpdateType, pointInterpolation, RichText, divideCubic } from '@visactor/vrender-core';
|
|
2
|
-
import { pi2, isString, EventEmitter, isArray, isFunction, mixin, isValidNumber, clamp, Point, pi, isNumber, isValid, isNil, isNumberClose, PointService } from '@visactor/vutils';
|
|
2
|
+
import { pi2, isString, EventEmitter, cloneDeep, isArray, isFunction, mixin, isValidNumber, clamp, Point, pi, isNumber, isValid, isNil, isNumberClose, PointService } from '@visactor/vutils';
|
|
3
3
|
|
|
4
4
|
class Easing {
|
|
5
5
|
constructor() {
|
|
@@ -477,7 +477,7 @@ class Step {
|
|
|
477
477
|
const animate = this.animate;
|
|
478
478
|
const target = this.target;
|
|
479
479
|
target.animates.forEach((a) => {
|
|
480
|
-
if (a === animate || a.priority > animate.priority) {
|
|
480
|
+
if (a === animate || a.priority > animate.priority || a.priority === Infinity) {
|
|
481
481
|
return;
|
|
482
482
|
}
|
|
483
483
|
const fromProps = a.getStartProps();
|
|
@@ -550,6 +550,13 @@ class WaitStep extends Step {
|
|
|
550
550
|
constructor(type, props, duration, easing) {
|
|
551
551
|
super(type, props, duration, easing);
|
|
552
552
|
}
|
|
553
|
+
onStart() {
|
|
554
|
+
super.onStart();
|
|
555
|
+
}
|
|
556
|
+
onFirstRun() {
|
|
557
|
+
const fromProps = this.getFromProps();
|
|
558
|
+
this.target.setAttributes(fromProps);
|
|
559
|
+
}
|
|
553
560
|
update(end, ratio, out) {
|
|
554
561
|
this.onStart();
|
|
555
562
|
}
|
|
@@ -560,32 +567,52 @@ class WaitStep extends Step {
|
|
|
560
567
|
|
|
561
568
|
class DefaultTimeline {
|
|
562
569
|
get animateCount() {
|
|
563
|
-
return this.
|
|
570
|
+
return this._animateCount;
|
|
564
571
|
}
|
|
565
572
|
constructor() {
|
|
566
|
-
this.
|
|
573
|
+
this.head = null;
|
|
574
|
+
this.tail = null;
|
|
575
|
+
this.animateMap = new Map();
|
|
576
|
+
this._animateCount = 0;
|
|
567
577
|
this._playSpeed = 1;
|
|
568
578
|
this._totalDuration = 0;
|
|
569
579
|
this._startTime = 0;
|
|
570
580
|
this._currentTime = 0;
|
|
571
|
-
this._endAnimatePtr = -1;
|
|
572
581
|
this.id = Generator.GenAutoIncrementId();
|
|
573
|
-
this.animates = [];
|
|
574
582
|
this.paused = false;
|
|
575
583
|
}
|
|
576
584
|
isRunning() {
|
|
577
|
-
return !this.paused && this.
|
|
585
|
+
return !this.paused && this._animateCount > 0;
|
|
578
586
|
}
|
|
579
587
|
forEachAccessAnimate(cb) {
|
|
580
|
-
|
|
581
|
-
|
|
588
|
+
let current = this.head;
|
|
589
|
+
let index = 0;
|
|
590
|
+
while (current) {
|
|
591
|
+
const next = current.next;
|
|
592
|
+
cb(current.animate, index);
|
|
593
|
+
index++;
|
|
594
|
+
current = next;
|
|
582
595
|
}
|
|
583
596
|
}
|
|
584
597
|
addAnimate(animate) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
598
|
+
const newNode = {
|
|
599
|
+
animate,
|
|
600
|
+
next: null,
|
|
601
|
+
prev: null
|
|
602
|
+
};
|
|
603
|
+
if (!this.head) {
|
|
604
|
+
this.head = newNode;
|
|
605
|
+
this.tail = newNode;
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
if (this.tail) {
|
|
609
|
+
this.tail.next = newNode;
|
|
610
|
+
newNode.prev = this.tail;
|
|
611
|
+
this.tail = newNode;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
this.animateMap.set(animate, newNode);
|
|
615
|
+
this._animateCount++;
|
|
589
616
|
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
590
617
|
}
|
|
591
618
|
pause() {
|
|
@@ -602,7 +629,7 @@ class DefaultTimeline {
|
|
|
602
629
|
this._currentTime += scaledDelta;
|
|
603
630
|
this.forEachAccessAnimate((animate, i) => {
|
|
604
631
|
if (animate.status === AnimateStatus.END) {
|
|
605
|
-
this.removeAnimate(animate, true
|
|
632
|
+
this.removeAnimate(animate, true);
|
|
606
633
|
}
|
|
607
634
|
else if (animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL) {
|
|
608
635
|
animate.advance(scaledDelta);
|
|
@@ -613,25 +640,43 @@ class DefaultTimeline {
|
|
|
613
640
|
this.forEachAccessAnimate(animate => {
|
|
614
641
|
animate.release();
|
|
615
642
|
});
|
|
616
|
-
this.
|
|
643
|
+
this.head = null;
|
|
644
|
+
this.tail = null;
|
|
645
|
+
this.animateMap.clear();
|
|
646
|
+
this._animateCount = 0;
|
|
617
647
|
this._totalDuration = 0;
|
|
618
648
|
}
|
|
619
|
-
removeAnimate(animate, release = true
|
|
620
|
-
|
|
649
|
+
removeAnimate(animate, release = true) {
|
|
650
|
+
const node = this.animateMap.get(animate);
|
|
651
|
+
if (!node) {
|
|
621
652
|
return;
|
|
622
653
|
}
|
|
623
654
|
if (release) {
|
|
624
655
|
animate._onRemove && animate._onRemove.forEach(cb => cb());
|
|
625
656
|
animate.release();
|
|
626
657
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
658
|
+
if (node.prev) {
|
|
659
|
+
node.prev.next = node.next;
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
this.head = node.next;
|
|
663
|
+
}
|
|
664
|
+
if (node.next) {
|
|
665
|
+
node.next.prev = node.prev;
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
this.tail = node.prev;
|
|
669
|
+
}
|
|
670
|
+
this.animateMap.delete(animate);
|
|
671
|
+
this._animateCount--;
|
|
672
|
+
if (animate.getStartTime() + animate.getDuration() >= this._totalDuration) {
|
|
673
|
+
this.recalculateTotalDuration();
|
|
674
|
+
}
|
|
630
675
|
return;
|
|
631
676
|
}
|
|
632
677
|
recalculateTotalDuration() {
|
|
633
678
|
this._totalDuration = 0;
|
|
634
|
-
this.
|
|
679
|
+
this.forEachAccessAnimate(animate => {
|
|
635
680
|
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
636
681
|
});
|
|
637
682
|
}
|
|
@@ -957,7 +1002,7 @@ class Animate {
|
|
|
957
1002
|
return this;
|
|
958
1003
|
}
|
|
959
1004
|
advance(delta) {
|
|
960
|
-
var _a;
|
|
1005
|
+
var _a, _b, _c;
|
|
961
1006
|
if (this.status === AnimateStatus.END) {
|
|
962
1007
|
console.warn('aaa 动画已经结束,不能推进');
|
|
963
1008
|
return;
|
|
@@ -968,7 +1013,8 @@ class Animate {
|
|
|
968
1013
|
return;
|
|
969
1014
|
}
|
|
970
1015
|
if (nextTime >= this._startTime + this._totalDuration) {
|
|
971
|
-
(_a = this._lastStep) === null || _a === void 0 ? void 0 : _a.
|
|
1016
|
+
(_a = this._lastStep) === null || _a === void 0 ? void 0 : _a.onUpdate(true, 1, {});
|
|
1017
|
+
(_b = this._lastStep) === null || _b === void 0 ? void 0 : _b.onEnd();
|
|
972
1018
|
this.onEnd();
|
|
973
1019
|
this.status = AnimateStatus.END;
|
|
974
1020
|
return;
|
|
@@ -1014,6 +1060,10 @@ class Animate {
|
|
|
1014
1060
|
if (!targetStep) {
|
|
1015
1061
|
return;
|
|
1016
1062
|
}
|
|
1063
|
+
if (targetStep !== this.lastRunStep) {
|
|
1064
|
+
(_c = this.lastRunStep) === null || _c === void 0 ? void 0 : _c.onEnd();
|
|
1065
|
+
}
|
|
1066
|
+
this.lastRunStep = targetStep;
|
|
1017
1067
|
const stepStartTime = targetStep.getStartTime();
|
|
1018
1068
|
const stepDuration = targetStep.getDuration();
|
|
1019
1069
|
const ratio = (cycleTime - stepStartTime) / stepDuration;
|
|
@@ -1021,6 +1071,7 @@ class Animate {
|
|
|
1021
1071
|
targetStep.update(isEnd, ratio, {});
|
|
1022
1072
|
if (isEnd) {
|
|
1023
1073
|
targetStep.onEnd();
|
|
1074
|
+
this.lastRunStep = null;
|
|
1024
1075
|
}
|
|
1025
1076
|
}
|
|
1026
1077
|
updateDuration() {
|
|
@@ -1064,13 +1115,6 @@ class DefaultTicker extends EventEmitter {
|
|
|
1064
1115
|
super();
|
|
1065
1116
|
this.timelines = [];
|
|
1066
1117
|
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
1118
|
this.handleTick = (handler, params) => {
|
|
1075
1119
|
const { once = false } = params !== null && params !== void 0 ? params : {};
|
|
1076
1120
|
if (this.ifCanStop()) {
|
|
@@ -1113,6 +1157,9 @@ class DefaultTicker extends EventEmitter {
|
|
|
1113
1157
|
this.interval = 16;
|
|
1114
1158
|
this.computeTimeOffsetAndJitter();
|
|
1115
1159
|
}
|
|
1160
|
+
bindStage(stage) {
|
|
1161
|
+
this.stage = stage;
|
|
1162
|
+
}
|
|
1116
1163
|
computeTimeOffsetAndJitter() {
|
|
1117
1164
|
this.timeOffset = Math.floor(Math.random() * this.interval);
|
|
1118
1165
|
this._jitter = Math.min(Math.max(this.interval * 0.2, 6), this.interval * 0.7);
|
|
@@ -1238,19 +1285,25 @@ class DefaultTicker extends EventEmitter {
|
|
|
1238
1285
|
this.tickerHandler = null;
|
|
1239
1286
|
this.lastFrameTime = -1;
|
|
1240
1287
|
}
|
|
1288
|
+
checkSkip(delta) {
|
|
1289
|
+
if (this.stage.params.optimize.tickRenderMode === 'performance') {
|
|
1290
|
+
return false;
|
|
1291
|
+
}
|
|
1292
|
+
const skip = delta < this.interval + (Math.random() - 0.5) * 2 * this._jitter;
|
|
1293
|
+
return skip;
|
|
1294
|
+
}
|
|
1241
1295
|
}
|
|
1242
1296
|
|
|
1243
1297
|
class ManualTickHandler {
|
|
1244
1298
|
constructor() {
|
|
1245
1299
|
this.released = false;
|
|
1246
|
-
this.startTime = -1;
|
|
1247
1300
|
this.currentTime = -1;
|
|
1248
1301
|
}
|
|
1249
1302
|
tick(interval, cb) {
|
|
1250
|
-
if (this.
|
|
1251
|
-
this.
|
|
1303
|
+
if (this.currentTime < 0) {
|
|
1304
|
+
this.currentTime = 0;
|
|
1252
1305
|
}
|
|
1253
|
-
this.currentTime
|
|
1306
|
+
this.currentTime += interval;
|
|
1254
1307
|
cb(this);
|
|
1255
1308
|
}
|
|
1256
1309
|
release() {
|
|
@@ -1259,8 +1312,20 @@ class ManualTickHandler {
|
|
|
1259
1312
|
getTime() {
|
|
1260
1313
|
return this.currentTime;
|
|
1261
1314
|
}
|
|
1315
|
+
tickTo(time, cb) {
|
|
1316
|
+
if (this.currentTime < 0) {
|
|
1317
|
+
this.currentTime = 0;
|
|
1318
|
+
}
|
|
1319
|
+
const interval = time - this.currentTime;
|
|
1320
|
+
this.tick(interval, cb);
|
|
1321
|
+
}
|
|
1262
1322
|
}
|
|
1263
1323
|
class ManualTicker extends DefaultTicker {
|
|
1324
|
+
constructor(stage) {
|
|
1325
|
+
super(stage);
|
|
1326
|
+
this.lastFrameTime = 0;
|
|
1327
|
+
this.status = STATUS.RUNNING;
|
|
1328
|
+
}
|
|
1264
1329
|
setupTickHandler() {
|
|
1265
1330
|
const handler = new ManualTickHandler();
|
|
1266
1331
|
if (this.tickerHandler) {
|
|
@@ -1269,9 +1334,33 @@ class ManualTicker extends DefaultTicker {
|
|
|
1269
1334
|
this.tickerHandler = handler;
|
|
1270
1335
|
return true;
|
|
1271
1336
|
}
|
|
1337
|
+
checkSkip(delta) {
|
|
1338
|
+
return false;
|
|
1339
|
+
}
|
|
1272
1340
|
getTime() {
|
|
1273
1341
|
return this.tickerHandler.getTime();
|
|
1274
1342
|
}
|
|
1343
|
+
tickAt(time) {
|
|
1344
|
+
this.tickTo(time);
|
|
1345
|
+
}
|
|
1346
|
+
start(force = false) {
|
|
1347
|
+
if (this.status === STATUS.RUNNING) {
|
|
1348
|
+
return false;
|
|
1349
|
+
}
|
|
1350
|
+
if (!this.tickerHandler) {
|
|
1351
|
+
return false;
|
|
1352
|
+
}
|
|
1353
|
+
if (!force) {
|
|
1354
|
+
if (this.status === STATUS.PAUSE) {
|
|
1355
|
+
return false;
|
|
1356
|
+
}
|
|
1357
|
+
if (this.ifCanStop()) {
|
|
1358
|
+
return false;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
this.status = STATUS.RUNNING;
|
|
1362
|
+
return true;
|
|
1363
|
+
}
|
|
1275
1364
|
}
|
|
1276
1365
|
|
|
1277
1366
|
function generatorPathEasingFunc(path) {
|
|
@@ -1456,15 +1545,15 @@ class AnimateExecutor {
|
|
|
1456
1545
|
}
|
|
1457
1546
|
});
|
|
1458
1547
|
}
|
|
1459
|
-
parseParams(params, isTimeline) {
|
|
1548
|
+
parseParams(params, isTimeline, child) {
|
|
1460
1549
|
var _a, _b;
|
|
1461
1550
|
const totalTime = this.resolveValue(params.totalTime, undefined, undefined);
|
|
1462
1551
|
const startTime = this.resolveValue(params.startTime, undefined, 0);
|
|
1463
|
-
const parsedParams =
|
|
1552
|
+
const parsedParams = cloneDeep(params);
|
|
1464
1553
|
parsedParams.oneByOneDelay = 0;
|
|
1465
1554
|
parsedParams.startTime = startTime;
|
|
1466
1555
|
parsedParams.totalTime = totalTime;
|
|
1467
|
-
const oneByOne = this.resolveValue(params.oneByOne,
|
|
1556
|
+
const oneByOne = this.resolveValue(params.oneByOne, child, false);
|
|
1468
1557
|
if (isTimeline) {
|
|
1469
1558
|
const timeSlices = parsedParams.timeSlices;
|
|
1470
1559
|
if (!isArray(timeSlices)) {
|
|
@@ -1472,9 +1561,9 @@ class AnimateExecutor {
|
|
|
1472
1561
|
}
|
|
1473
1562
|
let sliceTime = 0;
|
|
1474
1563
|
parsedParams.timeSlices.forEach(slice => {
|
|
1475
|
-
slice.delay = this.resolveValue(slice.delay,
|
|
1476
|
-
slice.delayAfter = this.resolveValue(slice.delayAfter,
|
|
1477
|
-
slice.duration = this.resolveValue(slice.duration,
|
|
1564
|
+
slice.delay = this.resolveValue(slice.delay, child, 0);
|
|
1565
|
+
slice.delayAfter = this.resolveValue(slice.delayAfter, child, 0);
|
|
1566
|
+
slice.duration = this.resolveValue(slice.duration, child, 300);
|
|
1478
1567
|
sliceTime += slice.delay + slice.duration + slice.delayAfter;
|
|
1479
1568
|
});
|
|
1480
1569
|
let oneByOneDelay = 0;
|
|
@@ -1485,31 +1574,32 @@ class AnimateExecutor {
|
|
|
1485
1574
|
}
|
|
1486
1575
|
parsedParams.oneByOne = oneByOneTime;
|
|
1487
1576
|
parsedParams.oneByOneDelay = oneByOneDelay;
|
|
1577
|
+
let scale = 1;
|
|
1488
1578
|
if (totalTime) {
|
|
1489
1579
|
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;
|
|
1580
|
+
scale = totalTime ? totalTime / _totalTime : 1;
|
|
1507
1581
|
}
|
|
1582
|
+
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
1583
|
+
let effects = slice.effects;
|
|
1584
|
+
if (!Array.isArray(effects)) {
|
|
1585
|
+
effects = [effects];
|
|
1586
|
+
}
|
|
1587
|
+
return Object.assign(Object.assign({}, slice), { delay: slice.delay * scale, delayAfter: slice.delayAfter * scale, duration: slice.duration * scale, effects: effects.map(effect => {
|
|
1588
|
+
var _a, _b;
|
|
1589
|
+
const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[(_b = effect.type) !== null && _b !== void 0 ? _b : 'fromTo'];
|
|
1590
|
+
const customType = custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0;
|
|
1591
|
+
return Object.assign(Object.assign({}, effect), { custom,
|
|
1592
|
+
customType });
|
|
1593
|
+
}) });
|
|
1594
|
+
});
|
|
1595
|
+
parsedParams.oneByOne = oneByOneTime * scale;
|
|
1596
|
+
parsedParams.oneByOneDelay = oneByOneDelay * scale;
|
|
1597
|
+
parsedParams.startTime = startTime * scale;
|
|
1508
1598
|
}
|
|
1509
1599
|
else {
|
|
1510
|
-
const delay = this.resolveValue(params.delay,
|
|
1511
|
-
const delayAfter = this.resolveValue(params.delayAfter,
|
|
1512
|
-
const duration = this.resolveValue(params.duration,
|
|
1600
|
+
const delay = this.resolveValue(params.delay, child, 0);
|
|
1601
|
+
const delayAfter = this.resolveValue(params.delayAfter, child, 0);
|
|
1602
|
+
const duration = this.resolveValue(params.duration, child, 300);
|
|
1513
1603
|
let oneByOneDelay = 0;
|
|
1514
1604
|
let oneByOneTime = 0;
|
|
1515
1605
|
if (oneByOne) {
|
|
@@ -1555,26 +1645,27 @@ class AnimateExecutor {
|
|
|
1555
1645
|
let filteredChildren;
|
|
1556
1646
|
if (isTimeline && params.partitioner) {
|
|
1557
1647
|
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, {});
|
|
1648
|
+
var _a, _b;
|
|
1649
|
+
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
1650
|
});
|
|
1561
1651
|
}
|
|
1562
1652
|
if (isTimeline && params.sort) {
|
|
1563
1653
|
filteredChildren = filteredChildren !== null && filteredChildren !== void 0 ? filteredChildren : this._target.getChildren();
|
|
1564
1654
|
filteredChildren.sort((a, b) => {
|
|
1565
|
-
var _a, _b;
|
|
1566
|
-
return params.sort((_a = a.context) === null || _a === void 0 ? void 0 : _a.data, (
|
|
1655
|
+
var _a, _b, _c, _d;
|
|
1656
|
+
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
1657
|
});
|
|
1568
1658
|
}
|
|
1569
|
-
const parsedParams = this.parseParams(params, isTimeline);
|
|
1570
1659
|
const cb = isTimeline
|
|
1571
1660
|
? (child, index, count) => {
|
|
1661
|
+
const parsedParams = this.parseParams(params, isTimeline, child);
|
|
1572
1662
|
const animate = this.executeTimelineItem(parsedParams, child, index, count);
|
|
1573
1663
|
if (animate) {
|
|
1574
1664
|
this._trackAnimation(animate);
|
|
1575
1665
|
}
|
|
1576
1666
|
}
|
|
1577
1667
|
: (child, index, count) => {
|
|
1668
|
+
const parsedParams = this.parseParams(params, isTimeline, child);
|
|
1578
1669
|
const animate = this.executeTypeConfigItem(parsedParams, child, index, count);
|
|
1579
1670
|
if (animate) {
|
|
1580
1671
|
this._trackAnimation(animate);
|
|
@@ -1602,8 +1693,8 @@ class AnimateExecutor {
|
|
|
1602
1693
|
if (datum && indexKey) {
|
|
1603
1694
|
index = (_f = datum[indexKey]) !== null && _f !== void 0 ? _f : index;
|
|
1604
1695
|
}
|
|
1605
|
-
animate.startAt(startTime
|
|
1606
|
-
const wait = index * oneByOneDelay;
|
|
1696
|
+
animate.startAt(startTime);
|
|
1697
|
+
const wait = index * oneByOneDelay + delayValue;
|
|
1607
1698
|
wait > 0 && animate.wait(wait);
|
|
1608
1699
|
let parsedFromProps = null;
|
|
1609
1700
|
let props = params.to;
|
|
@@ -1620,13 +1711,17 @@ class AnimateExecutor {
|
|
|
1620
1711
|
}
|
|
1621
1712
|
from = parsedFromProps.from;
|
|
1622
1713
|
}
|
|
1623
|
-
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic);
|
|
1714
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
1715
|
+
let totalDelay = 0;
|
|
1624
1716
|
if (oneByOneDelay) {
|
|
1625
|
-
|
|
1717
|
+
totalDelay = oneByOneDelay * (count - index - 1);
|
|
1626
1718
|
}
|
|
1627
1719
|
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
1720
|
if (delayAfterValue > 0) {
|
|
1629
|
-
|
|
1721
|
+
totalDelay += delayAfterValue;
|
|
1722
|
+
}
|
|
1723
|
+
if (totalDelay > 0) {
|
|
1724
|
+
animate.wait(totalDelay);
|
|
1630
1725
|
}
|
|
1631
1726
|
if (loop && loop > 0) {
|
|
1632
1727
|
animate.loop(loop);
|
|
@@ -1636,7 +1731,7 @@ class AnimateExecutor {
|
|
|
1636
1731
|
}
|
|
1637
1732
|
return animate;
|
|
1638
1733
|
}
|
|
1639
|
-
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic) {
|
|
1734
|
+
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
|
|
1640
1735
|
var _a, _b, _c, _d;
|
|
1641
1736
|
if (custom && customType) {
|
|
1642
1737
|
const customParams = this.resolveValue(customParameters, graphic, {});
|
|
@@ -1644,6 +1739,7 @@ class AnimateExecutor {
|
|
|
1644
1739
|
? 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
1740
|
: options;
|
|
1646
1741
|
customParams.options = objOptions;
|
|
1742
|
+
customParams.controlOptions = controlOptions;
|
|
1647
1743
|
if (customType === 1) {
|
|
1648
1744
|
this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams);
|
|
1649
1745
|
}
|
|
@@ -1695,7 +1791,7 @@ class AnimateExecutor {
|
|
|
1695
1791
|
}
|
|
1696
1792
|
const effectsArray = Array.isArray(effects) ? effects : [effects];
|
|
1697
1793
|
effectsArray.forEach(effect => {
|
|
1698
|
-
var _a
|
|
1794
|
+
var _a;
|
|
1699
1795
|
const { type = 'fromTo', channel, customParameters, easing = 'linear', options } = effect;
|
|
1700
1796
|
let parsedFromProps = null;
|
|
1701
1797
|
let props = effect.to;
|
|
@@ -1713,8 +1809,8 @@ class AnimateExecutor {
|
|
|
1713
1809
|
from = parsedFromProps.from;
|
|
1714
1810
|
}
|
|
1715
1811
|
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);
|
|
1812
|
+
const customType = effect.customType;
|
|
1813
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, null, options, type, graphic);
|
|
1718
1814
|
});
|
|
1719
1815
|
if (delayAfterValue > 0) {
|
|
1720
1816
|
animate.wait(delayAfterValue);
|
|
@@ -1746,11 +1842,11 @@ class AnimateExecutor {
|
|
|
1746
1842
|
}
|
|
1747
1843
|
if (!Array.isArray(channel)) {
|
|
1748
1844
|
Object.keys(channel).forEach(key => {
|
|
1749
|
-
var _a, _b;
|
|
1845
|
+
var _a, _b, _c, _d;
|
|
1750
1846
|
const config = channel[key];
|
|
1751
1847
|
if (config.to !== undefined) {
|
|
1752
1848
|
if (typeof config.to === 'function') {
|
|
1753
|
-
props[key] = config.to((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data, graphic, {});
|
|
1849
|
+
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, {});
|
|
1754
1850
|
}
|
|
1755
1851
|
else {
|
|
1756
1852
|
props[key] = config.to;
|
|
@@ -1761,7 +1857,7 @@ class AnimateExecutor {
|
|
|
1761
1857
|
from = {};
|
|
1762
1858
|
}
|
|
1763
1859
|
if (typeof config.from === 'function') {
|
|
1764
|
-
from[key] = config.from((
|
|
1860
|
+
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, {});
|
|
1765
1861
|
}
|
|
1766
1862
|
else {
|
|
1767
1863
|
from[key] = config.from;
|
|
@@ -1784,12 +1880,12 @@ class AnimateExecutor {
|
|
|
1784
1880
|
};
|
|
1785
1881
|
}
|
|
1786
1882
|
resolveValue(value, graphic, defaultValue) {
|
|
1787
|
-
var _a;
|
|
1883
|
+
var _a, _b;
|
|
1788
1884
|
if (value === undefined) {
|
|
1789
1885
|
return defaultValue;
|
|
1790
1886
|
}
|
|
1791
1887
|
if (typeof value === 'function' && graphic) {
|
|
1792
|
-
return value((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data, graphic, {});
|
|
1888
|
+
return value((_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], graphic, {});
|
|
1793
1889
|
}
|
|
1794
1890
|
return value;
|
|
1795
1891
|
}
|
|
@@ -2087,6 +2183,12 @@ class AnimateExtension {
|
|
|
2087
2183
|
getFinalAttribute() {
|
|
2088
2184
|
return this.finalAttribute;
|
|
2089
2185
|
}
|
|
2186
|
+
getGraphicAttribute(key, prev = false) {
|
|
2187
|
+
if (!prev && this.finalAttribute) {
|
|
2188
|
+
return this.finalAttribute[key];
|
|
2189
|
+
}
|
|
2190
|
+
return this.attribute[key];
|
|
2191
|
+
}
|
|
2090
2192
|
}
|
|
2091
2193
|
|
|
2092
2194
|
function registerAnimate() {
|
|
@@ -2792,16 +2894,16 @@ class CommonIn extends ACustomAnimate {
|
|
|
2792
2894
|
super(from, to, duration, easing, params);
|
|
2793
2895
|
}
|
|
2794
2896
|
onBind() {
|
|
2795
|
-
var _a;
|
|
2897
|
+
var _a, _b, _c;
|
|
2796
2898
|
super.onBind();
|
|
2797
2899
|
const attrs = this.target.getFinalAttribute();
|
|
2798
2900
|
const fromAttrs = (_a = this.target.attribute) !== null && _a !== void 0 ? _a : {};
|
|
2799
2901
|
const to = {};
|
|
2800
|
-
const from = {};
|
|
2902
|
+
const from = (_b = this.from) !== null && _b !== void 0 ? _b : {};
|
|
2801
2903
|
this.keys.forEach(key => {
|
|
2802
|
-
var _a, _b;
|
|
2904
|
+
var _a, _b, _c;
|
|
2803
2905
|
to[key] = (_a = attrs === null || attrs === void 0 ? void 0 : attrs[key]) !== null && _a !== void 0 ? _a : 1;
|
|
2804
|
-
from[key] = (_b =
|
|
2906
|
+
from[key] = (_c = (_b = from[key]) !== null && _b !== void 0 ? _b : fromAttrs[key]) !== null && _c !== void 0 ? _c : 0;
|
|
2805
2907
|
});
|
|
2806
2908
|
const finalAttribute = this.target.getFinalAttribute();
|
|
2807
2909
|
if (finalAttribute) {
|
|
@@ -2811,10 +2913,9 @@ class CommonIn extends ACustomAnimate {
|
|
|
2811
2913
|
this.propKeys = this.keys;
|
|
2812
2914
|
this.from = from;
|
|
2813
2915
|
this.to = to;
|
|
2814
|
-
this.
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
super.onEnd(cb);
|
|
2916
|
+
if (((_c = this.params.controlOptions) === null || _c === void 0 ? void 0 : _c.immediatelyApply) !== false) {
|
|
2917
|
+
this.target.setAttributes(from);
|
|
2918
|
+
}
|
|
2818
2919
|
}
|
|
2819
2920
|
onUpdate(end, ratio, out) {
|
|
2820
2921
|
const attribute = this.target.attribute;
|
|
@@ -2864,6 +2965,7 @@ class GroupFadeIn extends CommonIn {
|
|
|
2864
2965
|
constructor(from, to, duration, easing, params) {
|
|
2865
2966
|
super(from, to, duration, easing, params);
|
|
2866
2967
|
this.keys = ['baseOpacity'];
|
|
2968
|
+
this.from = { baseOpacity: 0 };
|
|
2867
2969
|
}
|
|
2868
2970
|
}
|
|
2869
2971
|
class GroupFadeOut extends CommonOut {
|
|
@@ -2922,6 +3024,7 @@ class ClipIn extends CommonIn {
|
|
|
2922
3024
|
constructor(from, to, duration, easing, params) {
|
|
2923
3025
|
super(from, to, duration, easing, params);
|
|
2924
3026
|
this.keys = ['clipRange'];
|
|
3027
|
+
this.from = { clipRange: 0 };
|
|
2925
3028
|
}
|
|
2926
3029
|
}
|
|
2927
3030
|
class ClipOut extends CommonOut {
|
|
@@ -2935,6 +3038,7 @@ class FadeIn extends CommonIn {
|
|
|
2935
3038
|
constructor(from, to, duration, easing, params) {
|
|
2936
3039
|
super(from, to, duration, easing, params);
|
|
2937
3040
|
this.keys = ['opacity'];
|
|
3041
|
+
this.from = { opacity: 0 };
|
|
2938
3042
|
}
|
|
2939
3043
|
}
|
|
2940
3044
|
class FadeOut extends CommonOut {
|
|
@@ -3546,6 +3650,7 @@ class GworPointsBase extends ACustomAnimate {
|
|
|
3546
3650
|
}
|
|
3547
3651
|
class GrowPointsIn extends GworPointsBase {
|
|
3548
3652
|
onBind() {
|
|
3653
|
+
var _a;
|
|
3549
3654
|
super.onBind();
|
|
3550
3655
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3551
3656
|
const { from, to } = growPointsIn(this.target, this.params.options, this.params);
|
|
@@ -3557,7 +3662,9 @@ class GrowPointsIn extends GworPointsBase {
|
|
|
3557
3662
|
if (finalAttribute) {
|
|
3558
3663
|
Object.assign(this.target.attribute, finalAttribute);
|
|
3559
3664
|
}
|
|
3560
|
-
this.
|
|
3665
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
3666
|
+
this.target.setAttributes(from);
|
|
3667
|
+
}
|
|
3561
3668
|
}
|
|
3562
3669
|
else {
|
|
3563
3670
|
this.valid = false;
|
|
@@ -3584,12 +3691,10 @@ const changePointsX = (graphic, options, animationParameters) => {
|
|
|
3584
3691
|
const attrs = graphic.getFinalAttribute();
|
|
3585
3692
|
const points = attrs.points;
|
|
3586
3693
|
return points.map((point) => {
|
|
3587
|
-
var _a;
|
|
3588
3694
|
if (options && options.orient === 'negative') {
|
|
3589
|
-
let groupRight =
|
|
3590
|
-
if (
|
|
3591
|
-
groupRight =
|
|
3592
|
-
animationParameters.groupWidth = groupRight;
|
|
3695
|
+
let groupRight = graphic.stage.viewWidth;
|
|
3696
|
+
if (graphic.parent.parent.parent) {
|
|
3697
|
+
groupRight = graphic.parent.parent.parent.AABBBounds.width();
|
|
3593
3698
|
}
|
|
3594
3699
|
return Object.assign(Object.assign({}, point), { x: groupRight, y: point.y, x1: groupRight, y1: point.y1, defined: point.defined !== false });
|
|
3595
3700
|
}
|
|
@@ -3599,7 +3704,7 @@ const changePointsX = (graphic, options, animationParameters) => {
|
|
|
3599
3704
|
const growPointsXIn = (graphic, options, animationParameters) => {
|
|
3600
3705
|
const attrs = graphic.getFinalAttribute();
|
|
3601
3706
|
return {
|
|
3602
|
-
from: { points: changePointsX(graphic, options
|
|
3707
|
+
from: { points: changePointsX(graphic, options) },
|
|
3603
3708
|
to: { points: attrs.points }
|
|
3604
3709
|
};
|
|
3605
3710
|
};
|
|
@@ -3607,11 +3712,12 @@ const growPointsXOut = (graphic, options, animationParameters) => {
|
|
|
3607
3712
|
const attrs = graphic.getFinalAttribute();
|
|
3608
3713
|
return {
|
|
3609
3714
|
from: { points: attrs.points },
|
|
3610
|
-
to: { points: changePointsX(graphic, options
|
|
3715
|
+
to: { points: changePointsX(graphic, options) }
|
|
3611
3716
|
};
|
|
3612
3717
|
};
|
|
3613
3718
|
class GrowPointsXIn extends GworPointsBase {
|
|
3614
3719
|
onBind() {
|
|
3720
|
+
var _a;
|
|
3615
3721
|
super.onBind();
|
|
3616
3722
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3617
3723
|
const { from, to } = growPointsXIn(this.target, this.params.options, this.params);
|
|
@@ -3623,7 +3729,9 @@ class GrowPointsXIn extends GworPointsBase {
|
|
|
3623
3729
|
if (finalAttribute) {
|
|
3624
3730
|
Object.assign(this.target.attribute, finalAttribute);
|
|
3625
3731
|
}
|
|
3626
|
-
this.
|
|
3732
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
3733
|
+
this.target.setAttributes(from);
|
|
3734
|
+
}
|
|
3627
3735
|
}
|
|
3628
3736
|
else {
|
|
3629
3737
|
this.valid = false;
|
|
@@ -3650,12 +3758,10 @@ const changePointsY = (graphic, options, animationParameters) => {
|
|
|
3650
3758
|
const attrs = graphic.getFinalAttribute();
|
|
3651
3759
|
const points = attrs.points;
|
|
3652
3760
|
return points.map((point) => {
|
|
3653
|
-
var _a;
|
|
3654
3761
|
if (options && options.orient === 'negative') {
|
|
3655
|
-
let groupBottom =
|
|
3656
|
-
if (
|
|
3657
|
-
groupBottom =
|
|
3658
|
-
animationParameters.groupHeight = groupBottom;
|
|
3762
|
+
let groupBottom = graphic.stage.viewHeight;
|
|
3763
|
+
if (graphic.parent.parent.parent) {
|
|
3764
|
+
groupBottom = graphic.parent.parent.parent.AABBBounds.height();
|
|
3659
3765
|
}
|
|
3660
3766
|
return Object.assign(Object.assign({}, point), { x: point.x, y: groupBottom, x1: point.x1, y1: groupBottom, defined: point.defined !== false });
|
|
3661
3767
|
}
|
|
@@ -3665,7 +3771,7 @@ const changePointsY = (graphic, options, animationParameters) => {
|
|
|
3665
3771
|
const growPointsYIn = (graphic, options, animationParameters) => {
|
|
3666
3772
|
const attrs = graphic.getFinalAttribute();
|
|
3667
3773
|
return {
|
|
3668
|
-
from: { points: changePointsY(graphic, options
|
|
3774
|
+
from: { points: changePointsY(graphic, options) },
|
|
3669
3775
|
to: { points: attrs.points }
|
|
3670
3776
|
};
|
|
3671
3777
|
};
|
|
@@ -3673,11 +3779,12 @@ const growPointsYOut = (graphic, options, animationParameters) => {
|
|
|
3673
3779
|
const attrs = graphic.getFinalAttribute();
|
|
3674
3780
|
return {
|
|
3675
3781
|
from: { points: attrs.points },
|
|
3676
|
-
to: { points: changePointsY(graphic, options
|
|
3782
|
+
to: { points: changePointsY(graphic, options) }
|
|
3677
3783
|
};
|
|
3678
3784
|
};
|
|
3679
3785
|
class GrowPointsYIn extends GworPointsBase {
|
|
3680
3786
|
onBind() {
|
|
3787
|
+
var _a;
|
|
3681
3788
|
super.onBind();
|
|
3682
3789
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3683
3790
|
const { from, to } = growPointsYIn(this.target, this.params.options, this.params);
|
|
@@ -3689,7 +3796,9 @@ class GrowPointsYIn extends GworPointsBase {
|
|
|
3689
3796
|
if (finalAttribute) {
|
|
3690
3797
|
Object.assign(this.target.attribute, finalAttribute);
|
|
3691
3798
|
}
|
|
3692
|
-
this.
|
|
3799
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
3800
|
+
this.target.setAttributes(from);
|
|
3801
|
+
}
|
|
3693
3802
|
}
|
|
3694
3803
|
else {
|
|
3695
3804
|
this.valid = false;
|
|
@@ -4273,10 +4382,10 @@ class InputRichText extends ACustomAnimate {
|
|
|
4273
4382
|
this.showCursor = false;
|
|
4274
4383
|
this.cursorChar = '|';
|
|
4275
4384
|
this.blinkCursor = true;
|
|
4276
|
-
this.beforeText = '';
|
|
4277
|
-
this.afterText = '';
|
|
4278
4385
|
this.fadeInChars = false;
|
|
4279
4386
|
this.fadeInDuration = 0.3;
|
|
4387
|
+
this.strokeFirst = false;
|
|
4388
|
+
this.strokeToFillRatio = 0.3;
|
|
4280
4389
|
if ((params === null || params === void 0 ? void 0 : params.showCursor) !== undefined) {
|
|
4281
4390
|
this.showCursor = params.showCursor;
|
|
4282
4391
|
}
|
|
@@ -4286,18 +4395,18 @@ class InputRichText extends ACustomAnimate {
|
|
|
4286
4395
|
if ((params === null || params === void 0 ? void 0 : params.blinkCursor) !== undefined) {
|
|
4287
4396
|
this.blinkCursor = params.blinkCursor;
|
|
4288
4397
|
}
|
|
4289
|
-
if ((params === null || params === void 0 ? void 0 : params.beforeText) !== undefined) {
|
|
4290
|
-
this.beforeText = params.beforeText;
|
|
4291
|
-
}
|
|
4292
|
-
if ((params === null || params === void 0 ? void 0 : params.afterText) !== undefined) {
|
|
4293
|
-
this.afterText = params.afterText;
|
|
4294
|
-
}
|
|
4295
4398
|
if ((params === null || params === void 0 ? void 0 : params.fadeInChars) !== undefined) {
|
|
4296
4399
|
this.fadeInChars = params.fadeInChars;
|
|
4297
4400
|
}
|
|
4298
4401
|
if ((params === null || params === void 0 ? void 0 : params.fadeInDuration) !== undefined) {
|
|
4299
4402
|
this.fadeInDuration = params.fadeInDuration;
|
|
4300
4403
|
}
|
|
4404
|
+
if ((params === null || params === void 0 ? void 0 : params.strokeFirst) !== undefined) {
|
|
4405
|
+
this.strokeFirst = params.strokeFirst;
|
|
4406
|
+
}
|
|
4407
|
+
if ((params === null || params === void 0 ? void 0 : params.strokeToFillRatio) !== undefined) {
|
|
4408
|
+
this.strokeToFillRatio = params.strokeToFillRatio;
|
|
4409
|
+
}
|
|
4301
4410
|
}
|
|
4302
4411
|
onFirstRun() {
|
|
4303
4412
|
const fromProps = this.getLastProps();
|
|
@@ -4346,11 +4455,30 @@ class InputRichText extends ACustomAnimate {
|
|
|
4346
4455
|
}
|
|
4347
4456
|
else {
|
|
4348
4457
|
currentTextConfig = this.toTextConfig.slice(0, currentLength).map((item, index) => {
|
|
4349
|
-
if (
|
|
4350
|
-
const
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4458
|
+
if ('text' in item) {
|
|
4459
|
+
const newItem = Object.assign({}, item);
|
|
4460
|
+
if (this.strokeFirst) {
|
|
4461
|
+
const appearTime = (index / totalItems) * maxTextShowRatio;
|
|
4462
|
+
const itemLifetime = Math.max(0, ratio - appearTime);
|
|
4463
|
+
const maxLifetime = 1 - appearTime;
|
|
4464
|
+
const fillProgress = Math.min(1, itemLifetime / (this.strokeToFillRatio * maxLifetime));
|
|
4465
|
+
if ('fill' in newItem && newItem.fill) {
|
|
4466
|
+
newItem.stroke = newItem.fill;
|
|
4467
|
+
if (fillProgress < 1) {
|
|
4468
|
+
newItem.fillOpacity = fillProgress;
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
if (this.fadeInChars) {
|
|
4472
|
+
const fadeProgress = Math.min(1, itemLifetime / (this.fadeInDuration * maxLifetime));
|
|
4473
|
+
newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
|
|
4474
|
+
}
|
|
4475
|
+
}
|
|
4476
|
+
else if (this.fadeInChars) {
|
|
4477
|
+
const appearTime = (index / totalItems) * maxTextShowRatio;
|
|
4478
|
+
const fadeProgress = (ratio - appearTime) / this.fadeInDuration;
|
|
4479
|
+
newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
|
|
4480
|
+
}
|
|
4481
|
+
return newItem;
|
|
4354
4482
|
}
|
|
4355
4483
|
return item;
|
|
4356
4484
|
});
|
|
@@ -4959,7 +5087,7 @@ class ScaleIn extends ACustomAnimate {
|
|
|
4959
5087
|
super(from, to, duration, easing, params);
|
|
4960
5088
|
}
|
|
4961
5089
|
onBind() {
|
|
4962
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
5090
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
4963
5091
|
super.onBind();
|
|
4964
5092
|
let from;
|
|
4965
5093
|
let to;
|
|
@@ -4992,7 +5120,9 @@ class ScaleIn extends ACustomAnimate {
|
|
|
4992
5120
|
this.props = to;
|
|
4993
5121
|
this.from = from;
|
|
4994
5122
|
this.to = to;
|
|
4995
|
-
this.
|
|
5123
|
+
if (((_l = this.params.controlOptions) === null || _l === void 0 ? void 0 : _l.immediatelyApply) !== false) {
|
|
5124
|
+
this.target.setAttributes(from);
|
|
5125
|
+
}
|
|
4996
5126
|
}
|
|
4997
5127
|
onEnd(cb) {
|
|
4998
5128
|
super.onEnd(cb);
|
|
@@ -5228,6 +5358,155 @@ class SpinIn extends ACustomAnimate {
|
|
|
5228
5358
|
this.target.addUpdateShapeAndBoundsTag();
|
|
5229
5359
|
}
|
|
5230
5360
|
}
|
|
5361
|
+
class StrokeIn extends ACustomAnimate {
|
|
5362
|
+
constructor(from, to, duration, easing, params) {
|
|
5363
|
+
super(from, to, duration, easing, params);
|
|
5364
|
+
this.perimeter = 0;
|
|
5365
|
+
this.originalAttributes = {};
|
|
5366
|
+
}
|
|
5367
|
+
onBind() {
|
|
5368
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
5369
|
+
super.onBind();
|
|
5370
|
+
this.originalAttributes = Object.assign({}, this.target.getAttributes());
|
|
5371
|
+
if (this.target.type === 'rect') {
|
|
5372
|
+
const attr = this.target.attribute;
|
|
5373
|
+
const width = (_a = attr.width) !== null && _a !== void 0 ? _a : 100;
|
|
5374
|
+
const height = (_b = attr.height) !== null && _b !== void 0 ? _b : 100;
|
|
5375
|
+
this.perimeter = 2 * (width + height);
|
|
5376
|
+
}
|
|
5377
|
+
else if (this.target.type === 'circle') {
|
|
5378
|
+
const attr = this.target.attribute;
|
|
5379
|
+
const radius = (_c = attr.radius) !== null && _c !== void 0 ? _c : 50;
|
|
5380
|
+
this.perimeter = 2 * Math.PI * radius;
|
|
5381
|
+
}
|
|
5382
|
+
else if (this.target.type === 'ellipse') {
|
|
5383
|
+
const attr = this.target.attribute;
|
|
5384
|
+
const radiusX = (_d = attr.radiusX) !== null && _d !== void 0 ? _d : 50;
|
|
5385
|
+
const radiusY = (_e = attr.radiusY) !== null && _e !== void 0 ? _e : 50;
|
|
5386
|
+
this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
|
|
5387
|
+
}
|
|
5388
|
+
else {
|
|
5389
|
+
this.perimeter = 1000;
|
|
5390
|
+
}
|
|
5391
|
+
const lineWidth = (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.lineWidth) !== null && _g !== void 0 ? _g : 2;
|
|
5392
|
+
const strokeColor = (_j = (_h = this.params) === null || _h === void 0 ? void 0 : _h.strokeColor) !== null && _j !== void 0 ? _j : 'black';
|
|
5393
|
+
const fromOpacity = (_l = (_k = this.params) === null || _k === void 0 ? void 0 : _k.fromOpacity) !== null && _l !== void 0 ? _l : 1;
|
|
5394
|
+
const dashLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.dashLength) !== null && _o !== void 0 ? _o : this.perimeter;
|
|
5395
|
+
const showFill = (_q = (_p = this.params) === null || _p === void 0 ? void 0 : _p.showFill) !== null && _q !== void 0 ? _q : false;
|
|
5396
|
+
const fillOpacity = (_s = (_r = this.params) === null || _r === void 0 ? void 0 : _r.fillOpacity) !== null && _s !== void 0 ? _s : 0;
|
|
5397
|
+
this.from = {
|
|
5398
|
+
lineDash: [dashLength, dashLength],
|
|
5399
|
+
lineDashOffset: dashLength,
|
|
5400
|
+
lineWidth,
|
|
5401
|
+
stroke: strokeColor,
|
|
5402
|
+
strokeOpacity: fromOpacity
|
|
5403
|
+
};
|
|
5404
|
+
this.to = {
|
|
5405
|
+
lineDash: [dashLength, dashLength],
|
|
5406
|
+
lineDashOffset: 0,
|
|
5407
|
+
lineWidth,
|
|
5408
|
+
stroke: strokeColor,
|
|
5409
|
+
strokeOpacity: fromOpacity
|
|
5410
|
+
};
|
|
5411
|
+
if (showFill) {
|
|
5412
|
+
this.from.fillOpacity = fillOpacity;
|
|
5413
|
+
this.to.fillOpacity = (_t = this.originalAttributes.fillOpacity) !== null && _t !== void 0 ? _t : 1;
|
|
5414
|
+
}
|
|
5415
|
+
else {
|
|
5416
|
+
this.from.fillOpacity = 0;
|
|
5417
|
+
this.to.fillOpacity = 0;
|
|
5418
|
+
}
|
|
5419
|
+
this.propKeys = ['lineDash', 'lineDashOffset', 'lineWidth', 'stroke', 'strokeOpacity', 'fillOpacity'];
|
|
5420
|
+
this.props = this.to;
|
|
5421
|
+
this.target.setAttributes(this.from);
|
|
5422
|
+
}
|
|
5423
|
+
onUpdate(end, ratio, out) {
|
|
5424
|
+
var _a;
|
|
5425
|
+
const attribute = this.target.attribute;
|
|
5426
|
+
attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio;
|
|
5427
|
+
if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill) {
|
|
5428
|
+
attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio;
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
onEnd() {
|
|
5432
|
+
var _a;
|
|
5433
|
+
super.onEnd();
|
|
5434
|
+
if (!((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill)) {
|
|
5435
|
+
const originalAttrs = Object.assign({}, this.originalAttributes);
|
|
5436
|
+
originalAttrs.fillOpacity = 0;
|
|
5437
|
+
this.target.setAttributes(originalAttrs);
|
|
5438
|
+
}
|
|
5439
|
+
}
|
|
5440
|
+
}
|
|
5441
|
+
class StrokeOut extends ACustomAnimate {
|
|
5442
|
+
constructor(from, to, duration, easing, params) {
|
|
5443
|
+
super(from, to, duration, easing, params);
|
|
5444
|
+
this.perimeter = 0;
|
|
5445
|
+
this.originalAttributes = {};
|
|
5446
|
+
}
|
|
5447
|
+
onFirstRun() {
|
|
5448
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
5449
|
+
this.originalAttributes = Object.assign({}, this.target.getAttributes());
|
|
5450
|
+
if (this.target.type === 'rect') {
|
|
5451
|
+
const attr = this.target.attribute;
|
|
5452
|
+
const width = (_a = attr.width) !== null && _a !== void 0 ? _a : 100;
|
|
5453
|
+
const height = (_b = attr.height) !== null && _b !== void 0 ? _b : 100;
|
|
5454
|
+
this.perimeter = 2 * (width + height);
|
|
5455
|
+
}
|
|
5456
|
+
else if (this.target.type === 'circle') {
|
|
5457
|
+
const attr = this.target.attribute;
|
|
5458
|
+
const radius = (_c = attr.radius) !== null && _c !== void 0 ? _c : 50;
|
|
5459
|
+
this.perimeter = 2 * Math.PI * radius;
|
|
5460
|
+
}
|
|
5461
|
+
else if (this.target.type === 'ellipse') {
|
|
5462
|
+
const attr = this.target.attribute;
|
|
5463
|
+
const radiusX = (_d = attr.radiusX) !== null && _d !== void 0 ? _d : 50;
|
|
5464
|
+
const radiusY = (_e = attr.radiusY) !== null && _e !== void 0 ? _e : 50;
|
|
5465
|
+
this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
|
|
5466
|
+
}
|
|
5467
|
+
else {
|
|
5468
|
+
this.perimeter = 1000;
|
|
5469
|
+
}
|
|
5470
|
+
const lineWidth = (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.lineWidth) !== null && _g !== void 0 ? _g : 2;
|
|
5471
|
+
const strokeColor = (_j = (_h = this.params) === null || _h === void 0 ? void 0 : _h.strokeColor) !== null && _j !== void 0 ? _j : 'black';
|
|
5472
|
+
const fromOpacity = (_l = (_k = this.params) === null || _k === void 0 ? void 0 : _k.fromOpacity) !== null && _l !== void 0 ? _l : 1;
|
|
5473
|
+
const dashLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.dashLength) !== null && _o !== void 0 ? _o : this.perimeter;
|
|
5474
|
+
const showFill = (_q = (_p = this.params) === null || _p === void 0 ? void 0 : _p.showFill) !== null && _q !== void 0 ? _q : false;
|
|
5475
|
+
this.from = {
|
|
5476
|
+
lineDash: [dashLength, dashLength],
|
|
5477
|
+
lineDashOffset: 0,
|
|
5478
|
+
lineWidth,
|
|
5479
|
+
stroke: strokeColor,
|
|
5480
|
+
strokeOpacity: fromOpacity
|
|
5481
|
+
};
|
|
5482
|
+
this.to = {
|
|
5483
|
+
lineDash: [dashLength, dashLength],
|
|
5484
|
+
lineDashOffset: -dashLength,
|
|
5485
|
+
lineWidth,
|
|
5486
|
+
stroke: strokeColor,
|
|
5487
|
+
strokeOpacity: fromOpacity
|
|
5488
|
+
};
|
|
5489
|
+
if (showFill) {
|
|
5490
|
+
this.from.fillOpacity = (_r = this.originalAttributes.fillOpacity) !== null && _r !== void 0 ? _r : 1;
|
|
5491
|
+
this.to.fillOpacity = 0;
|
|
5492
|
+
}
|
|
5493
|
+
else {
|
|
5494
|
+
this.from.fillOpacity = 0;
|
|
5495
|
+
this.to.fillOpacity = 0;
|
|
5496
|
+
}
|
|
5497
|
+
this.propKeys = ['lineDash', 'lineDashOffset', 'lineWidth', 'stroke', 'strokeOpacity', 'fillOpacity'];
|
|
5498
|
+
this.props = this.to;
|
|
5499
|
+
this.target.setAttributes(this.from);
|
|
5500
|
+
}
|
|
5501
|
+
onUpdate(end, ratio, out) {
|
|
5502
|
+
var _a;
|
|
5503
|
+
const attribute = this.target.attribute;
|
|
5504
|
+
attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio;
|
|
5505
|
+
if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill) {
|
|
5506
|
+
attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio;
|
|
5507
|
+
}
|
|
5508
|
+
}
|
|
5509
|
+
}
|
|
5231
5510
|
class MoveScaleIn extends ACustomAnimate {
|
|
5232
5511
|
constructor(from, to, duration, easing, params) {
|
|
5233
5512
|
var _a;
|
|
@@ -5506,6 +5785,121 @@ class MoveRotateOut extends ACustomAnimate {
|
|
|
5506
5785
|
onUpdate(end, ratio, out) {
|
|
5507
5786
|
}
|
|
5508
5787
|
}
|
|
5788
|
+
class PulseAnimate extends ACustomAnimate {
|
|
5789
|
+
constructor(from, to, duration, easing, params) {
|
|
5790
|
+
super(from, to, duration, easing, params);
|
|
5791
|
+
this.originalAttributes = {};
|
|
5792
|
+
this.pulseCount = 3;
|
|
5793
|
+
this.pulseOpacity = 0.3;
|
|
5794
|
+
this.pulseScale = 1.05;
|
|
5795
|
+
this.pulseColor = null;
|
|
5796
|
+
this.pulseColorIntensity = 0.2;
|
|
5797
|
+
this.strokeOnly = false;
|
|
5798
|
+
this.fillOnly = false;
|
|
5799
|
+
this.useScale = true;
|
|
5800
|
+
this.useOpacity = true;
|
|
5801
|
+
this.useStroke = true;
|
|
5802
|
+
this.useFill = true;
|
|
5803
|
+
this.useColor = false;
|
|
5804
|
+
this.originalFill = null;
|
|
5805
|
+
this.originalStroke = null;
|
|
5806
|
+
if ((params === null || params === void 0 ? void 0 : params.pulseCount) !== undefined) {
|
|
5807
|
+
this.pulseCount = params.pulseCount;
|
|
5808
|
+
}
|
|
5809
|
+
if ((params === null || params === void 0 ? void 0 : params.pulseScale) !== undefined) {
|
|
5810
|
+
this.pulseScale = params.pulseScale;
|
|
5811
|
+
}
|
|
5812
|
+
if ((params === null || params === void 0 ? void 0 : params.pulseColor) !== undefined) {
|
|
5813
|
+
this.pulseColor = params.pulseColor;
|
|
5814
|
+
}
|
|
5815
|
+
if ((params === null || params === void 0 ? void 0 : params.pulseColorIntensity) !== undefined) {
|
|
5816
|
+
this.pulseColorIntensity = params.pulseColorIntensity;
|
|
5817
|
+
}
|
|
5818
|
+
if ((params === null || params === void 0 ? void 0 : params.strokeOnly) !== undefined) {
|
|
5819
|
+
this.strokeOnly = params.strokeOnly;
|
|
5820
|
+
}
|
|
5821
|
+
if ((params === null || params === void 0 ? void 0 : params.fillOnly) !== undefined) {
|
|
5822
|
+
this.fillOnly = params.fillOnly;
|
|
5823
|
+
}
|
|
5824
|
+
if ((params === null || params === void 0 ? void 0 : params.useScale) !== undefined) {
|
|
5825
|
+
this.useScale = params.useScale;
|
|
5826
|
+
}
|
|
5827
|
+
if ((params === null || params === void 0 ? void 0 : params.useOpacity) !== undefined) {
|
|
5828
|
+
this.useOpacity = params.useOpacity;
|
|
5829
|
+
}
|
|
5830
|
+
if ((params === null || params === void 0 ? void 0 : params.useStroke) !== undefined) {
|
|
5831
|
+
this.useStroke = params.useStroke;
|
|
5832
|
+
}
|
|
5833
|
+
if ((params === null || params === void 0 ? void 0 : params.useFill) !== undefined) {
|
|
5834
|
+
this.useFill = params.useFill;
|
|
5835
|
+
}
|
|
5836
|
+
if ((params === null || params === void 0 ? void 0 : params.useColor) !== undefined) {
|
|
5837
|
+
this.useColor = params.useColor;
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
onBind() {
|
|
5841
|
+
super.onBind();
|
|
5842
|
+
this.originalAttributes = Object.assign({}, this.target.getAttributes());
|
|
5843
|
+
if (this.useColor) {
|
|
5844
|
+
this.originalFill = this.originalAttributes.fill || null;
|
|
5845
|
+
this.originalStroke = this.originalAttributes.stroke || null;
|
|
5846
|
+
if (!this.pulseColor) {
|
|
5847
|
+
if (this.fillOnly && this.originalFill) {
|
|
5848
|
+
this.pulseColor = this.originalFill;
|
|
5849
|
+
}
|
|
5850
|
+
else if (this.strokeOnly && this.originalStroke) {
|
|
5851
|
+
this.pulseColor = this.originalStroke;
|
|
5852
|
+
}
|
|
5853
|
+
else if (this.originalFill) {
|
|
5854
|
+
this.pulseColor = this.originalFill;
|
|
5855
|
+
}
|
|
5856
|
+
else if (this.originalStroke) {
|
|
5857
|
+
this.pulseColor = this.originalStroke;
|
|
5858
|
+
}
|
|
5859
|
+
else {
|
|
5860
|
+
this.pulseColor = '#FFFFFF';
|
|
5861
|
+
}
|
|
5862
|
+
}
|
|
5863
|
+
}
|
|
5864
|
+
}
|
|
5865
|
+
onUpdate(end, ratio, out) {
|
|
5866
|
+
const angle = ratio * Math.PI * this.pulseCount;
|
|
5867
|
+
const pulseValue = Math.abs(Math.sin(angle));
|
|
5868
|
+
const attribute = this.target.attribute;
|
|
5869
|
+
if (this.useOpacity) {
|
|
5870
|
+
const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
|
|
5871
|
+
if (this.useStroke) {
|
|
5872
|
+
attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity;
|
|
5873
|
+
}
|
|
5874
|
+
if (this.useFill) {
|
|
5875
|
+
attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity;
|
|
5876
|
+
}
|
|
5877
|
+
}
|
|
5878
|
+
if (this.useScale) {
|
|
5879
|
+
const scale = 1 + (this.pulseScale - 1) * pulseValue;
|
|
5880
|
+
attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale;
|
|
5881
|
+
attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
|
|
5882
|
+
}
|
|
5883
|
+
if (this.useColor && this.pulseColor) {
|
|
5884
|
+
this.applyColorPulse(attribute, pulseValue);
|
|
5885
|
+
}
|
|
5886
|
+
this.target.addUpdateShapeAndBoundsTag();
|
|
5887
|
+
this.target.addUpdatePositionTag();
|
|
5888
|
+
}
|
|
5889
|
+
applyColorPulse(attribute, pulseValue) {
|
|
5890
|
+
const colorRatio = this.pulseColorIntensity * pulseValue;
|
|
5891
|
+
if (this.useFill && this.originalFill && this.pulseColor) {
|
|
5892
|
+
attribute.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, true);
|
|
5893
|
+
}
|
|
5894
|
+
if (this.useStroke && this.originalStroke && this.pulseColor) {
|
|
5895
|
+
attribute.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, true);
|
|
5896
|
+
}
|
|
5897
|
+
}
|
|
5898
|
+
onEnd() {
|
|
5899
|
+
super.onEnd();
|
|
5900
|
+
this.target.setAttributes(this.originalAttributes);
|
|
5901
|
+
}
|
|
5902
|
+
}
|
|
5509
5903
|
|
|
5510
5904
|
class Update extends ACustomAnimate {
|
|
5511
5905
|
constructor(from, to, duration, easing, params) {
|
|
@@ -5551,20 +5945,14 @@ const moveIn = (graphic, options, animationParameters) => {
|
|
|
5551
5945
|
let changedX = 0;
|
|
5552
5946
|
let changedY = 0;
|
|
5553
5947
|
if (orient === 'negative') {
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
changedY = (_b = animationParameters.groupHeight) !== null && _b !== void 0 ? _b : animationParameters.group.getBounds().height();
|
|
5557
|
-
animationParameters.groupWidth = changedX;
|
|
5558
|
-
animationParameters.groupHeight = changedY;
|
|
5559
|
-
}
|
|
5560
|
-
else {
|
|
5561
|
-
changedX = animationParameters.width;
|
|
5562
|
-
changedY = animationParameters.height;
|
|
5563
|
-
}
|
|
5948
|
+
changedX = graphic.stage.viewWidth;
|
|
5949
|
+
changedY = graphic.stage.viewHeight;
|
|
5564
5950
|
}
|
|
5565
5951
|
changedX += offset;
|
|
5566
5952
|
changedY += offset;
|
|
5567
|
-
const point = isFunction(pointOpt)
|
|
5953
|
+
const point = isFunction(pointOpt)
|
|
5954
|
+
? pointOpt.call(null, (_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], graphic, animationParameters)
|
|
5955
|
+
: pointOpt;
|
|
5568
5956
|
const fromX = point && isValidNumber(point.x) ? point.x : changedX;
|
|
5569
5957
|
const fromY = point && isValidNumber(point.y) ? point.y : changedY;
|
|
5570
5958
|
const finalAttrs = graphic.getFinalAttribute();
|
|
@@ -5595,12 +5983,13 @@ const moveIn = (graphic, options, animationParameters) => {
|
|
|
5595
5983
|
const moveOut = (graphic, options, animationParameters) => {
|
|
5596
5984
|
var _a, _b;
|
|
5597
5985
|
const { offset = 0, orient, direction, point: pointOpt } = options !== null && options !== void 0 ? options : {};
|
|
5598
|
-
const
|
|
5599
|
-
const
|
|
5600
|
-
const groupHeight = (_b = groupBounds === null || groupBounds === void 0 ? void 0 : groupBounds.height()) !== null && _b !== void 0 ? _b : animationParameters.height;
|
|
5986
|
+
const groupWidth = graphic.stage.viewWidth;
|
|
5987
|
+
const groupHeight = graphic.stage.viewHeight;
|
|
5601
5988
|
const changedX = (orient === 'negative' ? groupWidth : 0) + offset;
|
|
5602
5989
|
const changedY = (orient === 'negative' ? groupHeight : 0) + offset;
|
|
5603
|
-
const point = isFunction(pointOpt)
|
|
5990
|
+
const point = isFunction(pointOpt)
|
|
5991
|
+
? pointOpt.call(null, (_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], graphic, animationParameters)
|
|
5992
|
+
: pointOpt;
|
|
5604
5993
|
const fromX = point && isValidNumber(point.x) ? point.x : changedX;
|
|
5605
5994
|
const fromY = point && isValidNumber(point.y) ? point.y : changedY;
|
|
5606
5995
|
switch (direction) {
|
|
@@ -5640,6 +6029,7 @@ class MoveBase extends ACustomAnimate {
|
|
|
5640
6029
|
}
|
|
5641
6030
|
class MoveIn extends MoveBase {
|
|
5642
6031
|
onBind() {
|
|
6032
|
+
var _a;
|
|
5643
6033
|
super.onBind();
|
|
5644
6034
|
const { from, to } = moveIn(this.target, this.params.options, this.params);
|
|
5645
6035
|
this.props = to;
|
|
@@ -5650,7 +6040,9 @@ class MoveIn extends MoveBase {
|
|
|
5650
6040
|
if (finalAttribute) {
|
|
5651
6041
|
Object.assign(this.target.attribute, finalAttribute);
|
|
5652
6042
|
}
|
|
5653
|
-
this.
|
|
6043
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
6044
|
+
this.target.setAttributes(from);
|
|
6045
|
+
}
|
|
5654
6046
|
}
|
|
5655
6047
|
}
|
|
5656
6048
|
class MoveOut extends MoveBase {
|
|
@@ -5723,6 +6115,7 @@ class RotateBase extends ACustomAnimate {
|
|
|
5723
6115
|
}
|
|
5724
6116
|
class RotateIn extends RotateBase {
|
|
5725
6117
|
onBind() {
|
|
6118
|
+
var _a;
|
|
5726
6119
|
super.onBind();
|
|
5727
6120
|
const { from, to } = rotateIn(this.target, this.params.options);
|
|
5728
6121
|
this.props = to;
|
|
@@ -5733,7 +6126,9 @@ class RotateIn extends RotateBase {
|
|
|
5733
6126
|
if (finalAttribute) {
|
|
5734
6127
|
Object.assign(this.target.attribute, finalAttribute);
|
|
5735
6128
|
}
|
|
5736
|
-
this.
|
|
6129
|
+
if (((_a = this.params.controlOptions) === null || _a === void 0 ? void 0 : _a.immediatelyApply) !== false) {
|
|
6130
|
+
this.target.setAttributes(from);
|
|
6131
|
+
}
|
|
5737
6132
|
}
|
|
5738
6133
|
}
|
|
5739
6134
|
class RotateOut extends RotateBase {
|
|
@@ -5786,6 +6181,7 @@ class FromTo extends ACustomAnimate {
|
|
|
5786
6181
|
this.from = from !== null && from !== void 0 ? from : {};
|
|
5787
6182
|
}
|
|
5788
6183
|
onBind() {
|
|
6184
|
+
var _a, _b;
|
|
5789
6185
|
super.onBind();
|
|
5790
6186
|
const finalAttribute = this.target.getFinalAttribute();
|
|
5791
6187
|
Object.keys(this.from).forEach(key => {
|
|
@@ -5793,6 +6189,14 @@ class FromTo extends ACustomAnimate {
|
|
|
5793
6189
|
this.props[key] = finalAttribute[key];
|
|
5794
6190
|
}
|
|
5795
6191
|
});
|
|
6192
|
+
if (((_a = this.target.context) === null || _a === void 0 ? void 0 : _a.animationState) === 'appear') {
|
|
6193
|
+
if (finalAttribute) {
|
|
6194
|
+
Object.assign(this.target.attribute, finalAttribute);
|
|
6195
|
+
}
|
|
6196
|
+
}
|
|
6197
|
+
if (((_b = this.params.controlOptions) === null || _b === void 0 ? void 0 : _b.immediatelyApply) !== false) {
|
|
6198
|
+
this.target.setAttributes(this.from);
|
|
6199
|
+
}
|
|
5796
6200
|
}
|
|
5797
6201
|
onFirstRun() {
|
|
5798
6202
|
var _a;
|
|
@@ -6114,13 +6518,16 @@ const registerCustomAnimate = () => {
|
|
|
6114
6518
|
AnimateExecutor.registerBuiltInAnimate('spinIn', SpinIn);
|
|
6115
6519
|
AnimateExecutor.registerBuiltInAnimate('moveScaleIn', MoveScaleIn);
|
|
6116
6520
|
AnimateExecutor.registerBuiltInAnimate('moveRotateIn', MoveRotateIn);
|
|
6521
|
+
AnimateExecutor.registerBuiltInAnimate('strokeIn', StrokeIn);
|
|
6117
6522
|
AnimateExecutor.registerBuiltInAnimate('slideOut', SlideOut);
|
|
6118
6523
|
AnimateExecutor.registerBuiltInAnimate('growOut', GrowOut);
|
|
6119
6524
|
AnimateExecutor.registerBuiltInAnimate('spinOut', SpinOut);
|
|
6120
6525
|
AnimateExecutor.registerBuiltInAnimate('moveScaleOut', MoveScaleOut);
|
|
6121
6526
|
AnimateExecutor.registerBuiltInAnimate('moveRotateOut', MoveRotateOut);
|
|
6527
|
+
AnimateExecutor.registerBuiltInAnimate('strokeOut', StrokeOut);
|
|
6528
|
+
AnimateExecutor.registerBuiltInAnimate('pulse', PulseAnimate);
|
|
6122
6529
|
AnimateExecutor.registerBuiltInAnimate('MotionPath', MotionPath);
|
|
6123
6530
|
AnimateExecutor.registerBuiltInAnimate('streamLight', StreamLight);
|
|
6124
6531
|
};
|
|
6125
6532
|
|
|
6126
|
-
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, MotionPath, MoveIn, MoveOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, OutputRichText, PoptipAppear, PoptipDisappear, RotateBySphereAnimate, RotateIn, RotateOut, ScaleIn, ScaleOut, SlideIn, SlideOut, SlideOutRichText, SlideRichText, SpinIn, SpinOut, State, StreamLight, TagPointsUpdate, Update, createComponentAnimator, generatorPathEasingFunc, registerAnimate, registerCustomAnimate, transitionRegistry };
|
|
6533
|
+
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, MotionPath, MoveIn, MoveOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, OutputRichText, PoptipAppear, PoptipDisappear, PulseAnimate, RotateBySphereAnimate, RotateIn, RotateOut, ScaleIn, ScaleOut, SlideIn, SlideOut, SlideOutRichText, SlideRichText, SpinIn, SpinOut, State, StreamLight, StrokeIn, StrokeOut, TagPointsUpdate, Update, createComponentAnimator, generatorPathEasingFunc, registerAnimate, registerCustomAnimate, transitionRegistry };
|