MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / handleAddWithKeyframes

Function handleAddWithKeyframes

packages/sdk/src/engine/mutate.ts:911–931  ·  view source on GitHub ↗
(
  parsed: ParsedDocument,
  op: Extract<EditOp, { type: "addWithKeyframes" }>,
)

Source from the content-addressed store, hash-verified

909// ─── addWithKeyframes / replaceWithKeyframes handlers ────────────────────────
910
911function handleAddWithKeyframes(
912 parsed: ParsedDocument,
913 op: Extract<EditOp, { type: "addWithKeyframes" }>,
914): MutationResult {
915 const script = getGsapScript(parsed.document);
916 if (!script) throw new Error("No GSAP script block found in the composition.");
917 // Dispatch skips validateOp — re-enforce the empty-keyframes guard here so we
918 // never emit a degenerate `keyframes: {}` tween.
919 if (op.keyframes.length === 0) return EMPTY;
920 const { script: newScript, id: animationId } = addAnimationWithKeyframesToScript(
921 script,
922 op.targetSelector,
923 op.position,
924 op.duration,
925 op.keyframes,
926 op.ease,
927 );
928 if (!animationId) return EMPTY;
929 setGsapScript(parsed.document, newScript);
930 return { ...gsapScriptChange(script, newScript), meta: { animationId } };
931}
932
933function handleReplaceWithKeyframes(
934 parsed: ParsedDocument,

Callers 1

applyGsapWithKeyframesOpFunction · 0.85

Calls 4

getGsapScriptFunction · 0.85
setGsapScriptFunction · 0.85
gsapScriptChangeFunction · 0.85

Tested by

no test coverage detected