MCPcopy Create free account
hub / github.com/adobe/react-spectrum / emitKeyframes

Function emitKeyframes

packages/@react-spectrum/ai/src/loader/react.tsx:107–118  ·  view source on GitHub ↗
(name: string, stops: Stop[], total: number)

Source from the content-addressed store, hash-verified

105type Stop = {f: number; decl: string; ease?: readonly number[] | null};
106
107function emitKeyframes(name: string, stops: Stop[], total: number) {
108 let body = '';
109 let lastPct: string | null = null;
110 for (const s of stops) {
111 const p = pct(s.f, total);
112 if (p === lastPct) continue;
113 lastPct = p;
114 const ease = s.ease ? `animation-timing-function:${cb(s.ease)};` : '';
115 body += `${p}{${s.decl}${ease}}`;
116 }
117 return `@keyframes ${name}{${body}}`;
118}
119
120// Use the individual `translate`/`scale` transform properties so the drop and
121// the pop can animate on the same element without clobbering one another.

Callers 3

cellYKeyframesFunction · 0.85
cellScaleKeyframesFunction · 0.85
groupOpacityKeyframesFunction · 0.85

Calls 2

pctFunction · 0.85
cbFunction · 0.70

Tested by

no test coverage detected