Skip to content

Commit fe1de56

Browse files
feat(sdk,studio): ws-1.1 — add set method to GsapTweenSpec; route addGsapAnimation(set) through sdk
Co-authored-by: Miguel Ángel <[email protected]>
1 parent 884b244 commit fe1de56

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

‎packages/sdk/src/types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export interface ElasticHold {
113113
}
114114

115115
export interface GsapTweenSpec {
116-
method: "from" | "to" | "fromTo";
116+
method: "from" | "to" | "fromTo" | "set";
117117
position?: number | string;
118118
duration?: number;
119119
ease?: string;

‎packages/studio/src/hooks/useGsapAnimationOps.ts‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,18 @@ export function useGsapAnimationOps({
126126
fromTo: { x: 0, y: 0, opacity: 1 },
127127
};
128128

129-
// SDK path: addGsapTween only supports from/to/fromTo; "set" stays
130-
// server-side. Skip the SDK path when an id was just assigned server-side
131-
// (autoId): the SDK session hasn't reloaded that write yet, so persisting
132-
// its serialization would clobber the new id — let the server add the
133-
// tween atomically with the id it wrote.
134-
if (!autoId && method !== "set" && selection.hfId && sdkSession && sdkDeps) {
129+
// Skip SDK path when an id was just assigned server-side (autoId): the
130+
// SDK session hasn't reloaded that write yet, so persisting its
131+
// serialization would clobber the new id — let the server add the tween
132+
// atomically with the id it wrote.
133+
if (!autoId && selection.hfId && sdkSession && sdkDeps) {
135134
const targetPath = selection.sourceFile || activeCompPath || "index.html";
136135
const spec = {
137-
method: method as "to" | "from" | "fromTo",
136+
method,
138137
position,
139-
duration,
140-
ease: "power2.out" as const,
138+
...(method !== "set" ? { duration, ease: "power2.out" as const } : {}),
141139
properties: toDefaults[method] ?? { opacity: 1 },
142-
fromProperties: method === "fromTo" ? { opacity: 0 } : undefined,
140+
...(method === "fromTo" ? { fromProperties: { opacity: 0 } } : {}),
143141
};
144142
const handled = await sdkGsapTweenPersist(
145143
targetPath,

0 commit comments

Comments
 (0)