MCPcopy Create free account
hub / github.com/pomber/code-surfer / scaleToFocus

Function scaleToFocus

packs/standalone/src/animation.ts:176–196  ·  view source on GitHub ↗
(
  stepPair: Tuple<Step>,
  dimensions?: Dimensions
)

Source from the content-addressed store, hash-verified

174}
175
176export function scaleToFocus(
177 stepPair: Tuple<Step>,
178 dimensions?: Dimensions
179): Animation<number> {
180 if (!dimensions) {
181 return () => 1;
182 }
183
184 const [prev, next] = stepPair.spread();
185
186 const prevZoom = getZoom(prev, dimensions);
187 const nextZoom = getZoom(next, dimensions);
188
189 return t =>
190 tween(
191 prevZoom || nextZoom!,
192 nextZoom || prevZoom!,
193 t,
194 easing.easeInOutQuad
195 );
196}
197
198//
199

Callers 1

CodeSurferContentFunction · 0.90

Calls 3

getZoomFunction · 0.85
tweenFunction · 0.85
spreadMethod · 0.80

Tested by

no test coverage detected