mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
feat(sdk,studio): ws-1.1 — add set method to GsapTweenSpec; route addGsapAnimation(set) through sdk (#1497)
Co-authored-by: Miguel Ángel <miguel07alm@protonmail.com>
This commit is contained in:
co-authored by
Miguel Ángel
parent
e35846176e
commit
a5016ed416
@@ -113,7 +113,7 @@ export interface ElasticHold {
|
||||
}
|
||||
|
||||
export interface GsapTweenSpec {
|
||||
method: "from" | "to" | "fromTo";
|
||||
method: "from" | "to" | "fromTo" | "set";
|
||||
position?: number | string;
|
||||
duration?: number;
|
||||
ease?: string;
|
||||
|
||||
@@ -126,20 +126,18 @@ export function useGsapAnimationOps({
|
||||
fromTo: { x: 0, y: 0, opacity: 1 },
|
||||
};
|
||||
|
||||
// SDK path: addGsapTween only supports from/to/fromTo; "set" stays
|
||||
// server-side. Skip the SDK path when an id was just assigned server-side
|
||||
// (autoId): the SDK session hasn't reloaded that write yet, so persisting
|
||||
// its serialization would clobber the new id — let the server add the
|
||||
// tween atomically with the id it wrote.
|
||||
if (!autoId && method !== "set" && selection.hfId && sdkSession && sdkDeps) {
|
||||
// Skip SDK path when an id was just assigned server-side (autoId): the
|
||||
// SDK session hasn't reloaded that write yet, so persisting its
|
||||
// serialization would clobber the new id — let the server add the tween
|
||||
// atomically with the id it wrote.
|
||||
if (!autoId && selection.hfId && sdkSession && sdkDeps) {
|
||||
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
||||
const spec = {
|
||||
method: method as "to" | "from" | "fromTo",
|
||||
method,
|
||||
position,
|
||||
duration,
|
||||
ease: "power2.out" as const,
|
||||
...(method !== "set" ? { duration, ease: "power2.out" as const } : {}),
|
||||
properties: toDefaults[method] ?? { opacity: 1 },
|
||||
fromProperties: method === "fromTo" ? { opacity: 0 } : undefined,
|
||||
...(method === "fromTo" ? { fromProperties: { opacity: 0 } } : {}),
|
||||
};
|
||||
const handled = await sdkGsapTweenPersist(
|
||||
targetPath,
|
||||
|
||||
Reference in New Issue
Block a user