@pixodesk/svg-animator-web 1.0.44 → 1.0.45

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.
@@ -1609,6 +1609,38 @@ var PixodeskAnimator = (() => {
1609
1609
  return cubicBezier(flipped);
1610
1610
  }
1611
1611
 
1612
+ // ../svg-animator-core/src/animation/PxStaticTransformMerge.ts
1613
+ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
1614
+ if (!animDef) return animDef;
1615
+ const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
1616
+ if (!staticParts || !Object.keys(staticParts).length) return animDef;
1617
+ const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
1618
+ const transformAnim = animDef[TRANSFORM_ATTR];
1619
+ if (transformAnim && typeof transformAnim === "object") {
1620
+ const anim = transformAnim;
1621
+ if (Array.isArray(anim.keyframes)) {
1622
+ const out = __spreadProps(__spreadValues({}, anim), {
1623
+ keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
1624
+ });
1625
+ if (out.value !== void 0) out.value = mergeKfValue(out.value);
1626
+ return __spreadProps(__spreadValues({}, animDef), { transform: out });
1627
+ }
1628
+ return animDef;
1629
+ }
1630
+ const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
1631
+ if (channels.length !== 1) return animDef;
1632
+ const ch = channels[0];
1633
+ const chAnim = animDef[ch];
1634
+ if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
1635
+ const lifted = __spreadProps(__spreadValues({}, chAnim), {
1636
+ keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
1637
+ });
1638
+ if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
1639
+ const rest = __spreadValues({}, animDef);
1640
+ delete rest[ch];
1641
+ return __spreadProps(__spreadValues({}, rest), { transform: lifted });
1642
+ }
1643
+
1612
1644
  // ../svg-animator-core/src/materialize/PxMotionPath.ts
1613
1645
  function getKfTranslate(kf) {
1614
1646
  const v = keyframeValue(kf);
@@ -2397,36 +2429,6 @@ var PixodeskAnimator = (() => {
2397
2429
  function generateElementId() {
2398
2430
  return "_px_el_" + ++_elementIdCounter;
2399
2431
  }
2400
- function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
2401
- if (!animDef) return animDef;
2402
- const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
2403
- if (!staticParts || !Object.keys(staticParts).length) return animDef;
2404
- const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
2405
- const transformAnim = animDef[TRANSFORM_ATTR];
2406
- if (transformAnim && typeof transformAnim === "object") {
2407
- const anim = transformAnim;
2408
- if (Array.isArray(anim.keyframes)) {
2409
- const out = __spreadProps(__spreadValues({}, anim), {
2410
- keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
2411
- });
2412
- if (out.value !== void 0) out.value = mergeKfValue(out.value);
2413
- return __spreadProps(__spreadValues({}, animDef), { transform: out });
2414
- }
2415
- return animDef;
2416
- }
2417
- const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
2418
- if (channels.length !== 1) return animDef;
2419
- const ch = channels[0];
2420
- const chAnim = animDef[ch];
2421
- if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
2422
- const lifted = __spreadProps(__spreadValues({}, chAnim), {
2423
- keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
2424
- });
2425
- if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
2426
- const rest = __spreadValues({}, animDef);
2427
- delete rest[ch];
2428
- return __spreadProps(__spreadValues({}, rest), { transform: lifted });
2429
- }
2430
2432
  function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimelineEngine.native) {
2431
2433
  const normalized = {};
2432
2434
  for (const [propName, propAnim] of Object.entries(animDef)) {
@@ -2509,7 +2511,7 @@ var PixodeskAnimator = (() => {
2509
2511
  return { prevKf, nextKf };
2510
2512
  }
2511
2513
  function calcPropertyValue(propName, propAnim, progress) {
2512
- var _a, _b, _c, _d;
2514
+ var _a, _b, _c, _d, _e;
2513
2515
  const keyframes = propAnim.keyframes || [];
2514
2516
  if (keyframes.length === 0) return null;
2515
2517
  const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
@@ -2578,7 +2580,7 @@ var PixodeskAnimator = (() => {
2578
2580
  !!propAnim.autoOrient
2579
2581
  );
2580
2582
  partsResult.translate = [sample.translate[0], sample.translate[1]];
2581
- if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg;
2583
+ if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg + ((_e = partsResult.rotate) != null ? _e : 0);
2582
2584
  }
2583
2585
  }
2584
2586
  cssValue = composeTransformParts(partsResult, { withUnits: false });