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

Function keyframesFor

packages/@react-spectrum/ai/src/loader/react.tsx:208–224  ·  view source on GitHub ↗
(cells: Cell[], isReducedMotion: boolean)

Source from the content-addressed store, hash-verified

206const cssCache = new WeakMap<object, string>();
207const reducedMotionCssCache = new WeakMap<object, string>();
208function keyframesFor(cells: Cell[], isReducedMotion: boolean): string {
209 let cache = isReducedMotion ? reducedMotionCssCache : cssCache;
210 let css = cache.get(cells);
211 if (css === undefined) {
212 const id = iconId(cells);
213 const total = loopFramesFor(cells);
214 css =
215 cells
216 .map(
217 (c, i) =>
218 cellYKeyframes(`${id}-${i}-y`, c, total) + cellScaleKeyframes(`${id}-${i}-s`, c, total)
219 )
220 .join('') + groupOpacityKeyframes(`${id}-group-o`, total, isReducedMotion);
221 cache.set(cells, css);
222 }
223 return css;
224}
225
226export interface PixelLoaderProps {
227 /**

Callers 1

PixelLoaderFunction · 0.85

Calls 6

iconIdFunction · 0.85
loopFramesForFunction · 0.85
cellYKeyframesFunction · 0.85
cellScaleKeyframesFunction · 0.85
groupOpacityKeyframesFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected