@motion.page/sdk 1.2.3 → 1.2.4
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/core/Animation.d.ts +7 -0
- package/dist/core/PropTween.d.ts +41 -2
- package/dist/core/Timeline.d.ts +6 -0
- package/dist/index.cjs +19 -17
- package/dist/index.js +19 -17
- package/dist/render/CSSRenderer.d.ts +7 -0
- package/dist/triggers/PinManager.d.ts +26 -0
- package/dist/triggers/ScrollTrigger.d.ts +7 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/utils/PropertyParser/constants.d.ts +3 -0
- package/dist/utils/PropertyParser/index.d.ts +1 -1
- package/dist/utils/PropertyParser/predicates.d.ts +20 -0
- package/dist/utils/PropertyParser/types.d.ts +14 -1
- package/package.json +1 -1
package/dist/core/Animation.d.ts
CHANGED
|
@@ -226,6 +226,13 @@ export declare class Animation {
|
|
|
226
226
|
* @internal - Use only within sdk package for property inspection (e.g. captureStartValues).
|
|
227
227
|
*/
|
|
228
228
|
getFirstPropTween(): PropTween | null;
|
|
229
|
+
/**
|
|
230
|
+
* Mark motion-path geometry stale on every prop tween so the geometry-dependent
|
|
231
|
+
* offsets re-resolve on the next render. Called after a layout-shifting event
|
|
232
|
+
* (window.load / resize ScrollTrigger refresh) so paths aligned to an
|
|
233
|
+
* asynchronously-sized target settle onto the correct position.
|
|
234
|
+
*/
|
|
235
|
+
invalidatePathGeometry(): void;
|
|
229
236
|
/**
|
|
230
237
|
* Add a property tween to the linked list
|
|
231
238
|
*/
|
package/dist/core/PropTween.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { ParsedFilterFunction } from '../utils/FilterParser';
|
|
|
10
10
|
import type { ParsedDrawSVG } from '../utils/DrawSVGParser';
|
|
11
11
|
import type { ParsedClipPath } from '../utils/ClipPathParser';
|
|
12
12
|
import { type PathPoint } from '../utils/PathParser';
|
|
13
|
-
type PropTweenValueType = 'scalar' | 'color' | 'filter' | 'drawSVG' | 'path' | 'clipPath';
|
|
13
|
+
type PropTweenValueType = 'scalar' | 'string' | 'color' | 'filter' | 'drawSVG' | 'path' | 'clipPath';
|
|
14
14
|
export declare class PropTween {
|
|
15
15
|
target: AnimationTarget | null;
|
|
16
16
|
property: string;
|
|
@@ -22,6 +22,8 @@ export declare class PropTween {
|
|
|
22
22
|
endUnit: string | null;
|
|
23
23
|
next: PropTween | null;
|
|
24
24
|
valueType: PropTweenValueType;
|
|
25
|
+
startString: string;
|
|
26
|
+
endString: string;
|
|
25
27
|
startColor: Float32Array | null;
|
|
26
28
|
endColor: Float32Array | null;
|
|
27
29
|
changeColor: Float32Array;
|
|
@@ -46,11 +48,22 @@ export declare class PropTween {
|
|
|
46
48
|
y: number;
|
|
47
49
|
} | null;
|
|
48
50
|
pathLUT: PathPoint[] | null;
|
|
51
|
+
pathAlignTarget: string | Element | null;
|
|
52
|
+
pathAlignAt: [number, number] | null;
|
|
53
|
+
pathTarget: string | Element | null;
|
|
54
|
+
pathScaleX: number;
|
|
55
|
+
pathScaleY: number;
|
|
49
56
|
private _isElement;
|
|
57
|
+
private _pathGeomResolved;
|
|
50
58
|
/**
|
|
51
59
|
* Initialize the PropTween with scalar values
|
|
52
60
|
*/
|
|
53
61
|
init(target: AnimationTarget, property: string, startValue: number, endValue: number, unit?: string, startUnit?: string, endUnit?: string): this;
|
|
62
|
+
/**
|
|
63
|
+
* Initialize the PropTween with a compound CSS string value
|
|
64
|
+
* (transform-origin, background-position, …).
|
|
65
|
+
*/
|
|
66
|
+
initString(target: AnimationTarget, property: string, startString: string, endString: string): this;
|
|
54
67
|
/**
|
|
55
68
|
* Initialize the PropTween with color values
|
|
56
69
|
*/
|
|
@@ -80,7 +93,33 @@ export declare class PropTween {
|
|
|
80
93
|
}, pathScale?: {
|
|
81
94
|
x: number;
|
|
82
95
|
y: number;
|
|
83
|
-
}): this;
|
|
96
|
+
}, alignTarget?: string | Element, alignAt?: [number, number], pathTarget?: string | Element): this;
|
|
97
|
+
/**
|
|
98
|
+
* Sample the path into the lookup table at the given user-unit -> screen-px scale.
|
|
99
|
+
* Releases any previously-held LUT back to the pool before re-sampling.
|
|
100
|
+
*/
|
|
101
|
+
private _buildPathLUT;
|
|
102
|
+
/**
|
|
103
|
+
* Resolve the geometry-dependent path offsets (alignOffset/pathOffset/pathScale)
|
|
104
|
+
* against the live, laid-out element.
|
|
105
|
+
*
|
|
106
|
+
* The offsets are first computed at parse time, but a target sized asynchronously
|
|
107
|
+
* (Lottie injecting its <svg>, lazy-loaded <img>, web-font reflow) can report a
|
|
108
|
+
* 0×0 / 0-height box then. That bakes `alignOffset = {x: w/2, y: 0}` — anchoring
|
|
109
|
+
* the element by its TOP edge instead of its CENTER — which is invisible on the
|
|
110
|
+
* straight runs of a path but drifts the element off curves (where it rotates).
|
|
111
|
+
*
|
|
112
|
+
* We therefore defer: each frame until the element has a real (non-degenerate)
|
|
113
|
+
* box, recompute from the live geometry, then lock in. Once resolved there is no
|
|
114
|
+
* per-frame cost. Only aligned DOM-element motion paths participate; raw path-data
|
|
115
|
+
* or plain-object targets keep their parse-time values unchanged.
|
|
116
|
+
*/
|
|
117
|
+
private _resolvePathGeometryIfNeeded;
|
|
118
|
+
/**
|
|
119
|
+
* Mark the path geometry stale so it re-resolves on the next render. Called when
|
|
120
|
+
* layout may have shifted (window.load / resize ScrollTrigger refresh).
|
|
121
|
+
*/
|
|
122
|
+
invalidatePathGeometry(): void;
|
|
84
123
|
/**
|
|
85
124
|
* Render the property at given progress (0-1)
|
|
86
125
|
*/
|
package/dist/core/Timeline.d.ts
CHANGED
|
@@ -385,6 +385,12 @@ export declare class Timeline {
|
|
|
385
385
|
* @internal
|
|
386
386
|
*/
|
|
387
387
|
getFirstChildAnimation(): Animation | null;
|
|
388
|
+
/**
|
|
389
|
+
* Propagate a motion-path geometry invalidation to every descendant animation,
|
|
390
|
+
* so aligned path offsets re-resolve against post-layout geometry on the next
|
|
391
|
+
* render. Called from ScrollTrigger.refresh() (window.load / resize).
|
|
392
|
+
*/
|
|
393
|
+
invalidatePathGeometry(): void;
|
|
388
394
|
/**
|
|
389
395
|
* Get first child builder (for split-aware trigger target resolution).
|
|
390
396
|
* When text splitting is active, the builder holds original pre-split targets.
|