@pixodesk/svg-animator-web 1.0.26 → 1.0.28

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.
@@ -43,41 +43,6 @@ var PixodeskAnimator = (() => {
43
43
  setupAnimationTriggers: () => setupAnimationTriggers
44
44
  });
45
45
 
46
- // ../svg-animator-core/src/PxAnimatorConstants.ts
47
- var PxAnimatorMode = {
48
- auto: "auto",
49
- waapi: "waapi",
50
- frames: "frames"
51
- };
52
- var PxAnimatorEngine = {
53
- waapi: PxAnimatorMode.waapi,
54
- frames: PxAnimatorMode.frames
55
- };
56
- var PxLoopExtend = {
57
- /** Segment from the START; the animation is extended BEFORE the first keyframe
58
- * (intro loops that run before the main timeline begins). */
59
- before: "before",
60
- /** DEFAULT — segment from the END; extended AFTER the last keyframe (idle/outro
61
- * loops that continue once the main timeline has finished). */
62
- after: "after"
63
- };
64
- function getAnimatorConfig(doc) {
65
- var _a;
66
- return (doc == null ? void 0 : doc.animator) || ((_a = doc == null ? void 0 : doc.meta) == null ? void 0 : _a.animator);
67
- }
68
- function getDefs(doc) {
69
- var _a;
70
- if (!doc) return void 0;
71
- return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.definitions;
72
- }
73
- function getBindings(doc) {
74
- var _a;
75
- if (!doc) return void 0;
76
- const animateById = (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.animateById;
77
- if (!animateById) return void 0;
78
- return Object.entries(animateById).map(([id, anim]) => ({ id, animate: anim }));
79
- }
80
-
81
46
  // ../svg-animator-core/src/PxAnimatorUtil.ts
82
47
  function bezierToSvgPath(path, forceCurves = false) {
83
48
  var _a, _b, _c, _d;
@@ -469,6 +434,41 @@ var PixodeskAnimator = (() => {
469
434
  return cubicBezier(flipped);
470
435
  }
471
436
 
437
+ // ../svg-animator-core/src/PxAnimatorConstants.ts
438
+ var PxAnimatorMode = {
439
+ auto: "auto",
440
+ waapi: "waapi",
441
+ frames: "frames"
442
+ };
443
+ var PxAnimatorEngine = {
444
+ waapi: PxAnimatorMode.waapi,
445
+ frames: PxAnimatorMode.frames
446
+ };
447
+ var PxLoopExtend = {
448
+ /** Segment from the START; the animation is extended BEFORE the first keyframe
449
+ * (intro loops that run before the main timeline begins). */
450
+ before: "before",
451
+ /** DEFAULT — segment from the END; extended AFTER the last keyframe (idle/outro
452
+ * loops that continue once the main timeline has finished). */
453
+ after: "after"
454
+ };
455
+ function getAnimatorConfig(doc) {
456
+ var _a;
457
+ return (doc == null ? void 0 : doc.animator) || ((_a = doc == null ? void 0 : doc.meta) == null ? void 0 : _a.animator);
458
+ }
459
+ function getDefs(doc) {
460
+ var _a;
461
+ if (!doc) return void 0;
462
+ return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.definitions;
463
+ }
464
+ function getBindings(doc) {
465
+ var _a;
466
+ if (!doc) return void 0;
467
+ const animateById = (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.animateById;
468
+ if (!animateById) return void 0;
469
+ return Object.entries(animateById).map(([id, anim]) => ({ id, animate: anim }));
470
+ }
471
+
472
472
  // ../svg-animator-core/src/PxMotionPath.ts
473
473
  function getKfTranslate(kf) {
474
474
  var _a;
@@ -1510,7 +1510,7 @@ var PixodeskAnimator = (() => {
1510
1510
  }
1511
1511
  return result;
1512
1512
  }
1513
- function createWebApiAnimator(doc, callbacks, rootElement, forceEvenIfHasUnsupportedAttrs) {
1513
+ function createWebApiAnimator(doc, callbacks, rootElement, forceEvenIfHasUnsupportedAttrs, scrollTimeline) {
1514
1514
  var _a;
1515
1515
  const config = getAnimatorConfig(doc) || {};
1516
1516
  if (!rootElement) {
@@ -1569,7 +1569,12 @@ var PixodeskAnimator = (() => {
1569
1569
  if (keyframes.length > 0) {
1570
1570
  try {
1571
1571
  const effect = new KeyframeEffect(element, keyframes, effectOptions);
1572
- const anim = new Animation(effect, document.timeline);
1572
+ const anim = new Animation(effect, scrollTimeline ? scrollTimeline.timeline : document.timeline);
1573
+ if (scrollTimeline) {
1574
+ const a = anim;
1575
+ if (scrollTimeline.rangeStart) a.rangeStart = scrollTimeline.rangeStart;
1576
+ if (scrollTimeline.rangeEnd) a.rangeEnd = scrollTimeline.rangeEnd;
1577
+ }
1573
1578
  if (callbacks == null ? void 0 : callbacks.onFinish) anim.onfinish = () => {
1574
1579
  var _a2;
1575
1580
  if (finishNotified) return;
@@ -1663,7 +1668,14 @@ var PixodeskAnimator = (() => {
1663
1668
  }
1664
1669
  };
1665
1670
  if (config.trigger) {
1666
- setupAnimationTriggers(api, config.trigger);
1671
+ if (config.timelineSource === "scroll") {
1672
+ console.warn("scroll timeline: `animator.trigger` is ignored (triggers do not apply to scroll-driven playback)");
1673
+ } else {
1674
+ setupAnimationTriggers(api, config.trigger);
1675
+ }
1676
+ }
1677
+ if (scrollTimeline) {
1678
+ animations.forEach((a) => a.play());
1667
1679
  }
1668
1680
  return api;
1669
1681
  }