Skip to content

Commit 22c3263

Browse files
authored
feat: add delay property to animations in README and migration guidelines (#9)
1 parent 089365f commit 22c3263

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Timing animations transition from one value to another over a fixed duration wit
100100
| ---------- | ------------ | ------------- | ------------------------------------------------------------------------ |
101101
| `duration` | `number` | `300` | Duration in milliseconds |
102102
| `easing` | `EasingType` | `'easeInOut'` | Easing curve (preset name or `[x1, y1, x2, y2]` cubic bezier) |
103+
| `delay` | `number` | `0` | Delay in milliseconds before the animation starts |
103104
| `loop` | `string` || `'repeat'` restarts from the beginning, `'reverse'` alternates direction |
104105

105106
Available easing curves:
@@ -146,6 +147,7 @@ Spring animations use a physics-based model for natural-feeling motion. Great fo
146147
| `damping` | `number` | `15` | Friction — higher values reduce oscillation |
147148
| `stiffness` | `number` | `120` | Spring constant — higher values mean faster animation |
148149
| `mass` | `number` | `1` | Mass of the object — higher values mean slower, more momentum |
150+
| `delay` | `number` | `0` | Delay in milliseconds before the animation starts |
149151

150152
Spring presets for common feels:
151153

@@ -276,6 +278,26 @@ Use `initialAnimate` to set starting values. On mount, the view starts at `initi
276278

277279
Without `initialAnimate`, the view renders at the `animate` values immediately with no animation on mount.
278280

281+
### Delay
282+
283+
Use `delay` to postpone the start of an animation. This is useful for staggering enter animations across multiple elements.
284+
285+
```tsx
286+
// Staggered fade-in list
287+
{items.map((item, i) => (
288+
<EaseView
289+
key={item.id}
290+
initialAnimate={{ opacity: 0, translateY: 20 }}
291+
animate={{ opacity: 1, translateY: 0 }}
292+
transition={{ type: 'timing', duration: 300, delay: i * 100 }}
293+
>
294+
<Text>{item.label}</Text>
295+
</EaseView>
296+
))}
297+
```
298+
299+
`delay` works with both timing and spring transitions.
300+
279301
### Interruption
280302

281303
Animations are interruptible by default. If you change `animate` values while an animation is running, it smoothly redirects to the new target from wherever it currently is — no jumping or restarting.
@@ -386,6 +408,7 @@ Properties not specified in `animate` default to their identity values.
386408
type: 'timing';
387409
duration?: number; // default: 300 (ms)
388410
easing?: EasingType; // default: 'easeInOut' — preset name or [x1, y1, x2, y2]
411+
delay?: number; // default: 0 (ms)
389412
loop?: 'repeat' | 'reverse'; // default: none
390413
}
391414
```
@@ -398,6 +421,7 @@ Properties not specified in `animate` default to their identity values.
398421
damping?: number; // default: 15
399422
stiffness?: number; // default: 120
400423
mass?: number; // default: 1
424+
delay?: number; // default: 0 (ms)
401425
}
402426
```
403427

skills/react-native-ease-refactor/SKILL.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ Apply these checks in order. The first match determines the result:
5252
2. **Uses scroll handler?** (`useAnimatedScrollHandler`, `onScroll` with `Animated.event`) → NOT migratable — "Scroll-driven animation"
5353
3. **Uses shared element transitions?** (`sharedTransitionTag`) → NOT migratable — "Shared element transition"
5454
4. **Uses `runOnUI` or worklet directives?** → NOT migratable — "Requires worklet runtime"
55-
5. **Uses `withSequence` or `withDelay`?** → NOT migratable — "Animation sequencing not supported"
55+
5. **Uses `withSequence`?** → NOT migratable — "Animation sequencing not supported"
56+
5b. **Uses `withDelay` wrapping a single animation (`withTiming`/`withSpring`)?** → MIGRATABLE — map to `delay` on the transition
57+
5c. **Uses `withDelay` wrapping `withSequence` or nested `withDelay`?** → NOT migratable — "Complex delay/sequencing not supported"
5658
6. **Uses complex `interpolate()`?** (more than 2 input/output values) → NOT migratable — "Complex interpolation"
5759
7. **Uses `layout={...}` prop?** → NOT migratable — "Layout animation"
5860
8. **Animates unsupported properties?** (anything besides: opacity, translateX, translateY, scale, scaleX, scaleY, rotate, rotateX, rotateY, borderRadius, backgroundColor) → NOT migratable — "Animates unsupported property: `<prop>`"
@@ -83,6 +85,8 @@ Use this table to convert Reanimated/Animated patterns to EaseView:
8385
| `Easing.bezier(x1, y1, x2, y2)` | `easing: [x1, y1, x2, y2]` |
8486
| `Animated.Value` + `Animated.timing` | Same `animate` + `transition` pattern — convert to state-driven |
8587
| `Animated.Value` + `Animated.spring` | `animate` + `transition={{ type: 'spring' }}` — convert to state-driven |
88+
| `withDelay(ms, withTiming(...))` or `withDelay(ms, withSpring(...))` | `transition={{ ..., delay: ms }}` — add `delay` to the transition config |
89+
| `entering={FadeIn.delay(ms)}` / any entering preset with `.delay()` | `initialAnimate` + `animate` + `transition={{ ..., delay: ms }}` |
8690

8791
### Default Value Mapping
8892

@@ -360,6 +364,7 @@ transition={{
360364
type: 'timing',
361365
duration: 300, // ms, default 300
362366
easing: 'easeInOut', // 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | [x1,y1,x2,y2]
367+
delay: 0, // ms, default 0
363368
loop: 'repeat', // 'repeat' | 'reverse' — requires initialAnimate
364369
}}
365370
```
@@ -372,6 +377,7 @@ transition={{
372377
damping: 15, // default 15
373378
stiffness: 120, // default 120
374379
mass: 1, // default 1
380+
delay: 0, // ms, default 0
375381
}}
376382
```
377383

@@ -394,6 +400,6 @@ transition={{ type: 'none' }}
394400

395401
- **Loop requires timing** (not spring) and `initialAnimate` must define the start value
396402
- **No per-property transitions** — one transition config applies to all animated properties
397-
- **No animation sequencing** — no equivalent to `withSequence`/`withDelay`
403+
- **No animation sequencing** — no equivalent to `withSequence`. Simple `withDelay` IS supported via the `delay` transition prop
398404
- **No gesture/scroll-driven animations** — EaseView is state-driven only
399405
- **Style/animate conflict** — if a property appears in both `style` and `animate`, the animated value wins

0 commit comments

Comments
 (0)