@leafer-game/worker 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +178 -52
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +179 -53
- package/dist/worker.module.min.js +1 -1
- package/package.json +10 -10
package/dist/worker.js
CHANGED
|
@@ -6010,7 +6010,7 @@ var LeaferUI = (function (exports) {
|
|
|
6010
6010
|
}
|
|
6011
6011
|
}
|
|
6012
6012
|
|
|
6013
|
-
const version = "1.3.
|
|
6013
|
+
const version = "1.3.2";
|
|
6014
6014
|
|
|
6015
6015
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6016
6016
|
get allowBackgroundColor() { return true; }
|
|
@@ -6542,7 +6542,7 @@ var LeaferUI = (function (exports) {
|
|
|
6542
6542
|
partRender() {
|
|
6543
6543
|
const { canvas, updateBlocks: list } = this;
|
|
6544
6544
|
if (!list)
|
|
6545
|
-
return
|
|
6545
|
+
return;
|
|
6546
6546
|
this.mergeBlocks();
|
|
6547
6547
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6548
6548
|
this.clipRender(block); });
|
|
@@ -7398,7 +7398,7 @@ var LeaferUI = (function (exports) {
|
|
|
7398
7398
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7399
7399
|
return Plugin.need('animate');
|
|
7400
7400
|
}
|
|
7401
|
-
killAnimate(_type,
|
|
7401
|
+
killAnimate(_type, _nextStyle) { }
|
|
7402
7402
|
export(_filename, _options) {
|
|
7403
7403
|
return Plugin.need('export');
|
|
7404
7404
|
}
|
|
@@ -7894,8 +7894,6 @@ var LeaferUI = (function (exports) {
|
|
|
7894
7894
|
this.created = true;
|
|
7895
7895
|
}
|
|
7896
7896
|
__onReady() {
|
|
7897
|
-
if (this.ready)
|
|
7898
|
-
return;
|
|
7899
7897
|
this.ready = true;
|
|
7900
7898
|
this.emitLeafer(LeaferEvent.BEFORE_READY);
|
|
7901
7899
|
this.emitLeafer(LeaferEvent.READY);
|
|
@@ -7909,6 +7907,20 @@ var LeaferUI = (function (exports) {
|
|
|
7909
7907
|
this.emitLeafer(LeaferEvent.VIEW_READY);
|
|
7910
7908
|
WaitHelper.run(this.__viewReadyWait);
|
|
7911
7909
|
}
|
|
7910
|
+
__onLayoutEnd() {
|
|
7911
|
+
const { grow, growWidth, growHeight } = this.config;
|
|
7912
|
+
if (grow) {
|
|
7913
|
+
let { width, height, pixelRatio } = this;
|
|
7914
|
+
const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
|
|
7915
|
+
if (growWidth !== false)
|
|
7916
|
+
width = Math.max(1, bounds.x + bounds.width);
|
|
7917
|
+
if (growHeight !== false)
|
|
7918
|
+
height = Math.max(1, bounds.y + bounds.height);
|
|
7919
|
+
this.__doResize({ width, height, pixelRatio });
|
|
7920
|
+
}
|
|
7921
|
+
if (!this.ready)
|
|
7922
|
+
this.__onReady();
|
|
7923
|
+
}
|
|
7912
7924
|
__onNextRender() {
|
|
7913
7925
|
if (this.viewReady) {
|
|
7914
7926
|
WaitHelper.run(this.__nextRenderWait);
|
|
@@ -8002,10 +8014,9 @@ var LeaferUI = (function (exports) {
|
|
|
8002
8014
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8003
8015
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
8004
8016
|
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
8005
|
-
this.once(LayoutEvent.END, () => this.__onReady());
|
|
8006
8017
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
8007
8018
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
8008
|
-
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8019
|
+
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8009
8020
|
}
|
|
8010
8021
|
__removeListenEvents() {
|
|
8011
8022
|
this.off_(this.__eventIds);
|
|
@@ -11252,7 +11263,7 @@ var LeaferUI = (function (exports) {
|
|
|
11252
11263
|
rows.forEach(row => {
|
|
11253
11264
|
if (row.words) {
|
|
11254
11265
|
indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
|
|
11255
|
-
addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
11266
|
+
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
11256
11267
|
mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
|
|
11257
11268
|
if (row.isOverflow && !letterSpacing)
|
|
11258
11269
|
row.textMode = true;
|
|
@@ -11274,7 +11285,7 @@ var LeaferUI = (function (exports) {
|
|
|
11274
11285
|
else {
|
|
11275
11286
|
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11276
11287
|
}
|
|
11277
|
-
if (!row.paraEnd
|
|
11288
|
+
if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
|
|
11278
11289
|
charX += addWordWidth;
|
|
11279
11290
|
row.width += addWordWidth;
|
|
11280
11291
|
}
|
|
@@ -11749,7 +11760,9 @@ var LeaferUI = (function (exports) {
|
|
|
11749
11760
|
type = null;
|
|
11750
11761
|
let transition = type ? getTransition(type, style, leaf) : false;
|
|
11751
11762
|
const fromStyle = transition ? getFromStyle(leaf, style) : undefined;
|
|
11752
|
-
|
|
11763
|
+
const nextStyle = State.canAnimate && getStyle(leaf);
|
|
11764
|
+
if (nextStyle)
|
|
11765
|
+
leaf.killAnimate('transition');
|
|
11753
11766
|
if (normalStyle)
|
|
11754
11767
|
leaf.set(normalStyle, 'temp');
|
|
11755
11768
|
const statesStyle = getStyle(leaf);
|
|
@@ -12122,8 +12135,11 @@ var LeaferUI = (function (exports) {
|
|
|
12122
12135
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
12123
12136
|
set(value) {
|
|
12124
12137
|
this.__setAttr(key, value);
|
|
12125
|
-
if (this.leafer)
|
|
12126
|
-
|
|
12138
|
+
if (this.leafer) {
|
|
12139
|
+
this.killAnimate('animation');
|
|
12140
|
+
if (value)
|
|
12141
|
+
this.animate(value, undefined, 'animation');
|
|
12142
|
+
}
|
|
12127
12143
|
}
|
|
12128
12144
|
}));
|
|
12129
12145
|
}
|
|
@@ -12160,6 +12176,7 @@ var LeaferUI = (function (exports) {
|
|
|
12160
12176
|
get completed() { return this.time >= this.duration && !this.started; }
|
|
12161
12177
|
get frame() { return this.frames[this.nowIndex]; }
|
|
12162
12178
|
get frameTotalTime() { return this.frame.totalTime || this.frame.duration || 0; }
|
|
12179
|
+
get nowReverse() { return (this.mainReverse ? 1 : 0) + (this.frameReverse ? 1 : 0) === 1; }
|
|
12163
12180
|
get realEnding() {
|
|
12164
12181
|
let count;
|
|
12165
12182
|
const { ending, reverse, loop } = this;
|
|
@@ -12176,6 +12193,12 @@ var LeaferUI = (function (exports) {
|
|
|
12176
12193
|
}
|
|
12177
12194
|
constructor(target, keyframe, options, isTemp) {
|
|
12178
12195
|
super();
|
|
12196
|
+
if (keyframe) {
|
|
12197
|
+
if (keyframe.keyframes)
|
|
12198
|
+
options = keyframe, keyframe = keyframe.keyframes;
|
|
12199
|
+
else if (keyframe.style)
|
|
12200
|
+
options = keyframe, keyframe = keyframe.style;
|
|
12201
|
+
}
|
|
12179
12202
|
this.init(target, keyframe, options, isTemp);
|
|
12180
12203
|
}
|
|
12181
12204
|
init(target, keyframe, options, isTemp) {
|
|
@@ -12191,16 +12214,14 @@ var LeaferUI = (function (exports) {
|
|
|
12191
12214
|
break;
|
|
12192
12215
|
case 'object': this.config = options, options.event && (this.event = options.event);
|
|
12193
12216
|
}
|
|
12194
|
-
|
|
12195
|
-
return;
|
|
12196
|
-
this.keyframes = keyframe instanceof Array ? keyframe : [keyframe];
|
|
12217
|
+
this.keyframes = keyframe instanceof Array ? keyframe : (keyframe ? [keyframe] : []);
|
|
12197
12218
|
const { easing, attrs } = this;
|
|
12198
12219
|
this.easingFn = AnimateEasing.get(easing);
|
|
12199
12220
|
if (attrs || this.attrsMap)
|
|
12200
12221
|
this.attrsMap = attrs ? attrs.reduce((map, value) => { map[value] = true; return map; }, {}) : undefined;
|
|
12201
12222
|
this.frames = [];
|
|
12202
12223
|
this.create();
|
|
12203
|
-
if (this.autoplay)
|
|
12224
|
+
if (this.autoplay && this.frames.length)
|
|
12204
12225
|
this.timer = setTimeout(() => {
|
|
12205
12226
|
this.timer = 0;
|
|
12206
12227
|
this.play();
|
|
@@ -12249,7 +12270,7 @@ var LeaferUI = (function (exports) {
|
|
|
12249
12270
|
}
|
|
12250
12271
|
create() {
|
|
12251
12272
|
const { target, frames, keyframes, config } = this, { length } = keyframes, joinBefore = length > 1 ? this.join : true;
|
|
12252
|
-
let
|
|
12273
|
+
let totalTime = 0, totalAutoTime = 0, before, keyframe, item, style, times;
|
|
12253
12274
|
if (length > 1)
|
|
12254
12275
|
this.fromStyle = {}, this.toStyle = {};
|
|
12255
12276
|
for (let i = 0; i < length; i++) {
|
|
@@ -12258,27 +12279,32 @@ var LeaferUI = (function (exports) {
|
|
|
12258
12279
|
if (!before)
|
|
12259
12280
|
before = joinBefore ? target : style;
|
|
12260
12281
|
item = { style, beforeStyle: {} };
|
|
12282
|
+
times = 1;
|
|
12261
12283
|
if (keyframe.style) {
|
|
12262
|
-
const { duration, autoDuration, delay, autoDelay, easing } = keyframe;
|
|
12284
|
+
const { duration, autoDuration, delay, autoDelay, easing, swing, loop } = keyframe;
|
|
12285
|
+
if (swing)
|
|
12286
|
+
item.swing = typeof swing === 'number' ? swing : 2, times = item.swing * 2 - 1;
|
|
12287
|
+
if (loop)
|
|
12288
|
+
item.loop = times = typeof loop === 'number' ? loop : 2;
|
|
12263
12289
|
if (duration) {
|
|
12264
|
-
item.duration = duration,
|
|
12290
|
+
item.duration = duration, totalTime += duration * times;
|
|
12265
12291
|
if (delay)
|
|
12266
12292
|
item.totalTime = duration + delay;
|
|
12267
12293
|
}
|
|
12268
12294
|
else {
|
|
12269
12295
|
if (autoDuration)
|
|
12270
|
-
item.autoDuration = autoDuration,
|
|
12296
|
+
item.autoDuration = autoDuration, totalAutoTime += autoDuration * times;
|
|
12271
12297
|
}
|
|
12272
12298
|
if (delay)
|
|
12273
|
-
item.delay = delay,
|
|
12299
|
+
item.delay = delay, totalTime += delay * times;
|
|
12274
12300
|
else if (autoDelay)
|
|
12275
|
-
item.autoDelay = autoDelay,
|
|
12301
|
+
item.autoDelay = autoDelay, totalAutoTime += autoDelay * times;
|
|
12276
12302
|
if (easing)
|
|
12277
12303
|
item.easingFn = AnimateEasing.get(easing);
|
|
12278
12304
|
}
|
|
12279
12305
|
if (!item.autoDuration && item.duration === undefined) {
|
|
12280
12306
|
if (length > 1)
|
|
12281
|
-
(i > 0 || joinBefore) ?
|
|
12307
|
+
(i > 0 || joinBefore) ? totalAutoTime += times : item.duration = 0;
|
|
12282
12308
|
else
|
|
12283
12309
|
item.duration = this.duration;
|
|
12284
12310
|
}
|
|
@@ -12294,14 +12320,14 @@ var LeaferUI = (function (exports) {
|
|
|
12294
12320
|
before = style;
|
|
12295
12321
|
frames.push(item);
|
|
12296
12322
|
}
|
|
12297
|
-
if (
|
|
12298
|
-
if (this.duration <=
|
|
12299
|
-
this.changeDuration(
|
|
12300
|
-
this.allocateTime((this.duration -
|
|
12323
|
+
if (totalAutoTime) {
|
|
12324
|
+
if (this.duration <= totalTime || !(config && config.duration))
|
|
12325
|
+
this.changeDuration(totalTime + frameDuration * totalAutoTime);
|
|
12326
|
+
this.allocateTime((this.duration - totalTime) / totalAutoTime);
|
|
12301
12327
|
}
|
|
12302
12328
|
else {
|
|
12303
|
-
if (
|
|
12304
|
-
this.changeDuration(
|
|
12329
|
+
if (totalTime)
|
|
12330
|
+
this.changeDuration(totalTime);
|
|
12305
12331
|
}
|
|
12306
12332
|
this.emit(AnimateEvent.CREATED, this);
|
|
12307
12333
|
}
|
|
@@ -12328,7 +12354,7 @@ var LeaferUI = (function (exports) {
|
|
|
12328
12354
|
if (frame.autoDelay)
|
|
12329
12355
|
frame.delay = frame.autoDelay * partTime;
|
|
12330
12356
|
if (frame.delay)
|
|
12331
|
-
frame.totalTime = frame.duration
|
|
12357
|
+
frame.totalTime = frame.duration + frame.delay;
|
|
12332
12358
|
}
|
|
12333
12359
|
}
|
|
12334
12360
|
}
|
|
@@ -12346,7 +12372,7 @@ var LeaferUI = (function (exports) {
|
|
|
12346
12372
|
if (realTime < duration) {
|
|
12347
12373
|
while (realTime - this.playedTotalTime > this.frameTotalTime) {
|
|
12348
12374
|
this.transition(1);
|
|
12349
|
-
this.
|
|
12375
|
+
this.mainReverse ? this.reverseNextFrame() : this.nextFrame();
|
|
12350
12376
|
}
|
|
12351
12377
|
const itemDelay = this.nowReverse ? 0 : (this.frame.delay || 0);
|
|
12352
12378
|
const itemPlayedTime = realTime - this.playedTotalTime - itemDelay;
|
|
@@ -12370,9 +12396,9 @@ var LeaferUI = (function (exports) {
|
|
|
12370
12396
|
const { loop, loopDelay, swing } = this;
|
|
12371
12397
|
if (loop !== false || swing) {
|
|
12372
12398
|
this.looped ? this.looped++ : this.looped = 1;
|
|
12373
|
-
if (
|
|
12399
|
+
if (this.needLoop(this.looped, loop, swing)) {
|
|
12374
12400
|
if (swing)
|
|
12375
|
-
this.
|
|
12401
|
+
this.mainReverse = !this.mainReverse;
|
|
12376
12402
|
if (loopDelay)
|
|
12377
12403
|
this.timer = setTimeout(() => { this.timer = 0, this.begin(); }, loopDelay / this.speed * 1000);
|
|
12378
12404
|
else
|
|
@@ -12387,8 +12413,8 @@ var LeaferUI = (function (exports) {
|
|
|
12387
12413
|
start(seek) {
|
|
12388
12414
|
this.requestAnimateTime = 1;
|
|
12389
12415
|
const { reverse } = this;
|
|
12390
|
-
if (reverse || this.
|
|
12391
|
-
this.
|
|
12416
|
+
if (reverse || this.mainReverse)
|
|
12417
|
+
this.mainReverse = reverse;
|
|
12392
12418
|
if (this.looped)
|
|
12393
12419
|
this.looped = 0;
|
|
12394
12420
|
if (seek)
|
|
@@ -12406,12 +12432,12 @@ var LeaferUI = (function (exports) {
|
|
|
12406
12432
|
}
|
|
12407
12433
|
begin(seek) {
|
|
12408
12434
|
this.playedTotalTime = this.time = 0;
|
|
12409
|
-
this.
|
|
12435
|
+
this.mainReverse ? this.setTo() : this.setFrom();
|
|
12410
12436
|
if (!seek)
|
|
12411
12437
|
this.requestAnimate();
|
|
12412
12438
|
}
|
|
12413
12439
|
end() {
|
|
12414
|
-
this.
|
|
12440
|
+
this.mainReverse ? this.setFrom() : this.setTo();
|
|
12415
12441
|
}
|
|
12416
12442
|
complete() {
|
|
12417
12443
|
this.requestAnimateTime = 0;
|
|
@@ -12434,15 +12460,19 @@ var LeaferUI = (function (exports) {
|
|
|
12434
12460
|
this.setStyle(this.toStyle);
|
|
12435
12461
|
}
|
|
12436
12462
|
nextFrame() {
|
|
12463
|
+
if (this.needLoopFrame())
|
|
12464
|
+
return this.increaseTime();
|
|
12437
12465
|
if (this.nowIndex + 1 >= this.frames.length)
|
|
12438
12466
|
return;
|
|
12439
|
-
this.
|
|
12467
|
+
this.increaseTime();
|
|
12440
12468
|
this.nowIndex++;
|
|
12441
12469
|
}
|
|
12442
12470
|
reverseNextFrame() {
|
|
12471
|
+
if (this.needLoopFrame())
|
|
12472
|
+
return this.increaseTime();
|
|
12443
12473
|
if (this.nowIndex - 1 < 0)
|
|
12444
12474
|
return;
|
|
12445
|
-
this.
|
|
12475
|
+
this.increaseTime();
|
|
12446
12476
|
this.nowIndex--;
|
|
12447
12477
|
}
|
|
12448
12478
|
transition(t) {
|
|
@@ -12478,6 +12508,27 @@ var LeaferUI = (function (exports) {
|
|
|
12478
12508
|
target.__ ? target.set(style, this.isTemp ? 'temp' : false) : Object.assign(target, style);
|
|
12479
12509
|
}
|
|
12480
12510
|
}
|
|
12511
|
+
increaseTime() {
|
|
12512
|
+
this.playedTotalTime += this.frameTotalTime;
|
|
12513
|
+
}
|
|
12514
|
+
needLoop(looped, loop, swing) {
|
|
12515
|
+
return !(this.needStopLoop(looped, loop) || this.needStopLoop(looped, swing, true));
|
|
12516
|
+
}
|
|
12517
|
+
needStopLoop(looped, times, swing) {
|
|
12518
|
+
return typeof times === 'number' && (!times || looped >= (swing ? times * 2 - 1 : times));
|
|
12519
|
+
}
|
|
12520
|
+
needLoopFrame() {
|
|
12521
|
+
const { loop, swing } = this.frame;
|
|
12522
|
+
if (loop || swing) {
|
|
12523
|
+
this.frameLooped ? this.frameLooped++ : this.frameLooped = 1;
|
|
12524
|
+
if (swing)
|
|
12525
|
+
this.frameReverse = !this.frameReverse;
|
|
12526
|
+
if (this.needLoop(this.frameLooped, loop, swing))
|
|
12527
|
+
return true;
|
|
12528
|
+
this.frameLooped = this.frameReverse = undefined;
|
|
12529
|
+
}
|
|
12530
|
+
return false;
|
|
12531
|
+
}
|
|
12481
12532
|
clearTimer(fn) {
|
|
12482
12533
|
if (this.timer) {
|
|
12483
12534
|
clearTimeout(this.timer), this.timer = 0;
|
|
@@ -12537,6 +12588,64 @@ var LeaferUI = (function (exports) {
|
|
|
12537
12588
|
useModule(LeafEventer)
|
|
12538
12589
|
], exports.Animate);
|
|
12539
12590
|
|
|
12591
|
+
exports.AnimateList = class AnimateList extends exports.Animate {
|
|
12592
|
+
get completed() { return this.list.every(item => item.completed); }
|
|
12593
|
+
get endingStyle() { return this._endingStyle; }
|
|
12594
|
+
constructor(target, animation, isTemp) {
|
|
12595
|
+
super(target, null);
|
|
12596
|
+
this.list = [];
|
|
12597
|
+
this.updateList(animation, isTemp);
|
|
12598
|
+
}
|
|
12599
|
+
updateList(animation, isTemp) {
|
|
12600
|
+
this.fromStyle = {};
|
|
12601
|
+
this.toStyle = {};
|
|
12602
|
+
this._endingStyle = {};
|
|
12603
|
+
if (!animation)
|
|
12604
|
+
animation = this.list.filter(item => {
|
|
12605
|
+
const { completed } = item;
|
|
12606
|
+
if (completed)
|
|
12607
|
+
item.destroy();
|
|
12608
|
+
return !completed;
|
|
12609
|
+
});
|
|
12610
|
+
this.list = animation.map(item => {
|
|
12611
|
+
const animate = item.target ? item : new exports.Animate(this.target, item, isTemp);
|
|
12612
|
+
Object.assign(this.fromStyle, animate.fromStyle);
|
|
12613
|
+
Object.assign(this.toStyle, animate.toStyle);
|
|
12614
|
+
Object.assign(this._endingStyle, animate.endingStyle);
|
|
12615
|
+
return animate;
|
|
12616
|
+
});
|
|
12617
|
+
}
|
|
12618
|
+
play() {
|
|
12619
|
+
this.each(item => item.play());
|
|
12620
|
+
}
|
|
12621
|
+
pause() {
|
|
12622
|
+
this.each(item => item.pause());
|
|
12623
|
+
}
|
|
12624
|
+
stop() {
|
|
12625
|
+
this.each(item => item.stop());
|
|
12626
|
+
}
|
|
12627
|
+
seek(time) {
|
|
12628
|
+
this.each(item => item.seek(time));
|
|
12629
|
+
}
|
|
12630
|
+
kill(complete, killStyle) {
|
|
12631
|
+
this.each(item => item.kill(complete, killStyle));
|
|
12632
|
+
this.destroy();
|
|
12633
|
+
}
|
|
12634
|
+
each(func) {
|
|
12635
|
+
this.list.forEach(func);
|
|
12636
|
+
}
|
|
12637
|
+
destroy(complete) {
|
|
12638
|
+
const { list } = this;
|
|
12639
|
+
if (list.length) {
|
|
12640
|
+
this.each(item => item.destroy(complete));
|
|
12641
|
+
list.length = 0;
|
|
12642
|
+
}
|
|
12643
|
+
}
|
|
12644
|
+
};
|
|
12645
|
+
exports.AnimateList = __decorate([
|
|
12646
|
+
useModule(LeafEventer)
|
|
12647
|
+
], exports.AnimateList);
|
|
12648
|
+
|
|
12540
12649
|
const colorNames = {
|
|
12541
12650
|
transparent: 'FFF0',
|
|
12542
12651
|
aliceblue: 'F0F8FF',
|
|
@@ -12917,23 +13026,40 @@ var LeaferUI = (function (exports) {
|
|
|
12917
13026
|
ui$2.animate = function (keyframe, options, kill, isTemp) {
|
|
12918
13027
|
if (keyframe === undefined)
|
|
12919
13028
|
return this.__animate;
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
12925
|
-
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
|
|
13029
|
+
const isAnimationList = keyframe instanceof Array && !options && kill;
|
|
13030
|
+
let nextAnimate = isAnimationList ? new exports.AnimateList(this, keyframe, isTemp) : new exports.Animate(this, keyframe, options, isTemp);
|
|
13031
|
+
this.killAnimate(kill, nextAnimate.toStyle);
|
|
13032
|
+
const animate = this.__animate;
|
|
13033
|
+
if (animate) {
|
|
13034
|
+
if (nextAnimate instanceof exports.AnimateList)
|
|
13035
|
+
nextAnimate.list.unshift(animate);
|
|
13036
|
+
else
|
|
13037
|
+
nextAnimate = new exports.AnimateList(this, [animate, nextAnimate]);
|
|
13038
|
+
}
|
|
13039
|
+
return this.__animate = nextAnimate;
|
|
12929
13040
|
};
|
|
12930
|
-
ui$2.killAnimate = function (_type,
|
|
13041
|
+
ui$2.killAnimate = function (_type, nextStyle) {
|
|
12931
13042
|
const animate = this.__animate;
|
|
12932
|
-
if (animate)
|
|
12933
|
-
|
|
13043
|
+
if (animate) {
|
|
13044
|
+
let kill = false;
|
|
13045
|
+
if (nextStyle && !animate.completed) {
|
|
13046
|
+
if (animate instanceof exports.AnimateList)
|
|
13047
|
+
animate.updateList();
|
|
13048
|
+
const { toStyle } = animate;
|
|
13049
|
+
for (let key in nextStyle)
|
|
13050
|
+
if (key in toStyle) {
|
|
13051
|
+
kill = true;
|
|
13052
|
+
break;
|
|
13053
|
+
}
|
|
13054
|
+
}
|
|
13055
|
+
else
|
|
13056
|
+
kill = true;
|
|
13057
|
+
if (kill)
|
|
13058
|
+
animate.kill(true, nextStyle), this.__animate = null;
|
|
13059
|
+
}
|
|
12934
13060
|
};
|
|
12935
13061
|
ui$2.__runAnimation = function (type, complete) {
|
|
12936
|
-
this.animate(type === 'in' ? this.animation : this.animationOut);
|
|
13062
|
+
this.animate(type === 'in' ? this.animation : this.animationOut, undefined, 'animation');
|
|
12937
13063
|
if (complete)
|
|
12938
13064
|
this.__animate.on(AnimateEvent.COMPLETED, complete);
|
|
12939
13065
|
};
|