@visactor/vrender-animate 1.0.0-alpha.1 → 1.0.0-alpha.3
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/custom/clip-graphic.js +1 -1
- package/cjs/custom/clip-graphic.js.map +1 -1
- package/cjs/custom/common.js +2 -0
- package/cjs/custom/common.js.map +1 -1
- package/cjs/custom/custom-animate.js +1 -1
- package/cjs/custom/custom-animate.js.map +1 -1
- package/cjs/custom/{from-to.d.ts → fromTo.d.ts} +1 -0
- package/cjs/custom/fromTo.js +44 -0
- package/cjs/custom/fromTo.js.map +1 -0
- package/cjs/custom/{group-fade.js → groupFade.js} +1 -1
- package/cjs/custom/groupFade.js.map +1 -0
- package/cjs/custom/growAngle.js +2 -0
- package/cjs/custom/growAngle.js.map +1 -1
- package/cjs/custom/growCenter.js +2 -0
- package/cjs/custom/growCenter.js.map +1 -1
- package/cjs/custom/growHeight.js +2 -0
- package/cjs/custom/growHeight.js.map +1 -1
- package/cjs/custom/growPoints.js +6 -6
- package/cjs/custom/growPoints.js.map +1 -1
- package/cjs/custom/growRadius.js +2 -0
- package/cjs/custom/growRadius.js.map +1 -1
- package/cjs/custom/growWidth.js +2 -0
- package/cjs/custom/growWidth.js.map +1 -1
- package/cjs/custom/label-item-animate.js +2 -0
- package/cjs/custom/label-item-animate.js.map +1 -1
- 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.js +2 -0
- package/cjs/custom/move.js.map +1 -1
- package/cjs/custom/poptip-animate.js +2 -0
- package/cjs/custom/poptip-animate.js.map +1 -1
- package/cjs/custom/register.d.ts +27 -0
- package/cjs/custom/register.js +376 -4
- package/cjs/custom/register.js.map +1 -1
- package/cjs/custom/richtext/input-richtext.js +2 -1
- package/cjs/custom/rotate.js +2 -0
- package/cjs/custom/rotate.js.map +1 -1
- package/cjs/custom/scale.js +3 -2
- package/cjs/custom/scale.js.map +1 -1
- package/cjs/custom/sphere.js +5 -2
- package/cjs/custom/sphere.js.map +1 -1
- package/cjs/custom/state.js +1 -1
- package/cjs/custom/state.js.map +1 -1
- package/cjs/custom/story.js +5 -0
- 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 +1 -0
- package/cjs/custom/tag-points.js.map +1 -1
- package/cjs/custom/update.js +1 -0
- package/cjs/custom/update.js.map +1 -1
- package/cjs/executor/animate-executor.js +8 -3
- package/cjs/executor/animate-executor.js.map +1 -1
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +5 -14
- package/cjs/index.js.map +1 -1
- package/cjs/step.d.ts +2 -0
- package/cjs/step.js +10 -6
- package/cjs/step.js.map +1 -1
- package/cjs/utils/easing-func.js +1 -2
- package/dist/index.es.js +359 -31
- package/es/custom/clip-graphic.js +1 -1
- package/es/custom/clip-graphic.js.map +1 -1
- package/es/custom/common.js +2 -0
- package/es/custom/common.js.map +1 -1
- package/es/custom/custom-animate.js +1 -1
- package/es/custom/custom-animate.js.map +1 -1
- package/es/custom/{from-to.d.ts → fromTo.d.ts} +1 -0
- package/es/custom/fromTo.js +36 -0
- package/es/custom/fromTo.js.map +1 -0
- package/es/custom/{group-fade.js → groupFade.js} +1 -1
- package/es/custom/groupFade.js.map +1 -0
- package/es/custom/growAngle.js +2 -0
- package/es/custom/growAngle.js.map +1 -1
- package/es/custom/growCenter.js +2 -0
- package/es/custom/growCenter.js.map +1 -1
- package/es/custom/growHeight.js +2 -0
- package/es/custom/growHeight.js.map +1 -1
- package/es/custom/growPoints.js +6 -6
- package/es/custom/growPoints.js.map +1 -1
- package/es/custom/growRadius.js +2 -0
- package/es/custom/growRadius.js.map +1 -1
- package/es/custom/growWidth.js +2 -0
- package/es/custom/growWidth.js.map +1 -1
- package/es/custom/label-item-animate.js +2 -0
- package/es/custom/label-item-animate.js.map +1 -1
- 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.js +2 -0
- package/es/custom/move.js.map +1 -1
- package/es/custom/poptip-animate.js +2 -0
- package/es/custom/poptip-animate.js.map +1 -1
- package/es/custom/register.d.ts +27 -0
- package/es/custom/register.js +11 -2
- package/es/custom/register.js.map +1 -1
- package/es/custom/richtext/input-richtext.js +2 -1
- package/es/custom/rotate.js +2 -0
- package/es/custom/rotate.js.map +1 -1
- package/es/custom/scale.js +3 -2
- package/es/custom/scale.js.map +1 -1
- package/es/custom/sphere.js +5 -2
- package/es/custom/sphere.js.map +1 -1
- package/es/custom/state.js +1 -1
- package/es/custom/state.js.map +1 -1
- package/es/custom/story.js +5 -0
- 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 +1 -0
- package/es/custom/tag-points.js.map +1 -1
- package/es/custom/update.js +1 -0
- package/es/custom/update.js.map +1 -1
- package/es/executor/animate-executor.js +7 -3
- package/es/executor/animate-executor.js.map +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/index.js.map +1 -1
- package/es/step.d.ts +2 -0
- package/es/step.js +10 -6
- package/es/step.js.map +1 -1
- package/es/utils/easing-func.js +1 -2
- package/package.json +3 -3
- package/cjs/custom/from-to.js +0 -38
- package/cjs/custom/from-to.js.map +0 -1
- package/cjs/custom/group-fade.js.map +0 -1
- package/es/custom/from-to.js +0 -30
- package/es/custom/from-to.js.map +0 -1
- package/es/custom/group-fade.js.map +0 -1
- /package/cjs/custom/{group-fade.d.ts → groupFade.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, isNil, isNumberClose } from '@visactor/vutils';
|
|
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';
|
|
3
3
|
|
|
4
4
|
class Easing {
|
|
5
5
|
constructor() {
|
|
@@ -349,6 +349,9 @@ class Step {
|
|
|
349
349
|
constructor(type, props, duration, easing) {
|
|
350
350
|
this._startTime = 0;
|
|
351
351
|
this._hasFirstRun = false;
|
|
352
|
+
this._syncAttributeUpdate = () => {
|
|
353
|
+
this.target.setAttributes(this.target.attribute);
|
|
354
|
+
};
|
|
352
355
|
this.type = type;
|
|
353
356
|
this.props = props;
|
|
354
357
|
this.duration = duration;
|
|
@@ -362,11 +365,13 @@ class Step {
|
|
|
362
365
|
this.onUpdate = noop;
|
|
363
366
|
}
|
|
364
367
|
this.id = Generator.GenAutoIncrementId();
|
|
368
|
+
this.syncAttributeUpdate = noop;
|
|
365
369
|
}
|
|
366
370
|
bind(target, animate) {
|
|
367
371
|
this.target = target;
|
|
368
372
|
this.animate = animate;
|
|
369
373
|
this.onBind();
|
|
374
|
+
this.syncAttributeUpdate();
|
|
370
375
|
}
|
|
371
376
|
append(step) {
|
|
372
377
|
this.next = step;
|
|
@@ -446,6 +451,9 @@ class Step {
|
|
|
446
451
|
return this._startTime;
|
|
447
452
|
}
|
|
448
453
|
onBind() {
|
|
454
|
+
if (this.target.type === 'glyph') {
|
|
455
|
+
this.syncAttributeUpdate = this._syncAttributeUpdate;
|
|
456
|
+
}
|
|
449
457
|
}
|
|
450
458
|
onFirstRun() {
|
|
451
459
|
}
|
|
@@ -513,6 +521,7 @@ class Step {
|
|
|
513
521
|
func(key, fromValue, toValue, easedRatio, this, this.target);
|
|
514
522
|
});
|
|
515
523
|
this.onUpdate(end, easedRatio, out);
|
|
524
|
+
this.syncAttributeUpdate();
|
|
516
525
|
}
|
|
517
526
|
onUpdate(end, ratio, out) {
|
|
518
527
|
}
|
|
@@ -1632,7 +1641,7 @@ class AnimateExecutor {
|
|
|
1632
1641
|
if (custom && customType) {
|
|
1633
1642
|
const customParams = this.resolveValue(customParameters, graphic, {});
|
|
1634
1643
|
const objOptions = isFunction(options)
|
|
1635
|
-
? options.call(null, (_b = (
|
|
1644
|
+
? 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)
|
|
1636
1645
|
: options;
|
|
1637
1646
|
customParams.options = objOptions;
|
|
1638
1647
|
if (customType === 1) {
|
|
@@ -1686,6 +1695,7 @@ class AnimateExecutor {
|
|
|
1686
1695
|
}
|
|
1687
1696
|
const effectsArray = Array.isArray(effects) ? effects : [effects];
|
|
1688
1697
|
effectsArray.forEach(effect => {
|
|
1698
|
+
var _a, _b;
|
|
1689
1699
|
const { type = 'fromTo', channel, customParameters, easing = 'linear', options } = effect;
|
|
1690
1700
|
let parsedFromProps = null;
|
|
1691
1701
|
let props = effect.to;
|
|
@@ -1702,7 +1712,9 @@ class AnimateExecutor {
|
|
|
1702
1712
|
}
|
|
1703
1713
|
from = parsedFromProps.from;
|
|
1704
1714
|
}
|
|
1705
|
-
|
|
1715
|
+
const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[type];
|
|
1716
|
+
const customType = (_b = effect.customType) !== null && _b !== void 0 ? _b : (custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0);
|
|
1717
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic);
|
|
1706
1718
|
});
|
|
1707
1719
|
if (delayAfterValue > 0) {
|
|
1708
1720
|
animate.wait(delayAfterValue);
|
|
@@ -1733,8 +1745,9 @@ class AnimateExecutor {
|
|
|
1733
1745
|
};
|
|
1734
1746
|
}
|
|
1735
1747
|
if (!Array.isArray(channel)) {
|
|
1736
|
-
Object.
|
|
1748
|
+
Object.keys(channel).forEach(key => {
|
|
1737
1749
|
var _a, _b;
|
|
1750
|
+
const config = channel[key];
|
|
1738
1751
|
if (config.to !== undefined) {
|
|
1739
1752
|
if (typeof config.to === 'function') {
|
|
1740
1753
|
props[key] = config.to((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data, graphic, {});
|
|
@@ -2095,6 +2108,7 @@ class ACustomAnimate extends Step {
|
|
|
2095
2108
|
}
|
|
2096
2109
|
const easedRatio = this.easing(ratio);
|
|
2097
2110
|
this.onUpdate(end, easedRatio, out);
|
|
2111
|
+
this.syncAttributeUpdate();
|
|
2098
2112
|
}
|
|
2099
2113
|
setProps(props) {
|
|
2100
2114
|
this.props = props;
|
|
@@ -2476,6 +2490,7 @@ class ClipGraphicAnimate extends ACustomAnimate {
|
|
|
2476
2490
|
this._clipGraphic = params === null || params === void 0 ? void 0 : params.clipGraphic;
|
|
2477
2491
|
}
|
|
2478
2492
|
onBind() {
|
|
2493
|
+
super.onBind();
|
|
2479
2494
|
if (this._group && this._clipGraphic) {
|
|
2480
2495
|
this._lastClip = this._group.attribute.clip;
|
|
2481
2496
|
this._lastPath = this._group.attribute.path;
|
|
@@ -2644,6 +2659,7 @@ class TagPointsUpdate extends ACustomAnimate {
|
|
|
2644
2659
|
return [];
|
|
2645
2660
|
}
|
|
2646
2661
|
onBind() {
|
|
2662
|
+
super.onBind();
|
|
2647
2663
|
const { points, segments } = this.target.attribute;
|
|
2648
2664
|
const { points: pointsTo, segments: segmentsTo } = this.target.getFinalAttribute();
|
|
2649
2665
|
this.from = { points, segments };
|
|
@@ -2777,6 +2793,7 @@ class CommonIn extends ACustomAnimate {
|
|
|
2777
2793
|
}
|
|
2778
2794
|
onBind() {
|
|
2779
2795
|
var _a;
|
|
2796
|
+
super.onBind();
|
|
2780
2797
|
const attrs = this.target.getFinalAttribute();
|
|
2781
2798
|
const fromAttrs = (_a = this.target.attribute) !== null && _a !== void 0 ? _a : {};
|
|
2782
2799
|
const to = {};
|
|
@@ -2813,6 +2830,7 @@ class CommonOut extends ACustomAnimate {
|
|
|
2813
2830
|
super(from, to, duration, easing, params);
|
|
2814
2831
|
}
|
|
2815
2832
|
onBind() {
|
|
2833
|
+
super.onBind();
|
|
2816
2834
|
const attrs = this.target.attribute;
|
|
2817
2835
|
const to = {};
|
|
2818
2836
|
const from = {};
|
|
@@ -2870,6 +2888,7 @@ class RotateBySphereAnimate extends ACustomAnimate {
|
|
|
2870
2888
|
this.phi = phi;
|
|
2871
2889
|
}
|
|
2872
2890
|
onBind() {
|
|
2891
|
+
super.onBind();
|
|
2873
2892
|
return;
|
|
2874
2893
|
}
|
|
2875
2894
|
onEnd() {
|
|
@@ -3079,6 +3098,7 @@ class GrowAngleBase extends ACustomAnimate {
|
|
|
3079
3098
|
class GrowAngleIn extends GrowAngleBase {
|
|
3080
3099
|
onBind() {
|
|
3081
3100
|
var _a, _b;
|
|
3101
|
+
super.onBind();
|
|
3082
3102
|
const { from, to } = growAngleIn(this.target, this.params.options, this.params);
|
|
3083
3103
|
const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
|
|
3084
3104
|
this.props = to;
|
|
@@ -3095,6 +3115,7 @@ class GrowAngleIn extends GrowAngleBase {
|
|
|
3095
3115
|
}
|
|
3096
3116
|
class GrowAngleOut extends GrowAngleBase {
|
|
3097
3117
|
onBind() {
|
|
3118
|
+
super.onBind();
|
|
3098
3119
|
const { from, to } = growAngleOut(this.target, this.params.options, this.params);
|
|
3099
3120
|
const fromAttrs = from;
|
|
3100
3121
|
this.props = to;
|
|
@@ -3262,6 +3283,7 @@ class GrowCenterIn extends ACustomAnimate {
|
|
|
3262
3283
|
}
|
|
3263
3284
|
onBind() {
|
|
3264
3285
|
var _a, _b;
|
|
3286
|
+
super.onBind();
|
|
3265
3287
|
const { from, to } = growCenterIn(this.target, this.params.options, this.params);
|
|
3266
3288
|
const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
|
|
3267
3289
|
this.props = to;
|
|
@@ -3291,6 +3313,7 @@ class GrowCenterOut extends ACustomAnimate {
|
|
|
3291
3313
|
super(from, to, duration, easing, params);
|
|
3292
3314
|
}
|
|
3293
3315
|
onBind() {
|
|
3316
|
+
super.onBind();
|
|
3294
3317
|
const { from, to } = growCenterOut(this.target, this.params.options, this.params);
|
|
3295
3318
|
this.props = to;
|
|
3296
3319
|
this.propKeys = Object.keys(to).filter(key => to[key] != null);
|
|
@@ -3367,6 +3390,7 @@ class GrowHeightIn extends ACustomAnimate {
|
|
|
3367
3390
|
}
|
|
3368
3391
|
onBind() {
|
|
3369
3392
|
var _a, _b;
|
|
3393
|
+
super.onBind();
|
|
3370
3394
|
const { from, to } = growHeightIn(this.target, this.params.options, this.params);
|
|
3371
3395
|
const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
|
|
3372
3396
|
this.props = to;
|
|
@@ -3443,6 +3467,7 @@ class GrowHeightOut extends ACustomAnimate {
|
|
|
3443
3467
|
super(from, to, duration, easing, params);
|
|
3444
3468
|
}
|
|
3445
3469
|
onBind() {
|
|
3470
|
+
super.onBind();
|
|
3446
3471
|
const { from, to } = growHeightOut(this.target, this.params.options, this.params);
|
|
3447
3472
|
this.props = to;
|
|
3448
3473
|
this.propKeys = Object.keys(to).filter(key => to[key] != null);
|
|
@@ -3521,6 +3546,7 @@ class GworPointsBase extends ACustomAnimate {
|
|
|
3521
3546
|
}
|
|
3522
3547
|
class GrowPointsIn extends GworPointsBase {
|
|
3523
3548
|
onBind() {
|
|
3549
|
+
super.onBind();
|
|
3524
3550
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3525
3551
|
const { from, to } = growPointsIn(this.target, this.params.options, this.params);
|
|
3526
3552
|
this.props = to;
|
|
@@ -3540,6 +3566,7 @@ class GrowPointsIn extends GworPointsBase {
|
|
|
3540
3566
|
}
|
|
3541
3567
|
class GrowPointsOut extends GworPointsBase {
|
|
3542
3568
|
onBind() {
|
|
3569
|
+
super.onBind();
|
|
3543
3570
|
if (['area', 'line'].includes(this.target.type)) {
|
|
3544
3571
|
const attrs = this.target.getFinalAttribute();
|
|
3545
3572
|
const { from, to } = growPointsOut(this.target, this.params.options, this.params);
|
|
@@ -3585,6 +3612,7 @@ const growPointsXOut = (graphic, options, animationParameters) => {
|
|
|
3585
3612
|
};
|
|
3586
3613
|
class GrowPointsXIn extends GworPointsBase {
|
|
3587
3614
|
onBind() {
|
|
3615
|
+
super.onBind();
|
|
3588
3616
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3589
3617
|
const { from, to } = growPointsXIn(this.target, this.params.options, this.params);
|
|
3590
3618
|
this.props = to;
|
|
@@ -3604,6 +3632,7 @@ class GrowPointsXIn extends GworPointsBase {
|
|
|
3604
3632
|
}
|
|
3605
3633
|
class GrowPointsXOut extends GworPointsBase {
|
|
3606
3634
|
onBind() {
|
|
3635
|
+
super.onBind();
|
|
3607
3636
|
if (['area', 'line'].includes(this.target.type)) {
|
|
3608
3637
|
const attrs = this.target.getFinalAttribute();
|
|
3609
3638
|
const { from, to } = growPointsXOut(this.target, this.params.options, this.params);
|
|
@@ -3649,6 +3678,7 @@ const growPointsYOut = (graphic, options, animationParameters) => {
|
|
|
3649
3678
|
};
|
|
3650
3679
|
class GrowPointsYIn extends GworPointsBase {
|
|
3651
3680
|
onBind() {
|
|
3681
|
+
super.onBind();
|
|
3652
3682
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3653
3683
|
const { from, to } = growPointsYIn(this.target, this.params.options, this.params);
|
|
3654
3684
|
this.props = to;
|
|
@@ -3668,6 +3698,7 @@ class GrowPointsYIn extends GworPointsBase {
|
|
|
3668
3698
|
}
|
|
3669
3699
|
class GrowPointsYOut extends GworPointsBase {
|
|
3670
3700
|
onBind() {
|
|
3701
|
+
super.onBind();
|
|
3671
3702
|
if (['area', 'line', 'polygon'].includes(this.target.type)) {
|
|
3672
3703
|
const { from, to } = growPointsYOut(this.target, this.params.options, this.params);
|
|
3673
3704
|
this.props = to;
|
|
@@ -3763,6 +3794,7 @@ class GrowPointsBase extends ACustomAnimate {
|
|
|
3763
3794
|
class GrowRadiusIn extends GrowPointsBase {
|
|
3764
3795
|
onBind() {
|
|
3765
3796
|
var _a, _b;
|
|
3797
|
+
super.onBind();
|
|
3766
3798
|
const { from, to } = growRadiusIn(this.target, this.params.options, this.params);
|
|
3767
3799
|
const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
|
|
3768
3800
|
this.props = to;
|
|
@@ -3778,6 +3810,7 @@ class GrowRadiusIn extends GrowPointsBase {
|
|
|
3778
3810
|
}
|
|
3779
3811
|
class GrowRadiusOut extends GrowPointsBase {
|
|
3780
3812
|
onBind() {
|
|
3813
|
+
super.onBind();
|
|
3781
3814
|
const { to } = growRadiusOut(this.target, this.params.options, this.params);
|
|
3782
3815
|
this.props = to;
|
|
3783
3816
|
this.propKeys = Object.keys(to).filter(key => to[key] != null);
|
|
@@ -3890,6 +3923,7 @@ class GrowWidthIn extends ACustomAnimate {
|
|
|
3890
3923
|
}
|
|
3891
3924
|
onBind() {
|
|
3892
3925
|
var _a, _b;
|
|
3926
|
+
super.onBind();
|
|
3893
3927
|
const { from, to } = growWidthIn(this.target, this.params.options, this.params);
|
|
3894
3928
|
const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
|
|
3895
3929
|
this.props = to;
|
|
@@ -3919,6 +3953,7 @@ class GrowWidthOut extends ACustomAnimate {
|
|
|
3919
3953
|
super(from, to, duration, easing, params);
|
|
3920
3954
|
}
|
|
3921
3955
|
onBind() {
|
|
3956
|
+
super.onBind();
|
|
3922
3957
|
const { from, to } = growWidthOut(this.target, this.params.options, this.params);
|
|
3923
3958
|
this.props = to;
|
|
3924
3959
|
this.propKeys = Object.keys(to).filter(key => to[key] != null);
|
|
@@ -3940,6 +3975,7 @@ class GrowWidthOut extends ACustomAnimate {
|
|
|
3940
3975
|
|
|
3941
3976
|
class LabelItemAppear extends AComponentAnimate {
|
|
3942
3977
|
onBind() {
|
|
3978
|
+
super.onBind();
|
|
3943
3979
|
const animator = createComponentAnimator(this.target);
|
|
3944
3980
|
this._animator = animator;
|
|
3945
3981
|
const duration = this.duration;
|
|
@@ -4065,6 +4101,7 @@ class LabelItemAppear extends AComponentAnimate {
|
|
|
4065
4101
|
}
|
|
4066
4102
|
class LabelItemDisappear extends AComponentAnimate {
|
|
4067
4103
|
onBind() {
|
|
4104
|
+
super.onBind();
|
|
4068
4105
|
const animator = createComponentAnimator(this.target);
|
|
4069
4106
|
this._animator = animator;
|
|
4070
4107
|
const duration = this.duration;
|
|
@@ -4137,6 +4174,7 @@ class LabelItemDisappear extends AComponentAnimate {
|
|
|
4137
4174
|
|
|
4138
4175
|
class PoptipAppear extends AComponentAnimate {
|
|
4139
4176
|
onBind() {
|
|
4177
|
+
super.onBind();
|
|
4140
4178
|
const animator = createComponentAnimator(this.target);
|
|
4141
4179
|
this._animator = animator;
|
|
4142
4180
|
const duration = this.duration;
|
|
@@ -4210,6 +4248,7 @@ class PoptipAppear extends AComponentAnimate {
|
|
|
4210
4248
|
}
|
|
4211
4249
|
class PoptipDisappear extends AComponentAnimate {
|
|
4212
4250
|
onBind() {
|
|
4251
|
+
super.onBind();
|
|
4213
4252
|
const animator = createComponentAnimator(this.target);
|
|
4214
4253
|
this._animator = animator;
|
|
4215
4254
|
const duration = this.duration;
|
|
@@ -4921,6 +4960,7 @@ class ScaleIn extends ACustomAnimate {
|
|
|
4921
4960
|
}
|
|
4922
4961
|
onBind() {
|
|
4923
4962
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
4963
|
+
super.onBind();
|
|
4924
4964
|
let from;
|
|
4925
4965
|
let to;
|
|
4926
4966
|
const attrs = this.target.getFinalAttribute();
|
|
@@ -5000,6 +5040,7 @@ class ScaleOut extends ACustomAnimate {
|
|
|
5000
5040
|
}
|
|
5001
5041
|
onBind() {
|
|
5002
5042
|
var _a, _b, _c, _d, _e;
|
|
5043
|
+
super.onBind();
|
|
5003
5044
|
let from;
|
|
5004
5045
|
let to;
|
|
5005
5046
|
const attrs = this.target.attribute;
|
|
@@ -5058,6 +5099,7 @@ class State extends ACustomAnimate {
|
|
|
5058
5099
|
func(key, fromValue, toValue, easedRatio, this, this.target);
|
|
5059
5100
|
});
|
|
5060
5101
|
this.onUpdate(end, easedRatio, out);
|
|
5102
|
+
this.syncAttributeUpdate();
|
|
5061
5103
|
}
|
|
5062
5104
|
}
|
|
5063
5105
|
|
|
@@ -5067,6 +5109,7 @@ class SlideIn extends ACustomAnimate {
|
|
|
5067
5109
|
}
|
|
5068
5110
|
onBind() {
|
|
5069
5111
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
5112
|
+
super.onBind();
|
|
5070
5113
|
const attrs = this.target.getFinalAttribute();
|
|
5071
5114
|
const direction = ((_a = this.params) === null || _a === void 0 ? void 0 : _a.direction) || 'right';
|
|
5072
5115
|
const distance = ((_b = this.params) === null || _b === void 0 ? void 0 : _b.distance) || 50;
|
|
@@ -5113,6 +5156,7 @@ class GrowIn extends ACustomAnimate {
|
|
|
5113
5156
|
}
|
|
5114
5157
|
onBind() {
|
|
5115
5158
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
5159
|
+
super.onBind();
|
|
5116
5160
|
const attrs = this.target.getFinalAttribute();
|
|
5117
5161
|
const fromScale = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromScale) !== null && _b !== void 0 ? _b : 0;
|
|
5118
5162
|
const direction = ((_c = this.params) === null || _c === void 0 ? void 0 : _c.direction) || 'xy';
|
|
@@ -5150,6 +5194,7 @@ class SpinIn extends ACustomAnimate {
|
|
|
5150
5194
|
}
|
|
5151
5195
|
onBind() {
|
|
5152
5196
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
5197
|
+
super.onBind();
|
|
5153
5198
|
const attrs = this.target.getFinalAttribute();
|
|
5154
5199
|
const fromAngle = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromAngle) !== null && _b !== void 0 ? _b : Math.PI * 2;
|
|
5155
5200
|
const fromScale = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromScale) !== null && _d !== void 0 ? _d : 0;
|
|
@@ -5193,6 +5238,7 @@ class MoveScaleIn extends ACustomAnimate {
|
|
|
5193
5238
|
}
|
|
5194
5239
|
onBind() {
|
|
5195
5240
|
var _a, _b, _c, _d, _e, _f;
|
|
5241
|
+
super.onBind();
|
|
5196
5242
|
const executor = new AnimateExecutor(this.target);
|
|
5197
5243
|
executor.execute({
|
|
5198
5244
|
type: 'custom',
|
|
@@ -5231,6 +5277,7 @@ class MoveRotateIn extends ACustomAnimate {
|
|
|
5231
5277
|
}
|
|
5232
5278
|
onBind() {
|
|
5233
5279
|
var _a, _b, _c, _d, _e, _f;
|
|
5280
|
+
super.onBind();
|
|
5234
5281
|
const executor = new AnimateExecutor(this.target);
|
|
5235
5282
|
executor.execute({
|
|
5236
5283
|
type: 'custom',
|
|
@@ -5466,6 +5513,7 @@ class Update extends ACustomAnimate {
|
|
|
5466
5513
|
}
|
|
5467
5514
|
onBind() {
|
|
5468
5515
|
var _a, _b;
|
|
5516
|
+
super.onBind();
|
|
5469
5517
|
let { diffAttrs = {} } = (_a = this.target.context) !== null && _a !== void 0 ? _a : {};
|
|
5470
5518
|
const { options } = this.params;
|
|
5471
5519
|
if ((_b = options === null || options === void 0 ? void 0 : options.excludeChannels) === null || _b === void 0 ? void 0 : _b.length) {
|
|
@@ -5592,6 +5640,7 @@ class MoveBase extends ACustomAnimate {
|
|
|
5592
5640
|
}
|
|
5593
5641
|
class MoveIn extends MoveBase {
|
|
5594
5642
|
onBind() {
|
|
5643
|
+
super.onBind();
|
|
5595
5644
|
const { from, to } = moveIn(this.target, this.params.options, this.params);
|
|
5596
5645
|
this.props = to;
|
|
5597
5646
|
this.propKeys = Object.keys(to).filter(key => to[key] != null);
|
|
@@ -5606,6 +5655,7 @@ class MoveIn extends MoveBase {
|
|
|
5606
5655
|
}
|
|
5607
5656
|
class MoveOut extends MoveBase {
|
|
5608
5657
|
onBind() {
|
|
5658
|
+
super.onBind();
|
|
5609
5659
|
const { from, to } = moveOut(this.target, this.params.options, this.params);
|
|
5610
5660
|
this.props = to;
|
|
5611
5661
|
this.propKeys = Object.keys(to).filter(key => to[key] != null);
|
|
@@ -5673,6 +5723,7 @@ class RotateBase extends ACustomAnimate {
|
|
|
5673
5723
|
}
|
|
5674
5724
|
class RotateIn extends RotateBase {
|
|
5675
5725
|
onBind() {
|
|
5726
|
+
super.onBind();
|
|
5676
5727
|
const { from, to } = rotateIn(this.target, this.params.options);
|
|
5677
5728
|
this.props = to;
|
|
5678
5729
|
this.propKeys = ['angle'];
|
|
@@ -5687,6 +5738,7 @@ class RotateIn extends RotateBase {
|
|
|
5687
5738
|
}
|
|
5688
5739
|
class RotateOut extends RotateBase {
|
|
5689
5740
|
onBind() {
|
|
5741
|
+
super.onBind();
|
|
5690
5742
|
const { from, to } = rotateOut(this.target, this.params.options);
|
|
5691
5743
|
this.props = to;
|
|
5692
5744
|
this.propKeys = ['angle'];
|
|
@@ -5695,35 +5747,67 @@ class RotateOut extends RotateBase {
|
|
|
5695
5747
|
}
|
|
5696
5748
|
}
|
|
5697
5749
|
|
|
5750
|
+
class MotionPath extends ACustomAnimate {
|
|
5751
|
+
constructor(from, to, duration, easing, params) {
|
|
5752
|
+
var _a;
|
|
5753
|
+
super(from, to, duration, easing, params);
|
|
5754
|
+
if (params) {
|
|
5755
|
+
this.pathLength = params.path.getLength();
|
|
5756
|
+
this.path = params.path;
|
|
5757
|
+
this.distance = params.distance;
|
|
5758
|
+
this.totalLength = this.distance * this.pathLength;
|
|
5759
|
+
this.initAngle = (_a = params.initAngle) !== null && _a !== void 0 ? _a : 0;
|
|
5760
|
+
this.changeAngle = !!params.changeAngle;
|
|
5761
|
+
this.cb = params.cb;
|
|
5762
|
+
}
|
|
5763
|
+
}
|
|
5764
|
+
onBind() {
|
|
5765
|
+
this.from = { x: 0, y: 0 };
|
|
5766
|
+
this.to = this.path.getAttrAt(this.totalLength).pos;
|
|
5767
|
+
this.props = this.to;
|
|
5768
|
+
}
|
|
5769
|
+
onUpdate(end, ratio, out) {
|
|
5770
|
+
const attrs = {};
|
|
5771
|
+
const at = this.totalLength * ratio;
|
|
5772
|
+
const { pos, angle } = this.path.getAttrAt(at);
|
|
5773
|
+
attrs.x = pos.x;
|
|
5774
|
+
attrs.y = pos.y;
|
|
5775
|
+
if (this.changeAngle) {
|
|
5776
|
+
attrs.angle = angle + this.initAngle;
|
|
5777
|
+
}
|
|
5778
|
+
this.cb && this.cb(this.from, this.to, ratio, this.target);
|
|
5779
|
+
this.target.setAttributes(attrs);
|
|
5780
|
+
}
|
|
5781
|
+
}
|
|
5782
|
+
|
|
5698
5783
|
class FromTo extends ACustomAnimate {
|
|
5699
5784
|
constructor(from, to, duration, easing, params) {
|
|
5700
5785
|
super(from, to, duration, easing, params);
|
|
5701
|
-
this.from = from;
|
|
5702
|
-
this.to = to;
|
|
5786
|
+
this.from = from !== null && from !== void 0 ? from : {};
|
|
5703
5787
|
}
|
|
5704
5788
|
onBind() {
|
|
5705
|
-
|
|
5789
|
+
super.onBind();
|
|
5706
5790
|
const finalAttribute = this.target.getFinalAttribute();
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
fromKeys.forEach(key => {
|
|
5711
|
-
var _a;
|
|
5712
|
-
if (this.to[key] == null) {
|
|
5713
|
-
this.to[key] = (_a = finalAttribute[key]) !== null && _a !== void 0 ? _a : 0;
|
|
5714
|
-
}
|
|
5715
|
-
});
|
|
5716
|
-
toKeys.forEach(key => {
|
|
5717
|
-
var _a;
|
|
5718
|
-
if (this.from[key] == null) {
|
|
5719
|
-
this.from[key] = (_a = currAttribute[key]) !== null && _a !== void 0 ? _a : 0;
|
|
5791
|
+
Object.keys(this.from).forEach(key => {
|
|
5792
|
+
if (this.props[key] == null) {
|
|
5793
|
+
this.props[key] = finalAttribute[key];
|
|
5720
5794
|
}
|
|
5721
5795
|
});
|
|
5722
|
-
|
|
5796
|
+
}
|
|
5797
|
+
onFirstRun() {
|
|
5798
|
+
var _a;
|
|
5799
|
+
this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
|
|
5800
|
+
const startProps = this.animate.getStartProps();
|
|
5801
|
+
this.propKeys &&
|
|
5802
|
+
this.propKeys.forEach(key => {
|
|
5803
|
+
var _a;
|
|
5804
|
+
this.from[key] = (_a = this.from[key]) !== null && _a !== void 0 ? _a : startProps[key];
|
|
5805
|
+
});
|
|
5723
5806
|
if (((_a = this.target.context) === null || _a === void 0 ? void 0 : _a.animationState) === 'appear') {
|
|
5724
5807
|
const finalAttribute = this.target.getFinalAttribute();
|
|
5725
5808
|
this.target.setAttributes(finalAttribute);
|
|
5726
5809
|
}
|
|
5810
|
+
this.target.setAttributes(this.from);
|
|
5727
5811
|
}
|
|
5728
5812
|
update(end, ratio, out) {
|
|
5729
5813
|
this.onStart();
|
|
@@ -5731,15 +5815,257 @@ class FromTo extends ACustomAnimate {
|
|
|
5731
5815
|
return;
|
|
5732
5816
|
}
|
|
5733
5817
|
const easedRatio = this.easing(ratio);
|
|
5734
|
-
this.
|
|
5735
|
-
|
|
5736
|
-
|
|
5818
|
+
this.animate.interpolateUpdateFunction
|
|
5819
|
+
? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target)
|
|
5820
|
+
: this.interpolateUpdateFunctions.forEach((func, index) => {
|
|
5821
|
+
if (!this.animate.validAttr(this.propKeys[index])) {
|
|
5822
|
+
return;
|
|
5823
|
+
}
|
|
5824
|
+
const key = this.propKeys[index];
|
|
5825
|
+
const fromValue = this.from[key];
|
|
5826
|
+
const toValue = this.props[key];
|
|
5827
|
+
func(key, fromValue, toValue, easedRatio, this, this.target);
|
|
5828
|
+
});
|
|
5829
|
+
this.onUpdate(end, easedRatio, out);
|
|
5830
|
+
this.syncAttributeUpdate();
|
|
5831
|
+
}
|
|
5832
|
+
}
|
|
5833
|
+
|
|
5834
|
+
class StreamLight extends ACustomAnimate {
|
|
5835
|
+
constructor(from, to, duration, easing, params) {
|
|
5836
|
+
super(from, to, duration, easing, params);
|
|
5837
|
+
}
|
|
5838
|
+
getEndProps() {
|
|
5839
|
+
return {};
|
|
5840
|
+
}
|
|
5841
|
+
onStart() {
|
|
5842
|
+
if (!this.target) {
|
|
5843
|
+
return;
|
|
5844
|
+
}
|
|
5845
|
+
if (this.target.type === 'rect') {
|
|
5846
|
+
this.onStartRect();
|
|
5847
|
+
}
|
|
5848
|
+
else if (this.target.type === 'line') {
|
|
5849
|
+
this.onStartLineOrArea('line');
|
|
5850
|
+
}
|
|
5851
|
+
else if (this.target.type === 'area') {
|
|
5852
|
+
this.onStartLineOrArea('area');
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
onStartLineOrArea(type) {
|
|
5856
|
+
var _a;
|
|
5857
|
+
const root = this.target.attachShadow();
|
|
5858
|
+
const line = application.graphicService.creator[type](Object.assign({}, (_a = this.params) === null || _a === void 0 ? void 0 : _a.attribute));
|
|
5859
|
+
this[type] = line;
|
|
5860
|
+
line.pathProxy = new CustomPath2D();
|
|
5861
|
+
root.add(line);
|
|
5862
|
+
}
|
|
5863
|
+
onStartRect() {
|
|
5864
|
+
var _a, _b, _c;
|
|
5865
|
+
const root = this.target.attachShadow();
|
|
5866
|
+
const isHorizontal = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.isHorizontal) !== null && _b !== void 0 ? _b : true;
|
|
5867
|
+
const sizeAttr = isHorizontal ? 'height' : 'width';
|
|
5868
|
+
const otherSizeAttr = isHorizontal ? 'width' : 'height';
|
|
5869
|
+
const size = this.target.AABBBounds[sizeAttr]();
|
|
5870
|
+
const y = isHorizontal ? 0 : this.target.AABBBounds.y1;
|
|
5871
|
+
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 }));
|
|
5872
|
+
this.rect = rect;
|
|
5873
|
+
root.add(rect);
|
|
5874
|
+
}
|
|
5875
|
+
onBind() {
|
|
5876
|
+
return;
|
|
5877
|
+
}
|
|
5878
|
+
onEnd() {
|
|
5879
|
+
this.target.detachShadow();
|
|
5880
|
+
}
|
|
5881
|
+
onUpdate(end, ratio, out) {
|
|
5882
|
+
if (this.rect) {
|
|
5883
|
+
return this.onUpdateRect(end, ratio, out);
|
|
5884
|
+
}
|
|
5885
|
+
else if (this.line || this.area) {
|
|
5886
|
+
return this.onUpdateLineOrArea(end, ratio, out);
|
|
5887
|
+
}
|
|
5888
|
+
}
|
|
5889
|
+
onUpdateRect(end, ratio, out) {
|
|
5890
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
5891
|
+
const isHorizontal = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.isHorizontal) !== null && _b !== void 0 ? _b : true;
|
|
5892
|
+
const parentAttr = this.target.attribute;
|
|
5893
|
+
if (isHorizontal) {
|
|
5894
|
+
const parentWidth = (_d = (_c = parentAttr.width) !== null && _c !== void 0 ? _c : Math.abs(parentAttr.x1 - parentAttr.x)) !== null && _d !== void 0 ? _d : 250;
|
|
5895
|
+
const streamLength = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.streamLength) !== null && _f !== void 0 ? _f : parentWidth;
|
|
5896
|
+
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;
|
|
5897
|
+
const startX = -maxLength;
|
|
5898
|
+
const currentX = startX + (streamLength - startX) * ratio;
|
|
5899
|
+
const x = Math.max(currentX, 0);
|
|
5900
|
+
const w = Math.min(Math.min(currentX + maxLength, maxLength), streamLength - currentX);
|
|
5901
|
+
const width = w + x > parentWidth ? Math.max(parentWidth - x, 0) : w;
|
|
5902
|
+
this.rect.setAttributes({
|
|
5903
|
+
x,
|
|
5904
|
+
width,
|
|
5905
|
+
dx: Math.min(parentAttr.x1 - parentAttr.x, 0)
|
|
5906
|
+
}, false, {
|
|
5907
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
5908
|
+
animationState: {
|
|
5909
|
+
ratio,
|
|
5910
|
+
end
|
|
5911
|
+
}
|
|
5912
|
+
});
|
|
5913
|
+
}
|
|
5914
|
+
else {
|
|
5915
|
+
const parentHeight = (_l = (_k = parentAttr.height) !== null && _k !== void 0 ? _k : Math.abs(parentAttr.y1 - parentAttr.y)) !== null && _l !== void 0 ? _l : 250;
|
|
5916
|
+
const streamLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.streamLength) !== null && _o !== void 0 ? _o : parentHeight;
|
|
5917
|
+
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;
|
|
5918
|
+
const startY = parentHeight;
|
|
5919
|
+
const currentY = startY - (streamLength + maxLength) * ratio;
|
|
5920
|
+
let y = Math.min(currentY, parentHeight);
|
|
5921
|
+
const h = Math.min(parentHeight - currentY, maxLength);
|
|
5922
|
+
let height;
|
|
5923
|
+
if (y <= 0) {
|
|
5924
|
+
height = Math.max(y + h, 0);
|
|
5925
|
+
y = 0;
|
|
5737
5926
|
}
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5927
|
+
else {
|
|
5928
|
+
height = h;
|
|
5929
|
+
}
|
|
5930
|
+
this.rect.setAttributes({
|
|
5931
|
+
y,
|
|
5932
|
+
height,
|
|
5933
|
+
dy: Math.min(parentAttr.y1 - parentAttr.y, 0)
|
|
5934
|
+
}, false, {
|
|
5935
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
5936
|
+
animationState: {
|
|
5937
|
+
ratio,
|
|
5938
|
+
end
|
|
5939
|
+
}
|
|
5940
|
+
});
|
|
5941
|
+
}
|
|
5942
|
+
}
|
|
5943
|
+
onUpdateLineOrArea(end, ratio, out) {
|
|
5944
|
+
const target = this.line || this.area;
|
|
5945
|
+
if (!target) {
|
|
5946
|
+
return;
|
|
5947
|
+
}
|
|
5948
|
+
const customPath = target.pathProxy;
|
|
5949
|
+
const targetLine = this.target;
|
|
5950
|
+
if (targetLine.cache || targetLine.cacheArea) {
|
|
5951
|
+
this._onUpdateLineOrAreaWithCache(customPath, targetLine, end, ratio, out);
|
|
5952
|
+
}
|
|
5953
|
+
else {
|
|
5954
|
+
this._onUpdateLineWithoutCache(customPath, targetLine, end, ratio, out);
|
|
5955
|
+
}
|
|
5956
|
+
const targetAttrs = targetLine.attribute;
|
|
5957
|
+
target.setAttributes(Object.assign({ stroke: targetAttrs.stroke }, target.attribute));
|
|
5958
|
+
target.addUpdateBoundTag();
|
|
5959
|
+
}
|
|
5960
|
+
_onUpdateLineOrAreaWithCache(customPath, g, end, ratio, out) {
|
|
5961
|
+
var _a, _b;
|
|
5962
|
+
customPath.clear();
|
|
5963
|
+
if (g.type === 'line') {
|
|
5964
|
+
let cache = g.cache;
|
|
5965
|
+
if (!Array.isArray(cache)) {
|
|
5966
|
+
cache = [cache];
|
|
5967
|
+
}
|
|
5968
|
+
const totalLen = cache.reduce((l, c) => l + c.getLength(), 0);
|
|
5969
|
+
const curves = [];
|
|
5970
|
+
cache.forEach((c) => {
|
|
5971
|
+
c.curves.forEach((ci) => curves.push(ci));
|
|
5972
|
+
});
|
|
5973
|
+
return this._updateCurves(customPath, curves, totalLen, ratio);
|
|
5974
|
+
}
|
|
5975
|
+
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)) {
|
|
5976
|
+
const cache = g.cacheArea;
|
|
5977
|
+
const totalLen = cache.top.curves.reduce((a, b) => a + b.getLength(), 0);
|
|
5978
|
+
return this._updateCurves(customPath, cache.top.curves, totalLen, ratio);
|
|
5979
|
+
}
|
|
5980
|
+
}
|
|
5981
|
+
_updateCurves(customPath, curves, totalLen, ratio) {
|
|
5982
|
+
var _a, _b;
|
|
5983
|
+
const startLen = totalLen * ratio;
|
|
5984
|
+
const endLen = Math.min(startLen + ((_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.streamLength) !== null && _b !== void 0 ? _b : 10), totalLen);
|
|
5985
|
+
let lastLen = 0;
|
|
5986
|
+
let start = false;
|
|
5987
|
+
for (let i = 0; i < curves.length; i++) {
|
|
5988
|
+
if (curves[i].defined !== false) {
|
|
5989
|
+
const curveItem = curves[i];
|
|
5990
|
+
const len = curveItem.getLength();
|
|
5991
|
+
const startPercent = 1 - (lastLen + len - startLen) / len;
|
|
5992
|
+
let endPercent = 1 - (lastLen + len - endLen) / len;
|
|
5993
|
+
let curveForStart;
|
|
5994
|
+
if (lastLen < startLen && lastLen + len > startLen) {
|
|
5995
|
+
start = true;
|
|
5996
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
5997
|
+
const [_, curve2] = divideCubic(curveItem, startPercent);
|
|
5998
|
+
customPath.moveTo(curve2.p0.x, curve2.p0.y);
|
|
5999
|
+
curveForStart = curve2;
|
|
6000
|
+
}
|
|
6001
|
+
else {
|
|
6002
|
+
const p = curveItem.getPointAt(startPercent);
|
|
6003
|
+
customPath.moveTo(p.x, p.y);
|
|
6004
|
+
}
|
|
6005
|
+
}
|
|
6006
|
+
if (lastLen < endLen && lastLen + len > endLen) {
|
|
6007
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
6008
|
+
if (curveForStart) {
|
|
6009
|
+
endPercent = (endLen - startLen) / curveForStart.getLength();
|
|
6010
|
+
}
|
|
6011
|
+
const [curve1] = divideCubic(curveForStart || curveItem, endPercent);
|
|
6012
|
+
customPath.bezierCurveTo(curve1.p1.x, curve1.p1.y, curve1.p2.x, curve1.p2.y, curve1.p3.x, curve1.p3.y);
|
|
6013
|
+
}
|
|
6014
|
+
else {
|
|
6015
|
+
const p = curveItem.getPointAt(endPercent);
|
|
6016
|
+
customPath.lineTo(p.x, p.y);
|
|
6017
|
+
}
|
|
6018
|
+
break;
|
|
6019
|
+
}
|
|
6020
|
+
else if (start) {
|
|
6021
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
6022
|
+
const curve = curveForStart || curveItem;
|
|
6023
|
+
customPath.bezierCurveTo(curve.p1.x, curve.p1.y, curve.p2.x, curve.p2.y, curve.p3.x, curve.p3.y);
|
|
6024
|
+
}
|
|
6025
|
+
else {
|
|
6026
|
+
customPath.lineTo(curveItem.p1.x, curveItem.p1.y);
|
|
6027
|
+
}
|
|
6028
|
+
}
|
|
6029
|
+
lastLen += len;
|
|
6030
|
+
}
|
|
6031
|
+
}
|
|
6032
|
+
}
|
|
6033
|
+
_onUpdateLineWithoutCache(customPath, line, end, ratio, out) {
|
|
6034
|
+
var _a, _b;
|
|
6035
|
+
const { points, curveType } = line.attribute;
|
|
6036
|
+
if (!points || points.length < 2 || curveType !== 'linear') {
|
|
6037
|
+
return;
|
|
6038
|
+
}
|
|
6039
|
+
let totalLen = 0;
|
|
6040
|
+
for (let i = 1; i < points.length; i++) {
|
|
6041
|
+
totalLen += PointService.distancePP(points[i], points[i - 1]);
|
|
6042
|
+
}
|
|
6043
|
+
const startLen = totalLen * ratio;
|
|
6044
|
+
const endLen = Math.min(startLen + ((_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.streamLength) !== null && _b !== void 0 ? _b : 10), totalLen);
|
|
6045
|
+
const nextPoints = [];
|
|
6046
|
+
let lastLen = 0;
|
|
6047
|
+
for (let i = 1; i < points.length; i++) {
|
|
6048
|
+
const len = PointService.distancePP(points[i], points[i - 1]);
|
|
6049
|
+
if (lastLen < startLen && lastLen + len > startLen) {
|
|
6050
|
+
nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - startLen) / len));
|
|
6051
|
+
}
|
|
6052
|
+
if (lastLen < endLen && lastLen + len > endLen) {
|
|
6053
|
+
nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - endLen) / len));
|
|
6054
|
+
break;
|
|
6055
|
+
}
|
|
6056
|
+
else if (nextPoints.length) {
|
|
6057
|
+
nextPoints.push(points[i]);
|
|
6058
|
+
}
|
|
6059
|
+
lastLen += len;
|
|
6060
|
+
}
|
|
6061
|
+
if (!nextPoints.length || nextPoints.length < 2) {
|
|
6062
|
+
return;
|
|
6063
|
+
}
|
|
6064
|
+
customPath.clear();
|
|
6065
|
+
customPath.moveTo(nextPoints[0].x, nextPoints[0].y);
|
|
6066
|
+
for (let i = 1; i < nextPoints.length; i++) {
|
|
6067
|
+
customPath.lineTo(nextPoints[i].x, nextPoints[i].y);
|
|
6068
|
+
}
|
|
5743
6069
|
}
|
|
5744
6070
|
}
|
|
5745
6071
|
|
|
@@ -5793,6 +6119,8 @@ const registerCustomAnimate = () => {
|
|
|
5793
6119
|
AnimateExecutor.registerBuiltInAnimate('spinOut', SpinOut);
|
|
5794
6120
|
AnimateExecutor.registerBuiltInAnimate('moveScaleOut', MoveScaleOut);
|
|
5795
6121
|
AnimateExecutor.registerBuiltInAnimate('moveRotateOut', MoveRotateOut);
|
|
6122
|
+
AnimateExecutor.registerBuiltInAnimate('MotionPath', MotionPath);
|
|
6123
|
+
AnimateExecutor.registerBuiltInAnimate('streamLight', StreamLight);
|
|
5796
6124
|
};
|
|
5797
6125
|
|
|
5798
|
-
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 };
|
|
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 };
|