@glissade/lottie 0.52.1-pre.0 → 0.53.0-pre.0
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/dist/index.js +24 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1824,12 +1824,34 @@ function classify(node) {
|
|
|
1824
1824
|
return "drop";
|
|
1825
1825
|
}
|
|
1826
1826
|
const describe = (node) => `${node.describeType}${node.id !== void 0 ? ` '${node.id}'` : ""}`;
|
|
1827
|
+
/**
|
|
1828
|
+
* The Lottie anchor point (`ks.a`) honoring a node's explicit anchor. Lottie draws
|
|
1829
|
+
* a layer at `(content − a) + p`; glissade's on-screen box top-left is `P − (ax·w,
|
|
1830
|
+
* ay·h)`, so emitting `a = drawOffset + anchor·size` (= −anchorShift, node.ts) makes
|
|
1831
|
+
* the two agree AND makes the anchor the rotation/scale pivot, exactly as the scene.
|
|
1832
|
+
*
|
|
1833
|
+
* NO-OP for every currently-correct export: an unset/legacy anchor → [0,0]; a group
|
|
1834
|
+
* (no intrinsic box) → [0,0]; a CENTER anchor → drawOffset + 0.5·size = [0,0]. So
|
|
1835
|
+
* `ks.a` moves off the origin ONLY for an explicitly non-center-anchored SIZED node.
|
|
1836
|
+
* `drawOffset`/`intrinsicSize` are used (not a raw −w/2) so Text baseline / Path
|
|
1837
|
+
* author-bounds origins stay correct. The measurer is resolved as anchorShift does
|
|
1838
|
+
* (ctx's, else the node's injected source); absent it, the safe no-op [0,0].
|
|
1839
|
+
*/
|
|
1840
|
+
function anchorPoint(ctx, node) {
|
|
1841
|
+
if (!node.hasAnchor) return [0, 0];
|
|
1842
|
+
const m = ctx.measurer ?? node.measurerSource?.();
|
|
1843
|
+
if (!m) return [0, 0];
|
|
1844
|
+
const size = node.intrinsicSize(m);
|
|
1845
|
+
if (!size) return [0, 0];
|
|
1846
|
+
const d = node.drawOffset(m);
|
|
1847
|
+
const [ax, ay] = node.anchor;
|
|
1848
|
+
return [d.x + ax * size.w, d.y + ay * size.h];
|
|
1849
|
+
}
|
|
1827
1850
|
function buildTransform(ctx, node, tracks, o) {
|
|
1828
|
-
if (node.hasAnchor && (node.anchor[0] !== .5 || node.anchor[1] !== .5)) ctx.warn(`${describe(node)}: a non-center anchor is not exported (MVP centers geometry) — placement may shift`);
|
|
1829
1851
|
return {
|
|
1830
1852
|
a: {
|
|
1831
1853
|
a: 0,
|
|
1832
|
-
k:
|
|
1854
|
+
k: anchorPoint(ctx, node)
|
|
1833
1855
|
},
|
|
1834
1856
|
p: positionProp(ctx, tracks, node.position()),
|
|
1835
1857
|
s: vecProp(ctx, tracks, "scale", node.scale(), (v) => [v[0] * 100, v[1] * 100]),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/lottie",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0-pre.0",
|
|
4
4
|
"description": "glissade Lottie import (S1 MVP): pure .json (Lottie/bodymovin) → node specs + a v1 Timeline. Fail-fast feature audit; no DOM/Node dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@glissade/core": "0.
|
|
22
|
-
"@glissade/scene": "0.
|
|
21
|
+
"@glissade/core": "0.53.0-pre.0",
|
|
22
|
+
"@glissade/scene": "0.53.0-pre.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@glissade/backend-skia": "0.
|
|
25
|
+
"@glissade/backend-skia": "0.53.0-pre.0"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|