@pixodesk/svg-animator-web 1.0.29 → 1.0.30

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/README.md CHANGED
@@ -137,7 +137,7 @@ same shape as the JSON export. It comes in two modes:
137
137
  element ids to animation specs via `animator.animateById`.
138
138
 
139
139
  Elements may also carry a `node.effects` bucket (structural effects such as
140
- `transformBy`, `repeater`, `maskedBy`, `trimPath`, `clone`, `fillGradient` /
140
+ `transformBy`, `repeater`, `maskedBy`, `strokeTrim`, `clone`, `fillGradient` /
141
141
  `strokeGradient`, `textAlongPath`). This player materialises and removes them at
142
142
  runtime before any other normalisation.
143
143
 
package/dist/index.cjs CHANGED
@@ -83,6 +83,7 @@ __export(index_exports, {
83
83
  PxRepeaterEffectSchema: () => PxRepeaterEffectSchema,
84
84
  PxRetimeEffectSchema: () => PxRetimeEffectSchema,
85
85
  PxStrokeGradientEffectSchema: () => PxStrokeGradientEffectSchema,
86
+ PxStrokeTrimEffectSchema: () => PxStrokeTrimEffectSchema,
86
87
  PxSvgNodeExtra: () => PxSvgNodeExtra,
87
88
  PxTextEffectSchema: () => PxTextEffectSchema,
88
89
  PxTextPathEffectSchema: () => PxTextPathEffectSchema,
@@ -90,7 +91,6 @@ __export(index_exports, {
90
91
  PxTransformPartsSchema: () => PxTransformPartsSchema,
91
92
  PxTransformValueSchema: () => PxTransformValueSchema,
92
93
  PxTriggerSchema: () => PxTriggerSchema,
93
- PxTrimPathEffectSchema: () => PxTrimPathEffectSchema,
94
94
  STYLE_ATTR_NAMES: () => STYLE_ATTR_NAMES,
95
95
  TRANSFORM_FN_NAMES: () => TRANSFORM_FN_NAMES,
96
96
  applyPlayerEffects: () => applyPlayerEffects,
@@ -1162,7 +1162,7 @@ var PxTextPathSpacing = {
1162
1162
  auto: "auto",
1163
1163
  exact: "exact"
1164
1164
  };
1165
- var PxTrimSubPaths = {
1165
+ var PxStrokeTrimSubPaths = {
1166
1166
  separate: "separate",
1167
1167
  combined: "combined"
1168
1168
  };
@@ -1404,10 +1404,10 @@ var PxClipPathEffectSchema = implementsInterface()(px.object({
1404
1404
  d: PxAnimatableStringSchema.optional(),
1405
1405
  animate: PxPropertyAnimationSchema.optional()
1406
1406
  }));
1407
- var PxTrimPathEffectSchema = implementsInterface()(px.object({
1407
+ var PxStrokeTrimEffectSchema = implementsInterface()(px.object({
1408
1408
  offset: PxAnimatableNumberSchema.optional(),
1409
1409
  range: PxAnimatableVec2Schema.optional(),
1410
- subPaths: px.enum([PxTrimSubPaths.separate, PxTrimSubPaths.combined]).optional()
1410
+ subPaths: px.enum([PxStrokeTrimSubPaths.separate, PxStrokeTrimSubPaths.combined]).optional()
1411
1411
  }));
1412
1412
  var PxRetimeEffectSchema = implementsInterface()(px.object({
1413
1413
  sourceId: px.string().optional(),
@@ -1461,7 +1461,7 @@ var PxEffectsSchema = implementsInterface()(px.object({
1461
1461
  repeater: PxRepeaterEffectSchema.optional(),
1462
1462
  maskedBy: PxMaskedByEffectSchema.optional(),
1463
1463
  clipPath: PxClipPathEffectSchema.optional(),
1464
- trimPath: PxTrimPathEffectSchema.optional(),
1464
+ strokeTrim: PxStrokeTrimEffectSchema.optional(),
1465
1465
  clone: PxCloneEffectSchema.optional(),
1466
1466
  fillGradient: PxFillGradientEffectSchema.optional(),
1467
1467
  strokeGradient: PxStrokeGradientEffectSchema.optional(),
@@ -5099,9 +5099,9 @@ function applyTextGlyphsAlongPath(node, ctx, pathD, startOffset, textLength, pat
5099
5099
  }
5100
5100
  return materialiseGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
5101
5101
  }
5102
- function applyTrimPathEffect(node, trimPath, ctx) {
5103
- if (!trimPath) return node;
5104
- const combined = trimPath.subPaths === PxTrimSubPaths.combined;
5102
+ function applyStrokeTrimEffect(node, strokeTrim, ctx) {
5103
+ if (!strokeTrim) return node;
5104
+ const combined = strokeTrim.subPaths === PxStrokeTrimSubPaths.combined;
5105
5105
  const leafEntries = [];
5106
5106
  const measure = (n) => {
5107
5107
  if (Array.isArray(n.children) && n.children.length > 0) {
@@ -5132,9 +5132,9 @@ function applyTrimPathEffect(node, trimPath, ctx) {
5132
5132
  }
5133
5133
  const chainLengthPx = acc;
5134
5134
  if (combined && chainLengthPx < 1e-3) return node;
5135
- const offsetReadRaw = readAnimatable(trimPath.offset);
5135
+ const offsetReadRaw = readAnimatable(strokeTrim.offset);
5136
5136
  const offsetRead = offsetReadRaw.kind === "absent" ? { kind: "static", value: 0 } : offsetReadRaw;
5137
- const rangeReadRaw = readRangeWithCrossings(trimPath.range);
5137
+ const rangeReadRaw = readRangeWithCrossings(strokeTrim.range);
5138
5138
  const rangeRead = rangeReadRaw.kind === "absent" ? { kind: "static", value: [0, 1] } : rangeReadRaw;
5139
5139
  const offsetValues = readScalarValues(offsetRead);
5140
5140
  const minOffset = offsetValues.length ? Math.min(...offsetValues) : 0;
@@ -5464,7 +5464,7 @@ function applyPlayerEffects_exceptRetime(node, ctx) {
5464
5464
  const originalId = typeof node.id === "string" ? node.id : void 0;
5465
5465
  const innerIdForContentRef = originalId ? ctx.contentRefInnerIds.get(originalId) : void 0;
5466
5466
  if (!fx && !innerIdForContentRef) return node;
5467
- const { transformBy, repeater, maskedBy, clipPath, trimPath, clone: cloneFx, fillGradient, strokeGradient, textPath, text } = fx != null ? fx : {};
5467
+ const { transformBy, repeater, maskedBy, clipPath, strokeTrim, clone: cloneFx, fillGradient, strokeGradient, textPath, text } = fx != null ? fx : {};
5468
5468
  if (fx) delete node.effects;
5469
5469
  let n = node;
5470
5470
  let consumedByGlyphs = false;
@@ -5484,7 +5484,7 @@ function applyPlayerEffects_exceptRetime(node, ctx) {
5484
5484
  if (!consumedByGlyphs) n = applyTextPathEffect(n, textPath, ctx);
5485
5485
  n = applyFillGradientEffect(n, fillGradient, ctx);
5486
5486
  n = applyStrokeGradientEffect(n, strokeGradient, ctx);
5487
- n = applyTrimPathEffect(n, trimPath, ctx);
5487
+ n = applyStrokeTrimEffect(n, strokeTrim, ctx);
5488
5488
  n = applyRepeaterEffect(n, repeater, ctx);
5489
5489
  n = applyMaskedByEffect(n, maskedBy, transformBy, ctx);
5490
5490
  n = applyClipPathEffect(n, clipPath, ctx);
@@ -7129,6 +7129,7 @@ if (typeof window !== "undefined") {
7129
7129
  PxRepeaterEffectSchema,
7130
7130
  PxRetimeEffectSchema,
7131
7131
  PxStrokeGradientEffectSchema,
7132
+ PxStrokeTrimEffectSchema,
7132
7133
  PxSvgNodeExtra,
7133
7134
  PxTextEffectSchema,
7134
7135
  PxTextPathEffectSchema,
@@ -7136,7 +7137,6 @@ if (typeof window !== "undefined") {
7136
7137
  PxTransformPartsSchema,
7137
7138
  PxTransformValueSchema,
7138
7139
  PxTriggerSchema,
7139
- PxTrimPathEffectSchema,
7140
7140
  STYLE_ATTR_NAMES,
7141
7141
  TRANSFORM_FN_NAMES,
7142
7142
  applyPlayerEffects,