@visactor/vrender 1.0.0-alpha.4 → 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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +184 -30
- package/dist/index.js +186 -29
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -16873,7 +16873,7 @@
|
|
|
16873
16873
|
return this._ticker;
|
|
16874
16874
|
}
|
|
16875
16875
|
set ticker(ticker) {
|
|
16876
|
-
this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
16876
|
+
ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
16877
16877
|
}
|
|
16878
16878
|
constructor() {
|
|
16879
16879
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -16891,7 +16891,7 @@
|
|
|
16891
16891
|
}, this.afterRender = stage => {
|
|
16892
16892
|
this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
|
|
16893
16893
|
}, this.afterTickCb = () => {
|
|
16894
|
-
this.tickedBeforeRender = !0, "rendering" !== this.state && this.
|
|
16894
|
+
this.tickedBeforeRender = !0, "rendering" !== this.state && this.renderNextFrame();
|
|
16895
16895
|
}, this.params = params, this.theme = new Theme(), this.hooks = {
|
|
16896
16896
|
beforeRender: new SyncHook(["stage"]),
|
|
16897
16897
|
afterRender: new SyncHook(["stage"])
|
|
@@ -16914,7 +16914,7 @@
|
|
|
16914
16914
|
}
|
|
16915
16915
|
initAnimate(params) {
|
|
16916
16916
|
var _a;
|
|
16917
|
-
this.createTicker && this.createTimeline && (this._ticker = params.ticker || this.createTicker(this), "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) && this._ticker.setFPS(30), this.timeline = this.createTimeline(), this._ticker.addTimeline(this.timeline), this._ticker.on("tick", this.afterTickCb));
|
|
16917
|
+
this.createTicker && this.createTimeline && (this._ticker = params.ticker || this.createTicker(this), this._ticker.bindStage(this), "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) && this._ticker.setFPS(30), this.timeline = this.createTimeline(), this._ticker.addTimeline(this.timeline), this._ticker.on("tick", this.afterTickCb));
|
|
16918
16918
|
}
|
|
16919
16919
|
startAnimate() {
|
|
16920
16920
|
this._ticker && this.timeline && (this._ticker.start(), this.timeline.resume());
|
|
@@ -30250,19 +30250,29 @@
|
|
|
30250
30250
|
|
|
30251
30251
|
class DefaultTimeline {
|
|
30252
30252
|
get animateCount() {
|
|
30253
|
-
return this.
|
|
30253
|
+
return this._animateCount;
|
|
30254
30254
|
}
|
|
30255
30255
|
constructor() {
|
|
30256
|
-
this.
|
|
30256
|
+
this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
|
|
30257
30257
|
}
|
|
30258
30258
|
isRunning() {
|
|
30259
|
-
return !this.paused && this.
|
|
30259
|
+
return !this.paused && this._animateCount > 0;
|
|
30260
30260
|
}
|
|
30261
30261
|
forEachAccessAnimate(cb) {
|
|
30262
|
-
|
|
30262
|
+
let current = this.head,
|
|
30263
|
+
index = 0;
|
|
30264
|
+
for (; current;) {
|
|
30265
|
+
const next = current.next;
|
|
30266
|
+
cb(current.animate, index), index++, current = next;
|
|
30267
|
+
}
|
|
30263
30268
|
}
|
|
30264
30269
|
addAnimate(animate) {
|
|
30265
|
-
|
|
30270
|
+
const newNode = {
|
|
30271
|
+
animate: animate,
|
|
30272
|
+
next: null,
|
|
30273
|
+
prev: null
|
|
30274
|
+
};
|
|
30275
|
+
this.head ? this.tail && (this.tail.next = newNode, newNode.prev = this.tail, this.tail = newNode) : (this.head = newNode, this.tail = newNode), this.animateMap.set(animate, newNode), this._animateCount++, this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
30266
30276
|
}
|
|
30267
30277
|
pause() {
|
|
30268
30278
|
this.paused = !0;
|
|
@@ -30274,21 +30284,21 @@
|
|
|
30274
30284
|
if (this.paused) return;
|
|
30275
30285
|
const scaledDelta = delta * this._playSpeed;
|
|
30276
30286
|
this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
|
|
30277
|
-
animate.status === exports.AnimateStatus.END ? this.removeAnimate(animate, !0
|
|
30287
|
+
animate.status === exports.AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== exports.AnimateStatus.RUNNING && animate.status !== exports.AnimateStatus.INITIAL || animate.advance(scaledDelta);
|
|
30278
30288
|
});
|
|
30279
30289
|
}
|
|
30280
30290
|
clear() {
|
|
30281
30291
|
this.forEachAccessAnimate(animate => {
|
|
30282
30292
|
animate.release();
|
|
30283
|
-
}), this.
|
|
30293
|
+
}), this.head = null, this.tail = null, this.animateMap.clear(), this._animateCount = 0, this._totalDuration = 0;
|
|
30284
30294
|
}
|
|
30285
30295
|
removeAnimate(animate) {
|
|
30286
30296
|
let release = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
30287
|
-
|
|
30288
|
-
|
|
30297
|
+
const node = this.animateMap.get(animate);
|
|
30298
|
+
node && (release && (animate._onRemove && animate._onRemove.forEach(cb => cb()), animate.release()), node.prev ? node.prev.next = node.next : this.head = node.next, node.next ? node.next.prev = node.prev : this.tail = node.prev, this.animateMap.delete(animate), this._animateCount--, animate.getStartTime() + animate.getDuration() >= this._totalDuration && this.recalculateTotalDuration());
|
|
30289
30299
|
}
|
|
30290
30300
|
recalculateTotalDuration() {
|
|
30291
|
-
this._totalDuration = 0, this.
|
|
30301
|
+
this._totalDuration = 0, this.forEachAccessAnimate(animate => {
|
|
30292
30302
|
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
30293
30303
|
});
|
|
30294
30304
|
}
|
|
@@ -30537,10 +30547,7 @@
|
|
|
30537
30547
|
}
|
|
30538
30548
|
class DefaultTicker extends EventEmitter {
|
|
30539
30549
|
constructor(stage) {
|
|
30540
|
-
super(), this.timelines = [], this.frameTimeHistory = [], this.
|
|
30541
|
-
if ("performance" === this.stage.params.optimize.tickRenderMode) return !1;
|
|
30542
|
-
return delta < this.interval + 2 * (Math.random() - .5) * this._jitter;
|
|
30543
|
-
}, this.handleTick = (handler, params) => {
|
|
30550
|
+
super(), this.timelines = [], this.frameTimeHistory = [], this.handleTick = (handler, params) => {
|
|
30544
30551
|
const {
|
|
30545
30552
|
once = !1
|
|
30546
30553
|
} = null != params ? params : {};
|
|
@@ -30556,6 +30563,9 @@
|
|
|
30556
30563
|
}), this.emit("tick", delta));
|
|
30557
30564
|
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
|
|
30558
30565
|
}
|
|
30566
|
+
bindStage(stage) {
|
|
30567
|
+
this.stage = stage;
|
|
30568
|
+
}
|
|
30559
30569
|
computeTimeOffsetAndJitter() {
|
|
30560
30570
|
this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
|
|
30561
30571
|
}
|
|
@@ -30637,14 +30647,18 @@
|
|
|
30637
30647
|
var _a;
|
|
30638
30648
|
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
|
|
30639
30649
|
}
|
|
30650
|
+
checkSkip(delta) {
|
|
30651
|
+
if ("performance" === this.stage.params.optimize.tickRenderMode) return !1;
|
|
30652
|
+
return delta < this.interval + 2 * (Math.random() - .5) * this._jitter;
|
|
30653
|
+
}
|
|
30640
30654
|
}
|
|
30641
30655
|
|
|
30642
30656
|
class ManualTickHandler {
|
|
30643
30657
|
constructor() {
|
|
30644
|
-
this.released = !1, this.
|
|
30658
|
+
this.released = !1, this.currentTime = -1;
|
|
30645
30659
|
}
|
|
30646
30660
|
tick(interval, cb) {
|
|
30647
|
-
this.
|
|
30661
|
+
this.currentTime < 0 && (this.currentTime = 0), this.currentTime += interval, cb(this);
|
|
30648
30662
|
}
|
|
30649
30663
|
release() {
|
|
30650
30664
|
this.released = !0;
|
|
@@ -30653,7 +30667,7 @@
|
|
|
30653
30667
|
return this.currentTime;
|
|
30654
30668
|
}
|
|
30655
30669
|
tickTo(time, cb) {
|
|
30656
|
-
this.
|
|
30670
|
+
this.currentTime < 0 && (this.currentTime = 0);
|
|
30657
30671
|
const interval = time - this.currentTime;
|
|
30658
30672
|
this.tick(interval, cb);
|
|
30659
30673
|
}
|
|
@@ -30666,6 +30680,9 @@
|
|
|
30666
30680
|
const handler = new ManualTickHandler();
|
|
30667
30681
|
return this.tickerHandler && this.tickerHandler.release(), this.tickerHandler = handler, !0;
|
|
30668
30682
|
}
|
|
30683
|
+
checkSkip(delta) {
|
|
30684
|
+
return !1;
|
|
30685
|
+
}
|
|
30669
30686
|
getTime() {
|
|
30670
30687
|
return this.tickerHandler.getTime();
|
|
30671
30688
|
}
|
|
@@ -33025,7 +33042,7 @@
|
|
|
33025
33042
|
|
|
33026
33043
|
class InputRichText extends ACustomAnimate {
|
|
33027
33044
|
constructor(from, to, duration, easing, params) {
|
|
33028
|
-
super(from, to, duration, easing, params), this.fromTextConfig = [], this.toTextConfig = [], this.originalTextConfig = [], this.showCursor = !1, this.cursorChar = "|", this.blinkCursor = !0, this.
|
|
33045
|
+
super(from, to, duration, easing, params), this.fromTextConfig = [], this.toTextConfig = [], this.originalTextConfig = [], this.showCursor = !1, this.cursorChar = "|", this.blinkCursor = !0, this.fadeInChars = !1, this.fadeInDuration = .3, this.strokeFirst = !1, this.strokeToFillRatio = .3, void 0 !== (null == params ? void 0 : params.showCursor) && (this.showCursor = params.showCursor), void 0 !== (null == params ? void 0 : params.cursorChar) && (this.cursorChar = params.cursorChar), void 0 !== (null == params ? void 0 : params.blinkCursor) && (this.blinkCursor = params.blinkCursor), void 0 !== (null == params ? void 0 : params.fadeInChars) && (this.fadeInChars = params.fadeInChars), void 0 !== (null == params ? void 0 : params.fadeInDuration) && (this.fadeInDuration = params.fadeInDuration), void 0 !== (null == params ? void 0 : params.strokeFirst) && (this.strokeFirst = params.strokeFirst), void 0 !== (null == params ? void 0 : params.strokeToFillRatio) && (this.strokeToFillRatio = params.strokeToFillRatio);
|
|
33029
33046
|
}
|
|
33030
33047
|
onFirstRun() {
|
|
33031
33048
|
const fromProps = this.getLastProps(),
|
|
@@ -33046,12 +33063,22 @@
|
|
|
33046
33063
|
currentLength = Math.round(fromItems + (totalItems - fromItems) * adjustedRatio);
|
|
33047
33064
|
} else currentLength = Math.round(fromItems + (totalItems - fromItems) * ratio);
|
|
33048
33065
|
if (currentTextConfig = fromItems > totalItems ? this.fromTextConfig.slice(0, currentLength) : this.toTextConfig.slice(0, currentLength).map((item, index) => {
|
|
33049
|
-
if (
|
|
33050
|
-
const
|
|
33051
|
-
|
|
33052
|
-
|
|
33053
|
-
|
|
33054
|
-
|
|
33066
|
+
if ("text" in item) {
|
|
33067
|
+
const newItem = Object.assign({}, item);
|
|
33068
|
+
if (this.strokeFirst) {
|
|
33069
|
+
const appearTime = index / totalItems * maxTextShowRatio,
|
|
33070
|
+
itemLifetime = Math.max(0, ratio - appearTime),
|
|
33071
|
+
maxLifetime = 1 - appearTime,
|
|
33072
|
+
fillProgress = Math.min(1, itemLifetime / (this.strokeToFillRatio * maxLifetime));
|
|
33073
|
+
if ("fill" in newItem && newItem.fill && (newItem.stroke = newItem.fill, fillProgress < 1 && (newItem.fillOpacity = fillProgress)), this.fadeInChars) {
|
|
33074
|
+
const fadeProgress = Math.min(1, itemLifetime / (this.fadeInDuration * maxLifetime));
|
|
33075
|
+
newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
|
|
33076
|
+
}
|
|
33077
|
+
} else if (this.fadeInChars) {
|
|
33078
|
+
const fadeProgress = (ratio - index / totalItems * maxTextShowRatio) / this.fadeInDuration;
|
|
33079
|
+
newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
|
|
33080
|
+
}
|
|
33081
|
+
return newItem;
|
|
33055
33082
|
}
|
|
33056
33083
|
return item;
|
|
33057
33084
|
}), this.showCursor && currentLength < totalItems) {
|
|
@@ -33617,6 +33644,104 @@
|
|
|
33617
33644
|
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
33618
33645
|
}
|
|
33619
33646
|
}
|
|
33647
|
+
class StrokeIn extends ACustomAnimate {
|
|
33648
|
+
constructor(from, to, duration, easing, params) {
|
|
33649
|
+
super(from, to, duration, easing, params), this.perimeter = 0, this.originalAttributes = {};
|
|
33650
|
+
}
|
|
33651
|
+
onBind() {
|
|
33652
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
33653
|
+
if (super.onBind(), this.originalAttributes = Object.assign({}, this.target.getAttributes()), "rect" === this.target.type) {
|
|
33654
|
+
const attr = this.target.attribute,
|
|
33655
|
+
width = null !== (_a = attr.width) && void 0 !== _a ? _a : 100,
|
|
33656
|
+
height = null !== (_b = attr.height) && void 0 !== _b ? _b : 100;
|
|
33657
|
+
this.perimeter = 2 * (width + height);
|
|
33658
|
+
} else if ("circle" === this.target.type) {
|
|
33659
|
+
const radius = null !== (_c = this.target.attribute.radius) && void 0 !== _c ? _c : 50;
|
|
33660
|
+
this.perimeter = 2 * Math.PI * radius;
|
|
33661
|
+
} else if ("ellipse" === this.target.type) {
|
|
33662
|
+
const attr = this.target.attribute,
|
|
33663
|
+
radiusX = null !== (_d = attr.radiusX) && void 0 !== _d ? _d : 50,
|
|
33664
|
+
radiusY = null !== (_e = attr.radiusY) && void 0 !== _e ? _e : 50;
|
|
33665
|
+
this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
|
|
33666
|
+
} else this.perimeter = 1e3;
|
|
33667
|
+
const lineWidth = null !== (_g = null === (_f = this.params) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : 2,
|
|
33668
|
+
strokeColor = null !== (_j = null === (_h = this.params) || void 0 === _h ? void 0 : _h.strokeColor) && void 0 !== _j ? _j : "black",
|
|
33669
|
+
fromOpacity = null !== (_l = null === (_k = this.params) || void 0 === _k ? void 0 : _k.fromOpacity) && void 0 !== _l ? _l : 1,
|
|
33670
|
+
dashLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.dashLength) && void 0 !== _o ? _o : this.perimeter,
|
|
33671
|
+
showFill = null !== (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.showFill) && void 0 !== _q && _q,
|
|
33672
|
+
fillOpacity = null !== (_s = null === (_r = this.params) || void 0 === _r ? void 0 : _r.fillOpacity) && void 0 !== _s ? _s : 0;
|
|
33673
|
+
this.from = {
|
|
33674
|
+
lineDash: [dashLength, dashLength],
|
|
33675
|
+
lineDashOffset: dashLength,
|
|
33676
|
+
lineWidth: lineWidth,
|
|
33677
|
+
stroke: strokeColor,
|
|
33678
|
+
strokeOpacity: fromOpacity
|
|
33679
|
+
}, this.to = {
|
|
33680
|
+
lineDash: [dashLength, dashLength],
|
|
33681
|
+
lineDashOffset: 0,
|
|
33682
|
+
lineWidth: lineWidth,
|
|
33683
|
+
stroke: strokeColor,
|
|
33684
|
+
strokeOpacity: fromOpacity
|
|
33685
|
+
}, showFill ? (this.from.fillOpacity = fillOpacity, this.to.fillOpacity = null !== (_t = this.originalAttributes.fillOpacity) && void 0 !== _t ? _t : 1) : (this.from.fillOpacity = 0, this.to.fillOpacity = 0), this.propKeys = ["lineDash", "lineDashOffset", "lineWidth", "stroke", "strokeOpacity", "fillOpacity"], this.props = this.to, this.target.setAttributes(this.from);
|
|
33686
|
+
}
|
|
33687
|
+
onUpdate(end, ratio, out) {
|
|
33688
|
+
var _a;
|
|
33689
|
+
const attribute = this.target.attribute;
|
|
33690
|
+
attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio, (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio);
|
|
33691
|
+
}
|
|
33692
|
+
onEnd() {
|
|
33693
|
+
var _a;
|
|
33694
|
+
if (super.onEnd(), !(null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill)) {
|
|
33695
|
+
const originalAttrs = Object.assign({}, this.originalAttributes);
|
|
33696
|
+
originalAttrs.fillOpacity = 0, this.target.setAttributes(originalAttrs);
|
|
33697
|
+
}
|
|
33698
|
+
}
|
|
33699
|
+
}
|
|
33700
|
+
class StrokeOut extends ACustomAnimate {
|
|
33701
|
+
constructor(from, to, duration, easing, params) {
|
|
33702
|
+
super(from, to, duration, easing, params), this.perimeter = 0, this.originalAttributes = {};
|
|
33703
|
+
}
|
|
33704
|
+
onFirstRun() {
|
|
33705
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
33706
|
+
if (this.originalAttributes = Object.assign({}, this.target.getAttributes()), "rect" === this.target.type) {
|
|
33707
|
+
const attr = this.target.attribute,
|
|
33708
|
+
width = null !== (_a = attr.width) && void 0 !== _a ? _a : 100,
|
|
33709
|
+
height = null !== (_b = attr.height) && void 0 !== _b ? _b : 100;
|
|
33710
|
+
this.perimeter = 2 * (width + height);
|
|
33711
|
+
} else if ("circle" === this.target.type) {
|
|
33712
|
+
const radius = null !== (_c = this.target.attribute.radius) && void 0 !== _c ? _c : 50;
|
|
33713
|
+
this.perimeter = 2 * Math.PI * radius;
|
|
33714
|
+
} else if ("ellipse" === this.target.type) {
|
|
33715
|
+
const attr = this.target.attribute,
|
|
33716
|
+
radiusX = null !== (_d = attr.radiusX) && void 0 !== _d ? _d : 50,
|
|
33717
|
+
radiusY = null !== (_e = attr.radiusY) && void 0 !== _e ? _e : 50;
|
|
33718
|
+
this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
|
|
33719
|
+
} else this.perimeter = 1e3;
|
|
33720
|
+
const lineWidth = null !== (_g = null === (_f = this.params) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : 2,
|
|
33721
|
+
strokeColor = null !== (_j = null === (_h = this.params) || void 0 === _h ? void 0 : _h.strokeColor) && void 0 !== _j ? _j : "black",
|
|
33722
|
+
fromOpacity = null !== (_l = null === (_k = this.params) || void 0 === _k ? void 0 : _k.fromOpacity) && void 0 !== _l ? _l : 1,
|
|
33723
|
+
dashLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.dashLength) && void 0 !== _o ? _o : this.perimeter,
|
|
33724
|
+
showFill = null !== (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.showFill) && void 0 !== _q && _q;
|
|
33725
|
+
this.from = {
|
|
33726
|
+
lineDash: [dashLength, dashLength],
|
|
33727
|
+
lineDashOffset: 0,
|
|
33728
|
+
lineWidth: lineWidth,
|
|
33729
|
+
stroke: strokeColor,
|
|
33730
|
+
strokeOpacity: fromOpacity
|
|
33731
|
+
}, this.to = {
|
|
33732
|
+
lineDash: [dashLength, dashLength],
|
|
33733
|
+
lineDashOffset: -dashLength,
|
|
33734
|
+
lineWidth: lineWidth,
|
|
33735
|
+
stroke: strokeColor,
|
|
33736
|
+
strokeOpacity: fromOpacity
|
|
33737
|
+
}, showFill ? (this.from.fillOpacity = null !== (_r = this.originalAttributes.fillOpacity) && void 0 !== _r ? _r : 1, this.to.fillOpacity = 0) : (this.from.fillOpacity = 0, this.to.fillOpacity = 0), this.propKeys = ["lineDash", "lineDashOffset", "lineWidth", "stroke", "strokeOpacity", "fillOpacity"], this.props = this.to, this.target.setAttributes(this.from);
|
|
33738
|
+
}
|
|
33739
|
+
onUpdate(end, ratio, out) {
|
|
33740
|
+
var _a;
|
|
33741
|
+
const attribute = this.target.attribute;
|
|
33742
|
+
attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio, (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio);
|
|
33743
|
+
}
|
|
33744
|
+
}
|
|
33620
33745
|
class MoveScaleIn extends ACustomAnimate {
|
|
33621
33746
|
constructor(from, to, duration, easing, params) {
|
|
33622
33747
|
var _a;
|
|
@@ -33851,6 +33976,35 @@
|
|
|
33851
33976
|
}
|
|
33852
33977
|
onUpdate(end, ratio, out) {}
|
|
33853
33978
|
}
|
|
33979
|
+
class PulseAnimate extends ACustomAnimate {
|
|
33980
|
+
constructor(from, to, duration, easing, params) {
|
|
33981
|
+
super(from, to, duration, easing, params), this.originalAttributes = {}, this.pulseCount = 3, this.pulseOpacity = .3, this.pulseScale = 1.05, this.pulseColor = null, this.pulseColorIntensity = .2, this.strokeOnly = !1, this.fillOnly = !1, this.useScale = !0, this.useOpacity = !0, this.useStroke = !0, this.useFill = !0, this.useColor = !1, this.originalFill = null, this.originalStroke = null, void 0 !== (null == params ? void 0 : params.pulseCount) && (this.pulseCount = params.pulseCount), void 0 !== (null == params ? void 0 : params.pulseScale) && (this.pulseScale = params.pulseScale), void 0 !== (null == params ? void 0 : params.pulseColor) && (this.pulseColor = params.pulseColor), void 0 !== (null == params ? void 0 : params.pulseColorIntensity) && (this.pulseColorIntensity = params.pulseColorIntensity), void 0 !== (null == params ? void 0 : params.strokeOnly) && (this.strokeOnly = params.strokeOnly), void 0 !== (null == params ? void 0 : params.fillOnly) && (this.fillOnly = params.fillOnly), void 0 !== (null == params ? void 0 : params.useScale) && (this.useScale = params.useScale), void 0 !== (null == params ? void 0 : params.useOpacity) && (this.useOpacity = params.useOpacity), void 0 !== (null == params ? void 0 : params.useStroke) && (this.useStroke = params.useStroke), void 0 !== (null == params ? void 0 : params.useFill) && (this.useFill = params.useFill), void 0 !== (null == params ? void 0 : params.useColor) && (this.useColor = params.useColor);
|
|
33982
|
+
}
|
|
33983
|
+
onBind() {
|
|
33984
|
+
super.onBind(), this.originalAttributes = Object.assign({}, this.target.getAttributes()), this.useColor && (this.originalFill = this.originalAttributes.fill || null, this.originalStroke = this.originalAttributes.stroke || null, this.pulseColor || (this.fillOnly && this.originalFill ? this.pulseColor = this.originalFill : this.strokeOnly && this.originalStroke ? this.pulseColor = this.originalStroke : this.originalFill ? this.pulseColor = this.originalFill : this.originalStroke ? this.pulseColor = this.originalStroke : this.pulseColor = "#FFFFFF"));
|
|
33985
|
+
}
|
|
33986
|
+
onUpdate(end, ratio, out) {
|
|
33987
|
+
const angle = ratio * Math.PI * this.pulseCount,
|
|
33988
|
+
pulseValue = Math.abs(Math.sin(angle)),
|
|
33989
|
+
attribute = this.target.attribute;
|
|
33990
|
+
if (this.useOpacity) {
|
|
33991
|
+
const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
|
|
33992
|
+
this.useStroke && (attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
|
|
33993
|
+
}
|
|
33994
|
+
if (this.useScale) {
|
|
33995
|
+
const scale = 1 + (this.pulseScale - 1) * pulseValue;
|
|
33996
|
+
attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale, attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
|
|
33997
|
+
}
|
|
33998
|
+
this.useColor && this.pulseColor && this.applyColorPulse(attribute, pulseValue), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
|
|
33999
|
+
}
|
|
34000
|
+
applyColorPulse(attribute, pulseValue) {
|
|
34001
|
+
const colorRatio = this.pulseColorIntensity * pulseValue;
|
|
34002
|
+
this.useFill && this.originalFill && this.pulseColor && (attribute.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, !0)), this.useStroke && this.originalStroke && this.pulseColor && (attribute.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, !0));
|
|
34003
|
+
}
|
|
34004
|
+
onEnd() {
|
|
34005
|
+
super.onEnd(), this.target.setAttributes(this.originalAttributes);
|
|
34006
|
+
}
|
|
34007
|
+
}
|
|
33854
34008
|
|
|
33855
34009
|
class Update extends ACustomAnimate {
|
|
33856
34010
|
constructor(from, to, duration, easing, params) {
|
|
@@ -34313,10 +34467,10 @@
|
|
|
34313
34467
|
}
|
|
34314
34468
|
|
|
34315
34469
|
const registerCustomAnimate = () => {
|
|
34316
|
-
AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
|
|
34470
|
+
AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
|
|
34317
34471
|
};
|
|
34318
34472
|
|
|
34319
|
-
const version = "1.0.0-alpha.
|
|
34473
|
+
const version = "1.0.0-alpha.5";
|
|
34320
34474
|
preLoadAllModule();
|
|
34321
34475
|
if (isBrowserEnv()) {
|
|
34322
34476
|
loadBrowserEnv(container);
|
|
@@ -34604,6 +34758,7 @@
|
|
|
34604
34758
|
exports.PolygonRenderContribution = PolygonRenderContribution;
|
|
34605
34759
|
exports.PoptipAppear = PoptipAppear;
|
|
34606
34760
|
exports.PoptipDisappear = PoptipDisappear;
|
|
34761
|
+
exports.PulseAnimate = PulseAnimate;
|
|
34607
34762
|
exports.Pyramid3d = Pyramid3d;
|
|
34608
34763
|
exports.Pyramid3dRender = Pyramid3dRender;
|
|
34609
34764
|
exports.REACT_TO_CANOPUS_EVENTS = REACT_TO_CANOPUS_EVENTS;
|
|
@@ -34649,6 +34804,8 @@
|
|
|
34649
34804
|
exports.StaticLayerHandlerContribution = StaticLayerHandlerContribution;
|
|
34650
34805
|
exports.Step = Step$1;
|
|
34651
34806
|
exports.StreamLight = StreamLight;
|
|
34807
|
+
exports.StrokeIn = StrokeIn;
|
|
34808
|
+
exports.StrokeOut = StrokeOut;
|
|
34652
34809
|
exports.Symbol = Symbol$1;
|
|
34653
34810
|
exports.SymbolRender = SymbolRender;
|
|
34654
34811
|
exports.SymbolRenderContribution = SymbolRenderContribution;
|