@pixodesk/svg-animator-core 1.0.34 → 1.0.35
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 +7 -7
- package/dist/index.cjs +1054 -436
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1363 -691
- package/dist/index.d.ts +1363 -691
- package/dist/index.js +1014 -433
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,14 +51,14 @@ runtime crash on a non-browser platform.
|
|
|
51
51
|
| Area | Exports |
|
|
52
52
|
|---|---|
|
|
53
53
|
| **Schema & types** | `PxAnimatedSvgDocumentSchema`, `PxNodeSchema`, `PxEffectsSchema`, … plus every `Px*` TypeScript type and the `px` schema builder |
|
|
54
|
-
| **Validation** | `isPxElementFileFormat`, `isPxElementFileFormatDeep`, `validateNodeEffects` |
|
|
54
|
+
| **Validation** | `validateDocument` (the whole document, strict), `isPxElementFileFormat`, `isPxElementFileFormatDeep`, `validateNodeEffects` |
|
|
55
55
|
| **Materialisers** | `materialiseAllInTree`, `applyPlayerEffects`, `materialiseInternalLoopsInTree`, `materialiseMotionPathsInTree`, `materialiseAnimatedUseInstances` |
|
|
56
56
|
| **Interpolation** | `calcAnimationValues`, `interpolateValue`, `getNormalisedBindings` |
|
|
57
57
|
| **Sampling / geometry** | `createPathSampler`, `evaluateMotionPathSegment`, bezier helpers, `cubicBezier`, `splitEasing` |
|
|
58
58
|
| **Text** | `materialiseGlyphText`, `layoutGlyphTextChars`, `extendedPathForBrowser` |
|
|
59
59
|
| **Node helpers** | `getNormalizedProps`, `sanitiseAttributeValue`, `resolveStyle`, `generateNewIds` |
|
|
60
60
|
| **Playback engine** | `createBasicFrameLoopAnimator` + the `PxPlatformAdapter` interface |
|
|
61
|
-
| **Wire enums** | `PxAnimatorMode`, `
|
|
61
|
+
| **Wire enums** | `PxAnimatorMode`, `PxTimelineEngine`, `PxLoopExtend`, `PxStrokeTrimSubPaths`, `PxMaskType`, `PxCloneType`, `PxUnits`, `PxGradientType`, `PxGradientUnits`, `PxGradientSpreadMethod`, `PxPathOverflow`, `PxLengthAdjust`, `PxTextPathMethod`, `PxTextPathSpacing` — every two-or-more-way wire selector is a named enum, not a bare string |
|
|
62
62
|
|
|
63
63
|
### Validating a document
|
|
64
64
|
|
|
@@ -99,21 +99,21 @@ lightweight editor document into a flat tree any renderer can walk:
|
|
|
99
99
|
sampled into plain `{translate, rotate}` keyframes.
|
|
100
100
|
4. **Animated `<use>`** — replaced by `<g>` + a deep clone with fresh ids.
|
|
101
101
|
|
|
102
|
-
Steps 3 and 4 run when `engine` is `
|
|
102
|
+
Steps 3 and 4 run when `engine` is `native`. Pass `native` for **any renderer
|
|
103
103
|
without live `<use>` propagation** — that includes `react-native-svg` — and
|
|
104
|
-
`
|
|
104
|
+
`js` only for the DOM, which resolves `<use>` references natively.
|
|
105
105
|
|
|
106
106
|
```ts
|
|
107
107
|
import {
|
|
108
108
|
materialiseAllInTree, generateNewIds, calcAnimationValues,
|
|
109
|
-
getNormalisedBindings,
|
|
109
|
+
getNormalisedBindings, PxTimelineEngine,
|
|
110
110
|
} from '@pixodesk/svg-animator-core';
|
|
111
111
|
|
|
112
112
|
// Flatten once …
|
|
113
|
-
const flat = generateNewIds(materialiseAllInTree(doc,
|
|
113
|
+
const flat = generateNewIds(materialiseAllInTree(doc, PxTimelineEngine.native));
|
|
114
114
|
|
|
115
115
|
// … then ask for values at any time, with no renderer involved.
|
|
116
|
-
for (const binding of getNormalisedBindings(flat,
|
|
116
|
+
for (const binding of getNormalisedBindings(flat, PxTimelineEngine.js) ?? []) {
|
|
117
117
|
const values = calcAnimationValues(binding.animate, 500); // t = 500 ms
|
|
118
118
|
console.log(binding.id, values); // → { opacity: '0.5', transform: 'translate(…)' }
|
|
119
119
|
}
|