| 183 | * @since 4.2.0 |
| 184 | */ |
| 185 | export 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 |