@visactor/vrender-animate 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.
Files changed (46) hide show
  1. package/cjs/custom/fromTo.js +2 -1
  2. package/cjs/custom/growAngle.js +1 -2
  3. package/cjs/custom/register.d.ts +2 -2
  4. package/cjs/custom/register.js +19 -1
  5. package/cjs/custom/register.js.map +1 -1
  6. package/cjs/custom/richtext/input-richtext.d.ts +4 -2
  7. package/cjs/custom/richtext/input-richtext.js +18 -9
  8. package/cjs/custom/richtext/input-richtext.js.map +1 -1
  9. package/cjs/custom/scale.js +2 -1
  10. package/cjs/custom/state.js +1 -2
  11. package/cjs/custom/story.d.ts +68 -0
  12. package/cjs/custom/story.js +147 -2
  13. package/cjs/custom/story.js.map +1 -1
  14. package/cjs/ticker/default-ticker.d.ts +3 -2
  15. package/cjs/ticker/default-ticker.js +8 -4
  16. package/cjs/ticker/default-ticker.js.map +1 -1
  17. package/cjs/ticker/manual-ticker.d.ts +2 -1
  18. package/cjs/ticker/manual-ticker.js +6 -4
  19. package/cjs/ticker/manual-ticker.js.map +1 -1
  20. package/cjs/timeline.d.ts +11 -3
  21. package/cjs/timeline.js +28 -15
  22. package/cjs/timeline.js.map +1 -1
  23. package/dist/index.es.js +374 -46
  24. package/es/custom/fromTo.js +2 -1
  25. package/es/custom/growAngle.js +1 -2
  26. package/es/custom/register.d.ts +2 -2
  27. package/es/custom/register.js +7 -6
  28. package/es/custom/register.js.map +1 -1
  29. package/es/custom/richtext/input-richtext.d.ts +4 -2
  30. package/es/custom/richtext/input-richtext.js +18 -9
  31. package/es/custom/richtext/input-richtext.js.map +1 -1
  32. package/es/custom/scale.js +2 -1
  33. package/es/custom/state.js +1 -2
  34. package/es/custom/story.d.ts +68 -0
  35. package/es/custom/story.js +140 -0
  36. package/es/custom/story.js.map +1 -1
  37. package/es/ticker/default-ticker.d.ts +3 -2
  38. package/es/ticker/default-ticker.js +8 -4
  39. package/es/ticker/default-ticker.js.map +1 -1
  40. package/es/ticker/manual-ticker.d.ts +2 -1
  41. package/es/ticker/manual-ticker.js +6 -4
  42. package/es/ticker/manual-ticker.js.map +1 -1
  43. package/es/timeline.d.ts +11 -3
  44. package/es/timeline.js +28 -15
  45. package/es/timeline.js.map +1 -1
  46. package/package.json +4 -4
package/dist/index.es.js CHANGED
@@ -567,32 +567,52 @@ class WaitStep extends Step {
567
567
 
568
568
  class DefaultTimeline {
569
569
  get animateCount() {
570
- return this.animates.length;
570
+ return this._animateCount;
571
571
  }
572
572
  constructor() {
573
- this.animates = [];
573
+ this.head = null;
574
+ this.tail = null;
575
+ this.animateMap = new Map();
576
+ this._animateCount = 0;
574
577
  this._playSpeed = 1;
575
578
  this._totalDuration = 0;
576
579
  this._startTime = 0;
577
580
  this._currentTime = 0;
578
- this._endAnimatePtr = -1;
579
581
  this.id = Generator.GenAutoIncrementId();
580
- this.animates = [];
581
582
  this.paused = false;
582
583
  }
583
584
  isRunning() {
584
- return !this.paused && this._endAnimatePtr >= 0;
585
+ return !this.paused && this._animateCount > 0;
585
586
  }
586
587
  forEachAccessAnimate(cb) {
587
- for (let i = 0; i <= this._endAnimatePtr; i++) {
588
- cb(this.animates[i], i);
588
+ let current = this.head;
589
+ let index = 0;
590
+ while (current) {
591
+ const next = current.next;
592
+ cb(current.animate, index);
593
+ index++;
594
+ current = next;
589
595
  }
590
596
  }
591
597
  addAnimate(animate) {
592
- this.animates.push(animate);
593
- this._endAnimatePtr++;
594
- this.animates[this.animates.length - 1] = this.animates[this._endAnimatePtr];
595
- this.animates[this._endAnimatePtr] = animate;
598
+ const newNode = {
599
+ animate,
600
+ next: null,
601
+ prev: null
602
+ };
603
+ if (!this.head) {
604
+ this.head = newNode;
605
+ this.tail = newNode;
606
+ }
607
+ else {
608
+ if (this.tail) {
609
+ this.tail.next = newNode;
610
+ newNode.prev = this.tail;
611
+ this.tail = newNode;
612
+ }
613
+ }
614
+ this.animateMap.set(animate, newNode);
615
+ this._animateCount++;
596
616
  this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
597
617
  }
598
618
  pause() {
@@ -609,7 +629,7 @@ class DefaultTimeline {
609
629
  this._currentTime += scaledDelta;
610
630
  this.forEachAccessAnimate((animate, i) => {
611
631
  if (animate.status === AnimateStatus.END) {
612
- this.removeAnimate(animate, true, i);
632
+ this.removeAnimate(animate, true);
613
633
  }
614
634
  else if (animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL) {
615
635
  animate.advance(scaledDelta);
@@ -620,25 +640,43 @@ class DefaultTimeline {
620
640
  this.forEachAccessAnimate(animate => {
621
641
  animate.release();
622
642
  });
623
- this.animates = [];
643
+ this.head = null;
644
+ this.tail = null;
645
+ this.animateMap.clear();
646
+ this._animateCount = 0;
624
647
  this._totalDuration = 0;
625
648
  }
626
- removeAnimate(animate, release = true, index) {
627
- if (this._endAnimatePtr < 0) {
649
+ removeAnimate(animate, release = true) {
650
+ const node = this.animateMap.get(animate);
651
+ if (!node) {
628
652
  return;
629
653
  }
630
654
  if (release) {
631
655
  animate._onRemove && animate._onRemove.forEach(cb => cb());
632
656
  animate.release();
633
657
  }
634
- index = index !== null && index !== void 0 ? index : this.animates.indexOf(animate);
635
- this.animates[index] = this.animates[this._endAnimatePtr];
636
- this._endAnimatePtr--;
658
+ if (node.prev) {
659
+ node.prev.next = node.next;
660
+ }
661
+ else {
662
+ this.head = node.next;
663
+ }
664
+ if (node.next) {
665
+ node.next.prev = node.prev;
666
+ }
667
+ else {
668
+ this.tail = node.prev;
669
+ }
670
+ this.animateMap.delete(animate);
671
+ this._animateCount--;
672
+ if (animate.getStartTime() + animate.getDuration() >= this._totalDuration) {
673
+ this.recalculateTotalDuration();
674
+ }
637
675
  return;
638
676
  }
639
677
  recalculateTotalDuration() {
640
678
  this._totalDuration = 0;
641
- this.animates.forEach(animate => {
679
+ this.forEachAccessAnimate(animate => {
642
680
  this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
643
681
  });
644
682
  }
@@ -1077,13 +1115,6 @@ class DefaultTicker extends EventEmitter {
1077
1115
  super();
1078
1116
  this.timelines = [];
1079
1117
  this.frameTimeHistory = [];
1080
- this.checkSkip = (delta) => {
1081
- if (this.stage.params.optimize.tickRenderMode === 'performance') {
1082
- return false;
1083
- }
1084
- const skip = delta < this.interval + (Math.random() - 0.5) * 2 * this._jitter;
1085
- return skip;
1086
- };
1087
1118
  this.handleTick = (handler, params) => {
1088
1119
  const { once = false } = params !== null && params !== void 0 ? params : {};
1089
1120
  if (this.ifCanStop()) {
@@ -1126,6 +1157,9 @@ class DefaultTicker extends EventEmitter {
1126
1157
  this.interval = 16;
1127
1158
  this.computeTimeOffsetAndJitter();
1128
1159
  }
1160
+ bindStage(stage) {
1161
+ this.stage = stage;
1162
+ }
1129
1163
  computeTimeOffsetAndJitter() {
1130
1164
  this.timeOffset = Math.floor(Math.random() * this.interval);
1131
1165
  this._jitter = Math.min(Math.max(this.interval * 0.2, 6), this.interval * 0.7);
@@ -1251,19 +1285,25 @@ class DefaultTicker extends EventEmitter {
1251
1285
  this.tickerHandler = null;
1252
1286
  this.lastFrameTime = -1;
1253
1287
  }
1288
+ checkSkip(delta) {
1289
+ if (this.stage.params.optimize.tickRenderMode === 'performance') {
1290
+ return false;
1291
+ }
1292
+ const skip = delta < this.interval + (Math.random() - 0.5) * 2 * this._jitter;
1293
+ return skip;
1294
+ }
1254
1295
  }
1255
1296
 
1256
1297
  class ManualTickHandler {
1257
1298
  constructor() {
1258
1299
  this.released = false;
1259
- this.startTime = -1;
1260
1300
  this.currentTime = -1;
1261
1301
  }
1262
1302
  tick(interval, cb) {
1263
- if (this.startTime < 0) {
1264
- this.startTime = 0;
1303
+ if (this.currentTime < 0) {
1304
+ this.currentTime = 0;
1265
1305
  }
1266
- this.currentTime = this.startTime + interval;
1306
+ this.currentTime += interval;
1267
1307
  cb(this);
1268
1308
  }
1269
1309
  release() {
@@ -1273,8 +1313,7 @@ class ManualTickHandler {
1273
1313
  return this.currentTime;
1274
1314
  }
1275
1315
  tickTo(time, cb) {
1276
- if (this.startTime < 0) {
1277
- this.startTime = 0;
1316
+ if (this.currentTime < 0) {
1278
1317
  this.currentTime = 0;
1279
1318
  }
1280
1319
  const interval = time - this.currentTime;
@@ -1295,6 +1334,9 @@ class ManualTicker extends DefaultTicker {
1295
1334
  this.tickerHandler = handler;
1296
1335
  return true;
1297
1336
  }
1337
+ checkSkip(delta) {
1338
+ return false;
1339
+ }
1298
1340
  getTime() {
1299
1341
  return this.tickerHandler.getTime();
1300
1342
  }
@@ -4340,10 +4382,10 @@ class InputRichText extends ACustomAnimate {
4340
4382
  this.showCursor = false;
4341
4383
  this.cursorChar = '|';
4342
4384
  this.blinkCursor = true;
4343
- this.beforeText = '';
4344
- this.afterText = '';
4345
4385
  this.fadeInChars = false;
4346
4386
  this.fadeInDuration = 0.3;
4387
+ this.strokeFirst = false;
4388
+ this.strokeToFillRatio = 0.3;
4347
4389
  if ((params === null || params === void 0 ? void 0 : params.showCursor) !== undefined) {
4348
4390
  this.showCursor = params.showCursor;
4349
4391
  }
@@ -4353,18 +4395,18 @@ class InputRichText extends ACustomAnimate {
4353
4395
  if ((params === null || params === void 0 ? void 0 : params.blinkCursor) !== undefined) {
4354
4396
  this.blinkCursor = params.blinkCursor;
4355
4397
  }
4356
- if ((params === null || params === void 0 ? void 0 : params.beforeText) !== undefined) {
4357
- this.beforeText = params.beforeText;
4358
- }
4359
- if ((params === null || params === void 0 ? void 0 : params.afterText) !== undefined) {
4360
- this.afterText = params.afterText;
4361
- }
4362
4398
  if ((params === null || params === void 0 ? void 0 : params.fadeInChars) !== undefined) {
4363
4399
  this.fadeInChars = params.fadeInChars;
4364
4400
  }
4365
4401
  if ((params === null || params === void 0 ? void 0 : params.fadeInDuration) !== undefined) {
4366
4402
  this.fadeInDuration = params.fadeInDuration;
4367
4403
  }
4404
+ if ((params === null || params === void 0 ? void 0 : params.strokeFirst) !== undefined) {
4405
+ this.strokeFirst = params.strokeFirst;
4406
+ }
4407
+ if ((params === null || params === void 0 ? void 0 : params.strokeToFillRatio) !== undefined) {
4408
+ this.strokeToFillRatio = params.strokeToFillRatio;
4409
+ }
4368
4410
  }
4369
4411
  onFirstRun() {
4370
4412
  const fromProps = this.getLastProps();
@@ -4413,11 +4455,30 @@ class InputRichText extends ACustomAnimate {
4413
4455
  }
4414
4456
  else {
4415
4457
  currentTextConfig = this.toTextConfig.slice(0, currentLength).map((item, index) => {
4416
- if (this.fadeInChars && 'text' in item) {
4417
- const appearTime = (index / totalItems) * maxTextShowRatio;
4418
- const fadeProgress = (ratio - appearTime) / this.fadeInDuration;
4419
- const opacity = Math.max(0, Math.min(1, fadeProgress));
4420
- return Object.assign(Object.assign({}, item), { opacity: opacity });
4458
+ if ('text' in item) {
4459
+ const newItem = Object.assign({}, item);
4460
+ if (this.strokeFirst) {
4461
+ const appearTime = (index / totalItems) * maxTextShowRatio;
4462
+ const itemLifetime = Math.max(0, ratio - appearTime);
4463
+ const maxLifetime = 1 - appearTime;
4464
+ const fillProgress = Math.min(1, itemLifetime / (this.strokeToFillRatio * maxLifetime));
4465
+ if ('fill' in newItem && newItem.fill) {
4466
+ newItem.stroke = newItem.fill;
4467
+ if (fillProgress < 1) {
4468
+ newItem.fillOpacity = fillProgress;
4469
+ }
4470
+ }
4471
+ if (this.fadeInChars) {
4472
+ const fadeProgress = Math.min(1, itemLifetime / (this.fadeInDuration * maxLifetime));
4473
+ newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
4474
+ }
4475
+ }
4476
+ else if (this.fadeInChars) {
4477
+ const appearTime = (index / totalItems) * maxTextShowRatio;
4478
+ const fadeProgress = (ratio - appearTime) / this.fadeInDuration;
4479
+ newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
4480
+ }
4481
+ return newItem;
4421
4482
  }
4422
4483
  return item;
4423
4484
  });
@@ -5297,6 +5358,155 @@ class SpinIn extends ACustomAnimate {
5297
5358
  this.target.addUpdateShapeAndBoundsTag();
5298
5359
  }
5299
5360
  }
5361
+ class StrokeIn extends ACustomAnimate {
5362
+ constructor(from, to, duration, easing, params) {
5363
+ super(from, to, duration, easing, params);
5364
+ this.perimeter = 0;
5365
+ this.originalAttributes = {};
5366
+ }
5367
+ onBind() {
5368
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
5369
+ super.onBind();
5370
+ this.originalAttributes = Object.assign({}, this.target.getAttributes());
5371
+ if (this.target.type === 'rect') {
5372
+ const attr = this.target.attribute;
5373
+ const width = (_a = attr.width) !== null && _a !== void 0 ? _a : 100;
5374
+ const height = (_b = attr.height) !== null && _b !== void 0 ? _b : 100;
5375
+ this.perimeter = 2 * (width + height);
5376
+ }
5377
+ else if (this.target.type === 'circle') {
5378
+ const attr = this.target.attribute;
5379
+ const radius = (_c = attr.radius) !== null && _c !== void 0 ? _c : 50;
5380
+ this.perimeter = 2 * Math.PI * radius;
5381
+ }
5382
+ else if (this.target.type === 'ellipse') {
5383
+ const attr = this.target.attribute;
5384
+ const radiusX = (_d = attr.radiusX) !== null && _d !== void 0 ? _d : 50;
5385
+ const radiusY = (_e = attr.radiusY) !== null && _e !== void 0 ? _e : 50;
5386
+ this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
5387
+ }
5388
+ else {
5389
+ this.perimeter = 1000;
5390
+ }
5391
+ const lineWidth = (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.lineWidth) !== null && _g !== void 0 ? _g : 2;
5392
+ const strokeColor = (_j = (_h = this.params) === null || _h === void 0 ? void 0 : _h.strokeColor) !== null && _j !== void 0 ? _j : 'black';
5393
+ const fromOpacity = (_l = (_k = this.params) === null || _k === void 0 ? void 0 : _k.fromOpacity) !== null && _l !== void 0 ? _l : 1;
5394
+ const dashLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.dashLength) !== null && _o !== void 0 ? _o : this.perimeter;
5395
+ const showFill = (_q = (_p = this.params) === null || _p === void 0 ? void 0 : _p.showFill) !== null && _q !== void 0 ? _q : false;
5396
+ const fillOpacity = (_s = (_r = this.params) === null || _r === void 0 ? void 0 : _r.fillOpacity) !== null && _s !== void 0 ? _s : 0;
5397
+ this.from = {
5398
+ lineDash: [dashLength, dashLength],
5399
+ lineDashOffset: dashLength,
5400
+ lineWidth,
5401
+ stroke: strokeColor,
5402
+ strokeOpacity: fromOpacity
5403
+ };
5404
+ this.to = {
5405
+ lineDash: [dashLength, dashLength],
5406
+ lineDashOffset: 0,
5407
+ lineWidth,
5408
+ stroke: strokeColor,
5409
+ strokeOpacity: fromOpacity
5410
+ };
5411
+ if (showFill) {
5412
+ this.from.fillOpacity = fillOpacity;
5413
+ this.to.fillOpacity = (_t = this.originalAttributes.fillOpacity) !== null && _t !== void 0 ? _t : 1;
5414
+ }
5415
+ else {
5416
+ this.from.fillOpacity = 0;
5417
+ this.to.fillOpacity = 0;
5418
+ }
5419
+ this.propKeys = ['lineDash', 'lineDashOffset', 'lineWidth', 'stroke', 'strokeOpacity', 'fillOpacity'];
5420
+ this.props = this.to;
5421
+ this.target.setAttributes(this.from);
5422
+ }
5423
+ onUpdate(end, ratio, out) {
5424
+ var _a;
5425
+ const attribute = this.target.attribute;
5426
+ attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio;
5427
+ if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill) {
5428
+ attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio;
5429
+ }
5430
+ }
5431
+ onEnd() {
5432
+ var _a;
5433
+ super.onEnd();
5434
+ if (!((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill)) {
5435
+ const originalAttrs = Object.assign({}, this.originalAttributes);
5436
+ originalAttrs.fillOpacity = 0;
5437
+ this.target.setAttributes(originalAttrs);
5438
+ }
5439
+ }
5440
+ }
5441
+ class StrokeOut extends ACustomAnimate {
5442
+ constructor(from, to, duration, easing, params) {
5443
+ super(from, to, duration, easing, params);
5444
+ this.perimeter = 0;
5445
+ this.originalAttributes = {};
5446
+ }
5447
+ onFirstRun() {
5448
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5449
+ this.originalAttributes = Object.assign({}, this.target.getAttributes());
5450
+ if (this.target.type === 'rect') {
5451
+ const attr = this.target.attribute;
5452
+ const width = (_a = attr.width) !== null && _a !== void 0 ? _a : 100;
5453
+ const height = (_b = attr.height) !== null && _b !== void 0 ? _b : 100;
5454
+ this.perimeter = 2 * (width + height);
5455
+ }
5456
+ else if (this.target.type === 'circle') {
5457
+ const attr = this.target.attribute;
5458
+ const radius = (_c = attr.radius) !== null && _c !== void 0 ? _c : 50;
5459
+ this.perimeter = 2 * Math.PI * radius;
5460
+ }
5461
+ else if (this.target.type === 'ellipse') {
5462
+ const attr = this.target.attribute;
5463
+ const radiusX = (_d = attr.radiusX) !== null && _d !== void 0 ? _d : 50;
5464
+ const radiusY = (_e = attr.radiusY) !== null && _e !== void 0 ? _e : 50;
5465
+ this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
5466
+ }
5467
+ else {
5468
+ this.perimeter = 1000;
5469
+ }
5470
+ const lineWidth = (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.lineWidth) !== null && _g !== void 0 ? _g : 2;
5471
+ const strokeColor = (_j = (_h = this.params) === null || _h === void 0 ? void 0 : _h.strokeColor) !== null && _j !== void 0 ? _j : 'black';
5472
+ const fromOpacity = (_l = (_k = this.params) === null || _k === void 0 ? void 0 : _k.fromOpacity) !== null && _l !== void 0 ? _l : 1;
5473
+ const dashLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.dashLength) !== null && _o !== void 0 ? _o : this.perimeter;
5474
+ const showFill = (_q = (_p = this.params) === null || _p === void 0 ? void 0 : _p.showFill) !== null && _q !== void 0 ? _q : false;
5475
+ this.from = {
5476
+ lineDash: [dashLength, dashLength],
5477
+ lineDashOffset: 0,
5478
+ lineWidth,
5479
+ stroke: strokeColor,
5480
+ strokeOpacity: fromOpacity
5481
+ };
5482
+ this.to = {
5483
+ lineDash: [dashLength, dashLength],
5484
+ lineDashOffset: -dashLength,
5485
+ lineWidth,
5486
+ stroke: strokeColor,
5487
+ strokeOpacity: fromOpacity
5488
+ };
5489
+ if (showFill) {
5490
+ this.from.fillOpacity = (_r = this.originalAttributes.fillOpacity) !== null && _r !== void 0 ? _r : 1;
5491
+ this.to.fillOpacity = 0;
5492
+ }
5493
+ else {
5494
+ this.from.fillOpacity = 0;
5495
+ this.to.fillOpacity = 0;
5496
+ }
5497
+ this.propKeys = ['lineDash', 'lineDashOffset', 'lineWidth', 'stroke', 'strokeOpacity', 'fillOpacity'];
5498
+ this.props = this.to;
5499
+ this.target.setAttributes(this.from);
5500
+ }
5501
+ onUpdate(end, ratio, out) {
5502
+ var _a;
5503
+ const attribute = this.target.attribute;
5504
+ attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio;
5505
+ if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.showFill) {
5506
+ attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio;
5507
+ }
5508
+ }
5509
+ }
5300
5510
  class MoveScaleIn extends ACustomAnimate {
5301
5511
  constructor(from, to, duration, easing, params) {
5302
5512
  var _a;
@@ -5575,6 +5785,121 @@ class MoveRotateOut extends ACustomAnimate {
5575
5785
  onUpdate(end, ratio, out) {
5576
5786
  }
5577
5787
  }
5788
+ class PulseAnimate extends ACustomAnimate {
5789
+ constructor(from, to, duration, easing, params) {
5790
+ super(from, to, duration, easing, params);
5791
+ this.originalAttributes = {};
5792
+ this.pulseCount = 3;
5793
+ this.pulseOpacity = 0.3;
5794
+ this.pulseScale = 1.05;
5795
+ this.pulseColor = null;
5796
+ this.pulseColorIntensity = 0.2;
5797
+ this.strokeOnly = false;
5798
+ this.fillOnly = false;
5799
+ this.useScale = true;
5800
+ this.useOpacity = true;
5801
+ this.useStroke = true;
5802
+ this.useFill = true;
5803
+ this.useColor = false;
5804
+ this.originalFill = null;
5805
+ this.originalStroke = null;
5806
+ if ((params === null || params === void 0 ? void 0 : params.pulseCount) !== undefined) {
5807
+ this.pulseCount = params.pulseCount;
5808
+ }
5809
+ if ((params === null || params === void 0 ? void 0 : params.pulseScale) !== undefined) {
5810
+ this.pulseScale = params.pulseScale;
5811
+ }
5812
+ if ((params === null || params === void 0 ? void 0 : params.pulseColor) !== undefined) {
5813
+ this.pulseColor = params.pulseColor;
5814
+ }
5815
+ if ((params === null || params === void 0 ? void 0 : params.pulseColorIntensity) !== undefined) {
5816
+ this.pulseColorIntensity = params.pulseColorIntensity;
5817
+ }
5818
+ if ((params === null || params === void 0 ? void 0 : params.strokeOnly) !== undefined) {
5819
+ this.strokeOnly = params.strokeOnly;
5820
+ }
5821
+ if ((params === null || params === void 0 ? void 0 : params.fillOnly) !== undefined) {
5822
+ this.fillOnly = params.fillOnly;
5823
+ }
5824
+ if ((params === null || params === void 0 ? void 0 : params.useScale) !== undefined) {
5825
+ this.useScale = params.useScale;
5826
+ }
5827
+ if ((params === null || params === void 0 ? void 0 : params.useOpacity) !== undefined) {
5828
+ this.useOpacity = params.useOpacity;
5829
+ }
5830
+ if ((params === null || params === void 0 ? void 0 : params.useStroke) !== undefined) {
5831
+ this.useStroke = params.useStroke;
5832
+ }
5833
+ if ((params === null || params === void 0 ? void 0 : params.useFill) !== undefined) {
5834
+ this.useFill = params.useFill;
5835
+ }
5836
+ if ((params === null || params === void 0 ? void 0 : params.useColor) !== undefined) {
5837
+ this.useColor = params.useColor;
5838
+ }
5839
+ }
5840
+ onBind() {
5841
+ super.onBind();
5842
+ this.originalAttributes = Object.assign({}, this.target.getAttributes());
5843
+ if (this.useColor) {
5844
+ this.originalFill = this.originalAttributes.fill || null;
5845
+ this.originalStroke = this.originalAttributes.stroke || null;
5846
+ if (!this.pulseColor) {
5847
+ if (this.fillOnly && this.originalFill) {
5848
+ this.pulseColor = this.originalFill;
5849
+ }
5850
+ else if (this.strokeOnly && this.originalStroke) {
5851
+ this.pulseColor = this.originalStroke;
5852
+ }
5853
+ else if (this.originalFill) {
5854
+ this.pulseColor = this.originalFill;
5855
+ }
5856
+ else if (this.originalStroke) {
5857
+ this.pulseColor = this.originalStroke;
5858
+ }
5859
+ else {
5860
+ this.pulseColor = '#FFFFFF';
5861
+ }
5862
+ }
5863
+ }
5864
+ }
5865
+ onUpdate(end, ratio, out) {
5866
+ const angle = ratio * Math.PI * this.pulseCount;
5867
+ const pulseValue = Math.abs(Math.sin(angle));
5868
+ const attribute = this.target.attribute;
5869
+ if (this.useOpacity) {
5870
+ const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
5871
+ if (this.useStroke) {
5872
+ attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity;
5873
+ }
5874
+ if (this.useFill) {
5875
+ attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity;
5876
+ }
5877
+ }
5878
+ if (this.useScale) {
5879
+ const scale = 1 + (this.pulseScale - 1) * pulseValue;
5880
+ attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale;
5881
+ attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
5882
+ }
5883
+ if (this.useColor && this.pulseColor) {
5884
+ this.applyColorPulse(attribute, pulseValue);
5885
+ }
5886
+ this.target.addUpdateShapeAndBoundsTag();
5887
+ this.target.addUpdatePositionTag();
5888
+ }
5889
+ applyColorPulse(attribute, pulseValue) {
5890
+ const colorRatio = this.pulseColorIntensity * pulseValue;
5891
+ if (this.useFill && this.originalFill && this.pulseColor) {
5892
+ attribute.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, true);
5893
+ }
5894
+ if (this.useStroke && this.originalStroke && this.pulseColor) {
5895
+ attribute.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, true);
5896
+ }
5897
+ }
5898
+ onEnd() {
5899
+ super.onEnd();
5900
+ this.target.setAttributes(this.originalAttributes);
5901
+ }
5902
+ }
5578
5903
 
5579
5904
  class Update extends ACustomAnimate {
5580
5905
  constructor(from, to, duration, easing, params) {
@@ -6193,13 +6518,16 @@ const registerCustomAnimate = () => {
6193
6518
  AnimateExecutor.registerBuiltInAnimate('spinIn', SpinIn);
6194
6519
  AnimateExecutor.registerBuiltInAnimate('moveScaleIn', MoveScaleIn);
6195
6520
  AnimateExecutor.registerBuiltInAnimate('moveRotateIn', MoveRotateIn);
6521
+ AnimateExecutor.registerBuiltInAnimate('strokeIn', StrokeIn);
6196
6522
  AnimateExecutor.registerBuiltInAnimate('slideOut', SlideOut);
6197
6523
  AnimateExecutor.registerBuiltInAnimate('growOut', GrowOut);
6198
6524
  AnimateExecutor.registerBuiltInAnimate('spinOut', SpinOut);
6199
6525
  AnimateExecutor.registerBuiltInAnimate('moveScaleOut', MoveScaleOut);
6200
6526
  AnimateExecutor.registerBuiltInAnimate('moveRotateOut', MoveRotateOut);
6527
+ AnimateExecutor.registerBuiltInAnimate('strokeOut', StrokeOut);
6528
+ AnimateExecutor.registerBuiltInAnimate('pulse', PulseAnimate);
6201
6529
  AnimateExecutor.registerBuiltInAnimate('MotionPath', MotionPath);
6202
6530
  AnimateExecutor.registerBuiltInAnimate('streamLight', StreamLight);
6203
6531
  };
6204
6532
 
6205
- export { AComponentAnimate, ACustomAnimate, Animate, AnimateExecutor, Step as AnimateStep, AnimationStateManager, AnimationStateStore, AnimationStates, AnimationTransitionRegistry, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipIn, ClipOut, ClipRadiusAnimate, ComponentAnimator, DefaultTicker, DefaultTimeline, FadeIn, FadeOut, FromTo, GraphicStateExtension, GroupFadeIn, GroupFadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowIn, GrowOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, InputRichText, InputText, LabelItemAppear, LabelItemDisappear, ManualTicker, MotionPath, MoveIn, MoveOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, OutputRichText, PoptipAppear, PoptipDisappear, RotateBySphereAnimate, RotateIn, RotateOut, ScaleIn, ScaleOut, SlideIn, SlideOut, SlideOutRichText, SlideRichText, SpinIn, SpinOut, State, StreamLight, TagPointsUpdate, Update, createComponentAnimator, generatorPathEasingFunc, registerAnimate, registerCustomAnimate, transitionRegistry };
6533
+ export { AComponentAnimate, ACustomAnimate, Animate, AnimateExecutor, Step as AnimateStep, AnimationStateManager, AnimationStateStore, AnimationStates, AnimationTransitionRegistry, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipIn, ClipOut, ClipRadiusAnimate, ComponentAnimator, DefaultTicker, DefaultTimeline, FadeIn, FadeOut, FromTo, GraphicStateExtension, GroupFadeIn, GroupFadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowIn, GrowOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, InputRichText, InputText, LabelItemAppear, LabelItemDisappear, ManualTicker, MotionPath, MoveIn, MoveOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, OutputRichText, PoptipAppear, PoptipDisappear, PulseAnimate, RotateBySphereAnimate, RotateIn, RotateOut, ScaleIn, ScaleOut, SlideIn, SlideOut, SlideOutRichText, SlideRichText, SpinIn, SpinOut, State, StreamLight, StrokeIn, StrokeOut, TagPointsUpdate, Update, createComponentAnimator, generatorPathEasingFunc, registerAnimate, registerCustomAnimate, transitionRegistry };
@@ -35,4 +35,5 @@ export class FromTo extends ACustomAnimate {
35
35
  func(key, this.from[key], this.props[key], easedRatio, this, this.target);
36
36
  })), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
37
37
  }
38
- }
38
+ }
39
+ //# sourceMappingURL=fromTo.js.map
@@ -152,5 +152,4 @@ export class GrowAngleOut extends GrowAngleBase {
152
152
  this.from = null != fromAttrs ? fromAttrs : this.target.attribute, this.to = to,
153
153
  this.determineUpdateFunction();
154
154
  }
155
- }
156
- //# sourceMappingURL=growAngle.js.map
155
+ }
@@ -16,7 +16,7 @@ import { SlideRichText } from './richtext/slide-richtext';
16
16
  import { SlideOutRichText } from './richtext/slide-out-richtext';
17
17
  import { ScaleIn, ScaleOut } from './scale';
18
18
  import { State } from './state';
19
- import { GrowIn, GrowOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, SlideIn, SlideOut, SpinIn, SpinOut } from './story';
19
+ import { GrowIn, GrowOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, PulseAnimate, SlideIn, SlideOut, SpinIn, SpinOut, StrokeIn, StrokeOut } from './story';
20
20
  import { Update } from './update';
21
21
  import { MoveIn, MoveOut } from './move';
22
22
  import { RotateIn, RotateOut } from './rotate';
@@ -25,4 +25,4 @@ import { FromTo } from './fromTo';
25
25
  import { GroupFadeIn, GroupFadeOut } from './groupFade';
26
26
  import { StreamLight } from './streamLight';
27
27
  export declare const registerCustomAnimate: () => void;
28
- export { ClipIn, ClipOut, FadeIn, FadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, PoptipAppear, PoptipDisappear, ScaleIn, ScaleOut, MoveIn, MoveOut, RotateIn, RotateOut, State, Update, MotionPath, LabelItemAppear, LabelItemDisappear, InputText, InputRichText, OutputRichText, SlideRichText, SlideOutRichText, SlideIn, GrowIn, SpinIn, MoveScaleIn, MoveRotateIn, SlideOut, GrowOut, SpinOut, MoveScaleOut, MoveRotateOut, GroupFadeIn, GroupFadeOut, FromTo, StreamLight };
28
+ export { ClipIn, ClipOut, FadeIn, FadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, PoptipAppear, PoptipDisappear, ScaleIn, ScaleOut, MoveIn, MoveOut, RotateIn, RotateOut, State, Update, MotionPath, LabelItemAppear, LabelItemDisappear, InputText, InputRichText, OutputRichText, SlideRichText, SlideOutRichText, SlideIn, GrowIn, SpinIn, MoveScaleIn, MoveRotateIn, SlideOut, GrowOut, SpinOut, MoveScaleOut, MoveRotateOut, StrokeIn, StrokeOut, PulseAnimate, GroupFadeIn, GroupFadeOut, FromTo, StreamLight };
@@ -36,7 +36,7 @@ import { ScaleIn, ScaleOut } from "./scale";
36
36
 
37
37
  import { State } from "./state";
38
38
 
39
- import { GrowIn, GrowOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, SlideIn, SlideOut, SpinIn, SpinOut } from "./story";
39
+ import { GrowIn, GrowOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, PulseAnimate, SlideIn, SlideOut, SpinIn, SpinOut, StrokeIn, StrokeOut } from "./story";
40
40
 
41
41
  import { Update } from "./update";
42
42
 
@@ -75,11 +75,12 @@ export const registerCustomAnimate = () => {
75
75
  AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn),
76
76
  AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn),
77
77
  AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn),
78
- AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut),
79
- AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut),
80
- AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath),
81
- AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
78
+ AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut),
79
+ AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut),
80
+ AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut),
81
+ AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate),
82
+ AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
82
83
  };
83
84
 
84
- export { ClipIn, ClipOut, FadeIn, FadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, PoptipAppear, PoptipDisappear, ScaleIn, ScaleOut, MoveIn, MoveOut, RotateIn, RotateOut, State, Update, MotionPath, LabelItemAppear, LabelItemDisappear, InputText, InputRichText, OutputRichText, SlideRichText, SlideOutRichText, SlideIn, GrowIn, SpinIn, MoveScaleIn, MoveRotateIn, SlideOut, GrowOut, SpinOut, MoveScaleOut, MoveRotateOut, GroupFadeIn, GroupFadeOut, FromTo, StreamLight };
85
+ export { ClipIn, ClipOut, FadeIn, FadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, PoptipAppear, PoptipDisappear, ScaleIn, ScaleOut, MoveIn, MoveOut, RotateIn, RotateOut, State, Update, MotionPath, LabelItemAppear, LabelItemDisappear, InputText, InputRichText, OutputRichText, SlideRichText, SlideOutRichText, SlideIn, GrowIn, SpinIn, MoveScaleIn, MoveRotateIn, SlideOut, GrowOut, SpinOut, MoveScaleOut, MoveRotateOut, StrokeIn, StrokeOut, PulseAnimate, GroupFadeIn, GroupFadeOut, FromTo, StreamLight };
85
86
  //# sourceMappingURL=register.js.map