MCPcopy Create free account
hub / github.com/Effect-TS/effect / timing

Function timing

packages/ui/native/src/kit/Animation.ts:185–199  ·  view source on GitHub ↗
(options?: {
  readonly duration?: number | undefined
  readonly easing?: ((t: number) => number) | undefined
  readonly delay?: number | undefined
})

Source from the content-addressed store, hash-verified

183 * @since 4.2.0
184 */
185export const timing = (options?: {
186 readonly duration?: number | undefined
187 readonly easing?: ((t: number) => number) | undefined
188 readonly delay?: number | undefined
189}): Transition => {
190 const easing = options?.easing ?? easeInOut
191 const count = Math.round((options?.duration ?? 300) / frame)
192 const frames: Array<number> = []
193 for (let i = Math.round((options?.delay ?? 0) / frame); i > 0; i--) {
194 frames.push(0)
195 }
196 for (let i = 0; i < count; i++) frames.push(easing(i / count))
197 frames.push(easing(1))
198 return { config: { type: "frames", frames, iterations: 1 } }
199}
200
201/**
202 * Animates with a spring. The defaults match React Native's

Callers 1

updateFunction · 0.85

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected