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

Function flatKeyframes

packages/cli/src/commands/keyframes.ts:144–164  ·  view source on GitHub ↗
(anim: GsapAnimation)

Source from the content-addressed store, hash-verified

142// element's rest pose so the surfaced keyframes are uniform. `from()` goes
143// fromProperties → base; `to()` goes base → properties.
144function flatKeyframes(anim: GsapAnimation): KeyframePoint[] {
145 if (anim.method === "fromTo") {
146 return [
147 { pct: 0, time: 0, properties: anim.fromProperties ?? {} },
148 { pct: 100, time: 0, properties: anim.properties ?? {} },
149 ];
150 }
151 // to()/from() vars both live in anim.properties; from() plays them in reverse
152 // against the element's rest pose.
153 const vars = anim.properties ?? {};
154 const base = baseProps(vars);
155 return anim.method === "from"
156 ? [
157 { pct: 0, time: 0, properties: vars },
158 { pct: 100, time: 0, properties: base },
159 ]
160 : [
161 { pct: 0, time: 0, properties: base },
162 { pct: 100, time: 0, properties: vars },
163 ];
164}
165
166// Studio-internal markers that aren't user motion: the position-hold `set` GSAP
167// runs before a keyframed position tween (`data: "hf-hold"`).

Callers 1

surfaceTweenFunction · 0.85

Calls 1

basePropsFunction · 0.85

Tested by

no test coverage detected