@ericrisco/rsc 1.1.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -14
- package/manifest.json +888 -231
- package/package.json +3 -2
- package/schema/ecc-originality.json +16 -0
- package/schema/ecc-originality.u64 +0 -0
- package/scripts/build-manifest.js +43 -3
- package/scripts/doctor.js +47 -1
- package/scripts/install-apply.js +148 -31
- package/scripts/lib/capabilities.js +21 -0
- package/scripts/lib/domains.js +3 -3
- package/scripts/lib/manifest-file.js +4 -1
- package/scripts/originality-check.js +137 -0
- package/scripts/rsc.js +122 -14
- package/skills/design/SKILL.md +3 -3
- package/skills/design/references/design-systems.md +1 -1
- package/skills/design/references/inspiration-sources.md +2 -2
- package/skills/design/references/motion-and-interaction.md +2 -2
- package/skills/design-dna/evals/cases.yaml +1 -1
- package/skills/design-loop/SKILL.md +3 -3
- package/skills/design-loop/evals/cases.yaml +3 -3
- package/skills/expo/SKILL.md +1 -1
- package/skills/motion-craft/SKILL.md +125 -0
- package/skills/motion-craft/evals/cases.yaml +38 -0
- package/skills/motion-craft/scripts/verify.sh +75 -0
- package/skills/react/SKILL.md +2 -2
- package/skills/react-native/SKILL.md +1 -1
- package/skills/swift-ios/SKILL.md +2 -2
- package/skills/ui-engineering/SKILL.md +114 -0
- package/skills/ui-engineering/evals/cases.yaml +38 -0
- package/skills/variant-explorer/SKILL.md +93 -0
- package/skills/variant-explorer/evals/cases.yaml +38 -0
- package/targets/agent-catalog.js +220 -0
- package/targets/agent-sources.json +48 -0
- package/targets/agents.js +61 -13
- package/targets/commands.js +212 -0
- package/targets/memory.js +276 -0
- package/targets/opencode-memory-plugin.js +65 -0
- package/targets/session-memory-adapter.mjs +117 -0
- package/targets/session-memory-core.mjs +477 -0
- package/targets/session-memory.mjs +27 -0
- package/skills/animate/SKILL.md +0 -851
- package/skills/animate/evals/cases.yaml +0 -36
- package/skills/animate/references/recipes.md +0 -324
- package/skills/animate-expo/SKILL.md +0 -281
- package/skills/animate-expo/evals/cases.yaml +0 -36
- package/skills/animate-expo/references/recipes.md +0 -385
- package/skills/animation-vocabulary/SKILL.md +0 -189
- package/skills/animation-vocabulary/evals/cases.yaml +0 -31
- package/skills/apple-design/SKILL.md +0 -301
- package/skills/apple-design/evals/cases.yaml +0 -33
- package/skills/ask-sonner/SKILL.md +0 -104
- package/skills/ask-sonner/evals/cases.yaml +0 -33
- package/skills/ask-sonner/references/api.md +0 -64
- package/skills/design-eng/SKILL.md +0 -88
- package/skills/design-eng/evals/cases.yaml +0 -36
- package/skills/find-animation-opportunities/SKILL.md +0 -150
- package/skills/find-animation-opportunities/evals/cases.yaml +0 -31
- package/skills/improve-animations/SKILL.md +0 -126
- package/skills/improve-animations/evals/cases.yaml +0 -31
- package/skills/improve-animations/references/audit.md +0 -115
- package/skills/improve-animations/references/plan-template.md +0 -73
- package/skills/pick-ui-library/SKILL.md +0 -101
- package/skills/pick-ui-library/evals/cases.yaml +0 -33
- package/skills/pick-ui-library/references/component-galleries.md +0 -59
- package/skills/prototype/SKILL.md +0 -113
- package/skills/prototype/evals/cases.yaml +0 -31
- package/skills/prototype/references/picker.md +0 -197
- package/skills/review-animations/SKILL.md +0 -188
- package/skills/review-animations/evals/cases.yaml +0 -34
- package/skills/review-animations/references/standards.md +0 -187
- package/skills/review-animations/scripts/verify.sh +0 -164
- package/skills/write-swift/SKILL.md +0 -413
- package/skills/write-swift/evals/cases.yaml +0 -36
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
# Expo Animation Recipes
|
|
2
|
-
|
|
3
|
-
Ready-to-build implementations for the cases that come up most in a React Native app. Start from the recipe, then adapt.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Setup the recipes assume
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npx expo install react-native-reanimated react-native-worklets react-native-gesture-handler expo-haptics
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
(`react-native-keyboard-controller` only for the keyboard recipe.) `expo install`, not `npm install` — it resolves the versions that match the SDK. The worklets Babel plugin is configured by `babel-preset-expo` automatically.
|
|
14
|
-
|
|
15
|
-
`GestureHandlerRootView` wraps the app once — in Expo Router, the root `_layout`:
|
|
16
|
-
|
|
17
|
-
```jsx
|
|
18
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
19
|
-
|
|
20
|
-
export default function RootLayout() {
|
|
21
|
-
return (
|
|
22
|
-
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
23
|
-
<Stack />
|
|
24
|
-
</GestureHandlerRootView>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Imports and constants every recipe below shares:
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
import { useState, useEffect, useMemo } from 'react';
|
|
33
|
-
import Animated, {
|
|
34
|
-
useSharedValue, useAnimatedStyle, useAnimatedScrollHandler, useAnimatedReaction,
|
|
35
|
-
withSpring, withTiming, interpolate, Extrapolation, Easing,
|
|
36
|
-
FadeInDown, FadeOutDown, LinearTransition,
|
|
37
|
-
} from 'react-native-reanimated';
|
|
38
|
-
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
39
|
-
import { scheduleOnRN } from 'react-native-worklets';
|
|
40
|
-
import * as Haptics from 'expo-haptics';
|
|
41
|
-
|
|
42
|
-
const EASE_OUT = Easing.bezier(0.23, 1, 0.32, 1); // strong ease-out for UI
|
|
43
|
-
const EASE_IN_OUT = Easing.bezier(0.77, 0, 0.175, 1); // on-screen movement
|
|
44
|
-
const EASE_SHEET = Easing.bezier(0.32, 0.72, 0, 1); // iOS sheet curve
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Three conventions, explained once here instead of in every recipe:
|
|
48
|
-
|
|
49
|
-
- **Shared values are read and written with `.get()` / `.set()`**, the form the Reanimated docs recommend for React Compiler support. `.value` still works, but the compiler can't see through it.
|
|
50
|
-
- **`scheduleOnRN(fn, ...args)` replaces the deprecated `runOnJS(fn)(...args)`** for calling back to the React Native runtime from a worklet.
|
|
51
|
-
- **Gestures are wrapped in `useMemo`.** Rebuilding a gesture on every render can reattach the recognizer and drop a drag that's mid-flight.
|
|
52
|
-
|
|
53
|
-
**Gesture Handler v3:** Expo installs v2, and the recipes use its `Gesture.Pan()` builder. If the project is already on v3, the builder is legacy — each gesture is a hook taking one config object, with `onStart` → `onActivate`, `onEnd` → `onDeactivate`, and the `success` flag replaced by `event.canceled` (inverted). The hook manages its own identity, so drop the `useMemo`:
|
|
54
|
-
|
|
55
|
-
```jsx
|
|
56
|
-
const pan = usePanGesture({
|
|
57
|
-
activeOffsetY: [-10, 10],
|
|
58
|
-
onActivate: () => { context.set(translateY.get()); },
|
|
59
|
-
onUpdate: (e) => { translateY.set(context.get() + e.translationY); },
|
|
60
|
-
onDeactivate: (e) => { /* settle with withSpring as below */ },
|
|
61
|
-
});
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Two worklets you'll need everywhere
|
|
67
|
-
|
|
68
|
-
Momentum projection decides *where a flick was going*, so a fast short swipe commits and a slow long one doesn't. Rubber-banding makes a boundary resist instead of stopping dead.
|
|
69
|
-
|
|
70
|
-
```js
|
|
71
|
-
// Where the finger would come to rest if it kept decelerating.
|
|
72
|
-
// Apple's exponential-decay form — not the v²/2a from physics class.
|
|
73
|
-
function project(velocity, decelerationRate = 0.998) {
|
|
74
|
-
'worklet';
|
|
75
|
-
return ((velocity / 1000) * decelerationRate) / (1 - decelerationRate);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// The further past the edge, the less the element follows.
|
|
79
|
-
function rubberband(overshoot, dimension, constant = 0.55) {
|
|
80
|
-
'worklet';
|
|
81
|
-
return (overshoot * dimension * constant) / (dimension + constant * Math.abs(overshoot));
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Press feedback
|
|
88
|
-
|
|
89
|
-
Every pressable in the app. This passes the frequency gate only because it's near-imperceptible: 120ms and a 3% scale is the ceiling for something touched this often — anything longer or larger belongs to rarer moments, per step 1 in SKILL.md. No gesture, no shared value — a CSS transition is the whole implementation.
|
|
90
|
-
|
|
91
|
-
```jsx
|
|
92
|
-
import Animated from 'react-native-reanimated';
|
|
93
|
-
import { Pressable, StyleSheet } from 'react-native';
|
|
94
|
-
|
|
95
|
-
function PressableScale({ onPress, children }) {
|
|
96
|
-
const [pressed, setPressed] = useState(false);
|
|
97
|
-
return (
|
|
98
|
-
<Pressable
|
|
99
|
-
onPress={onPress}
|
|
100
|
-
onPressIn={() => setPressed(true)}
|
|
101
|
-
onPressOut={() => setPressed(false)}
|
|
102
|
-
hitSlop={12}
|
|
103
|
-
pressRetentionOffset={16}
|
|
104
|
-
>
|
|
105
|
-
<Animated.View style={[styles.box, pressed && styles.pressed]}>{children}</Animated.View>
|
|
106
|
-
</Pressable>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const styles = StyleSheet.create({
|
|
111
|
-
box: {
|
|
112
|
-
transform: [{ scale: 1 }],
|
|
113
|
-
transitionProperty: 'transform',
|
|
114
|
-
transitionDuration: '120ms',
|
|
115
|
-
transitionTimingFunction: 'cubic-bezier(0.23, 1, 0.32, 1)',
|
|
116
|
-
},
|
|
117
|
-
pressed: { transform: [{ scale: 0.97 }] },
|
|
118
|
-
});
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
`setState` is fine here — it fires twice per press, not per frame. `hitSlop` brings a small icon up to the 44pt target without growing it; `pressRetentionOffset` stops a slight finger drift from cancelling.
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## Bottom sheet you can drag to dismiss
|
|
126
|
-
|
|
127
|
-
Before writing this: if the sheet is its own destination, use `presentation: 'formSheet'` (see **Screen transitions**) and get the platform's real sheet for free. Build this only when the sheet has to live inside an existing screen.
|
|
128
|
-
|
|
129
|
-
```jsx
|
|
130
|
-
const translateY = useSharedValue(0);
|
|
131
|
-
const context = useSharedValue(0);
|
|
132
|
-
|
|
133
|
-
const pan = useMemo(() => Gesture.Pan()
|
|
134
|
-
.activeOffsetY([-10, 10]) // let a horizontal swipe win; require intent before committing
|
|
135
|
-
.onStart(() => {
|
|
136
|
-
context.set(translateY.get()); // start from the current on-screen value, not from 0
|
|
137
|
-
})
|
|
138
|
-
.onUpdate((e) => {
|
|
139
|
-
const next = context.get() + e.translationY;
|
|
140
|
-
// downward is free; upward past the top resists
|
|
141
|
-
translateY.set(next >= 0 ? next : rubberband(next, HEIGHT));
|
|
142
|
-
})
|
|
143
|
-
.onEnd((e) => {
|
|
144
|
-
const projected = translateY.get() + project(e.velocityY);
|
|
145
|
-
if (projected > HEIGHT * 0.4) {
|
|
146
|
-
translateY.set(withSpring(HEIGHT, {
|
|
147
|
-
duration: 300, dampingRatio: 1, velocity: e.velocityY, overshootClamping: true,
|
|
148
|
-
}, (finished) => { if (finished) scheduleOnRN(onClose); }));
|
|
149
|
-
} else {
|
|
150
|
-
translateY.set(withSpring(0, { duration: 300, dampingRatio: 0.8, velocity: e.velocityY }));
|
|
151
|
-
scheduleOnRN(Haptics.impactAsync, Haptics.ImpactFeedbackStyle.Light); // it snapped home
|
|
152
|
-
}
|
|
153
|
-
}), [onClose]);
|
|
154
|
-
|
|
155
|
-
const sheetStyle = useAnimatedStyle(() => ({ transform: [{ translateY: translateY.get() }] }));
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
The four details that separate this from a bad drag:
|
|
159
|
-
|
|
160
|
-
- **`onStart` captures the current value.** Without it, grabbing a sheet mid-animation teleports it — the animation must continue from where the eye last saw it.
|
|
161
|
-
- **Velocity decides, not distance.** `project()` means a quick flick dismisses even a few pixels down. Requiring 40% travel makes the sheet feel heavy.
|
|
162
|
-
- **Velocity is handed to the spring**, so there's no seam between the finger releasing and the animation continuing. This is the single detail that most separates "fluid" from "fine".
|
|
163
|
-
- **`overshootClamping` on dismissal** — otherwise the sheet springs past the bottom of the screen and flashes a gap.
|
|
164
|
-
|
|
165
|
-
The backdrop derives from the same value, so it's always in sync and costs nothing:
|
|
166
|
-
|
|
167
|
-
```jsx
|
|
168
|
-
const backdropStyle = useAnimatedStyle(() => ({
|
|
169
|
-
opacity: interpolate(translateY.get(), [0, HEIGHT], [1, 0], Extrapolation.CLAMP),
|
|
170
|
-
}));
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Swipe to delete a row
|
|
176
|
-
|
|
177
|
-
Before writing this: gesture-handler ships [`ReanimatedSwipeable`](https://docs.swmansion.com/react-native-gesture-handler/docs/components/reanimated_swipeable/), which already does swipe-to-reveal actions — thresholds, overshoot, open/close methods — on the UI thread. Reach for it when the row reveals action buttons. Build the gesture yourself only when the interaction is different in kind: swipe-to-commit with momentum projection, like this one.
|
|
178
|
-
|
|
179
|
-
```jsx
|
|
180
|
-
const x = useSharedValue(0);
|
|
181
|
-
const context = useSharedValue(0);
|
|
182
|
-
|
|
183
|
-
const pan = useMemo(() => Gesture.Pan()
|
|
184
|
-
.activeOffsetX([-10, 10]) // must declare the axis, or it fights the vertical scroll
|
|
185
|
-
.onStart(() => { context.set(x.get()); }) // grab mid-spring continues from where the row is, not from 0
|
|
186
|
-
.onUpdate((e) => { x.set(Math.min(0, context.get() + e.translationX)); })
|
|
187
|
-
.onEnd((e) => {
|
|
188
|
-
const projected = x.get() + project(e.velocityX);
|
|
189
|
-
if (projected < -SWIPE_THRESHOLD) {
|
|
190
|
-
x.set(withTiming(-WIDTH, { duration: 200, easing: EASE_OUT }, (f) => {
|
|
191
|
-
if (f) scheduleOnRN(onDelete, id);
|
|
192
|
-
}));
|
|
193
|
-
} else {
|
|
194
|
-
x.set(withSpring(0, { duration: 300, dampingRatio: 1, velocity: e.velocityX }));
|
|
195
|
-
}
|
|
196
|
-
}), [onDelete, id]);
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
Closing the gap the deleted row left is the list's job, not the row's:
|
|
200
|
-
|
|
201
|
-
```jsx
|
|
202
|
-
const ROW_CLOSE = LinearTransition.duration(200); // module scope — builders rebuilt in render cost every re-render
|
|
203
|
-
|
|
204
|
-
<Animated.FlatList data={items} itemLayoutAnimation={ROW_CLOSE} ... />
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
`activeOffsetX` is the mobile-specific part. A pan handler inside a scroll view with no axis declared will steal vertical scrolls, and the list will feel broken in a way that looks like a scrolling bug rather than a gesture bug.
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
## Collapsing header on scroll
|
|
212
|
-
|
|
213
|
-
```jsx
|
|
214
|
-
const scrollY = useSharedValue(0);
|
|
215
|
-
const onScroll = useAnimatedScrollHandler((e) => { scrollY.set(e.contentOffset.y); });
|
|
216
|
-
|
|
217
|
-
const titleStyle = useAnimatedStyle(() => ({
|
|
218
|
-
opacity: interpolate(scrollY.get(), [0, 60], [1, 0], Extrapolation.CLAMP),
|
|
219
|
-
transform: [{ translateY: interpolate(scrollY.get(), [0, 60], [0, -12], Extrapolation.CLAMP) }],
|
|
220
|
-
}));
|
|
221
|
-
|
|
222
|
-
<Animated.ScrollView onScroll={onScroll} scrollEventThrottle={16}>
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
**Never animate the header's `height` to collapse it.** That runs a layout pass on the header and everything below it on every scroll frame — the one animation guaranteed to stutter, because it's competing with the scroll itself. Give the container a fixed height and translate the content inside it, clipping with `overflow: 'hidden'`.
|
|
226
|
-
|
|
227
|
-
`Extrapolation.CLAMP` is not optional: without it, scrolling past 60 keeps driving opacity negative and the header reappears inverted at the bottom of a long list.
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## List entrances
|
|
232
|
-
|
|
233
|
-
```jsx
|
|
234
|
-
// The Reanimated docs recommend building layout animations outside components,
|
|
235
|
-
// or in useMemo — an inline chain in JSX rebuilds the builder on every render.
|
|
236
|
-
// A per-index delay can't live at module scope, so the row memoizes its own:
|
|
237
|
-
function Row({ item, index }) {
|
|
238
|
-
const entering = useMemo(() => FadeInDown.duration(250).delay(index * 40), [index]);
|
|
239
|
-
return <Animated.View entering={entering}>{/* ... */}</Animated.View>;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
{items.map((item, i) => <Row key={item.id} item={item} index={i} />)}
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
Stagger 30–80ms. Longer feels slow, shorter reads as simultaneous.
|
|
246
|
-
|
|
247
|
-
**Never put `entering` on a row inside `FlatList`, `FlashList`, or any virtualized list.** Rows are recycled, so the animation re-fires every time one scrolls back into view — the list appears to flicker while the user scrolls. Animate the list container once on mount, or use `itemLayoutAnimation` for reflow only.
|
|
248
|
-
|
|
249
|
-
Entrance animations are for content the user asked for and is waiting on. A list they scroll past all day should already be there.
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
## Keyboard-synced UI
|
|
254
|
-
|
|
255
|
-
Needs its own module and a one-time provider ([Expo keyboard guide](https://docs.expo.dev/guides/keyboard-handling/)):
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
npx expo install react-native-keyboard-controller
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
```jsx
|
|
262
|
-
import { KeyboardProvider } from 'react-native-keyboard-controller';
|
|
263
|
-
|
|
264
|
-
// Root _layout, next to GestureHandlerRootView — hooks below do nothing without it.
|
|
265
|
-
<KeyboardProvider>
|
|
266
|
-
<Stack />
|
|
267
|
-
</KeyboardProvider>
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
```jsx
|
|
271
|
-
import { useReanimatedKeyboardAnimation } from 'react-native-keyboard-controller';
|
|
272
|
-
|
|
273
|
-
const { height } = useReanimatedKeyboardAnimation(); // 0 → -keyboardHeight, on the UI thread
|
|
274
|
-
const footerStyle = useAnimatedStyle(() => ({ transform: [{ translateY: height.get() }] }));
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
Never build this from `Keyboard.addListener` plus a timing animation. The keyboard rides a private system curve, the event arrives on the JS thread after the keyboard has already started moving, and any duration you pick will visibly lag or lead it. The UI must be driven by the keyboard's actual position, frame by frame.
|
|
278
|
-
|
|
279
|
-
---
|
|
280
|
-
|
|
281
|
-
## Tab / segmented indicator
|
|
282
|
-
|
|
283
|
-
Measure once, then animate transforms.
|
|
284
|
-
|
|
285
|
-
```jsx
|
|
286
|
-
const [layouts, setLayouts] = useState({}); // measured with onLayout, not per frame
|
|
287
|
-
const x = useSharedValue(0);
|
|
288
|
-
const w = useSharedValue(0);
|
|
289
|
-
|
|
290
|
-
useEffect(() => {
|
|
291
|
-
const l = layouts[active];
|
|
292
|
-
if (!l) return;
|
|
293
|
-
x.set(withTiming(l.x, { duration: 250, easing: EASE_IN_OUT }));
|
|
294
|
-
w.set(withTiming(l.width, { duration: 250, easing: EASE_IN_OUT }));
|
|
295
|
-
}, [active, layouts]);
|
|
296
|
-
|
|
297
|
-
const pillStyle = useAnimatedStyle(() => ({
|
|
298
|
-
transform: [{ translateX: x.get() }],
|
|
299
|
-
width: w.get(),
|
|
300
|
-
}));
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
This is the sanctioned `width` animation: the pill is absolutely positioned with no children, so nothing else re-lays-out, and its corner radius survives — `scaleX` would smear the corners into ovals.
|
|
304
|
-
|
|
305
|
-
`ease-in-out`, because the pill is moving across the screen rather than entering or leaving it. Fire `Haptics.selectionAsync()` on the press, not when the pill lands.
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## Screen transitions (Expo Router)
|
|
310
|
-
|
|
311
|
-
Configure the native stack. Never rebuild a screen transition in JS: the native one runs on the platform side, keeps the interactive back gesture, and matches every other app on the device.
|
|
312
|
-
|
|
313
|
-
```jsx
|
|
314
|
-
<Stack screenOptions={{ animation: reduced ? 'fade' : 'default' }}>
|
|
315
|
-
<Stack.Screen name="settings" options={{ animation: 'slide_from_right', animationMatchesGesture: true }} />
|
|
316
|
-
<Stack.Screen name="compose" options={{ presentation: 'modal' }} />
|
|
317
|
-
<Stack.Screen name="filter" options={{
|
|
318
|
-
presentation: 'formSheet',
|
|
319
|
-
sheetAllowedDetents: 'fitToContents',
|
|
320
|
-
sheetGrabberVisible: true,
|
|
321
|
-
}} />
|
|
322
|
-
</Stack>
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
| Navigation | Option |
|
|
326
|
-
| --- | --- |
|
|
327
|
-
| Deeper into a hierarchy | `animation: 'default'` — the platform push, unmodified |
|
|
328
|
-
| A self-contained task the user can abandon | `presentation: 'modal'` |
|
|
329
|
-
| A short interruption: picker, filter, share | `presentation: 'formSheet'` with detents |
|
|
330
|
-
| Between tabs | `animation: 'none'` |
|
|
331
|
-
| Reduced motion | `animation: 'fade'` |
|
|
332
|
-
|
|
333
|
-
`animationMatchesGesture: true` makes the iOS back swipe run your transition in reverse under the finger, instead of the default push. Set it whenever you set a custom `animation`, or dragging back looks like a different app than pushing forward.
|
|
334
|
-
|
|
335
|
-
`formSheet` is native on both platforms, but not the same on both — the [Expo modal docs](https://docs.expo.dev/router/advanced/modals/#form-sheet-presentation) have the full list:
|
|
336
|
-
|
|
337
|
-
- **Android caps detents at three.** A longer `sheetAllowedDetents` array works on iOS and silently truncates on Android — design for three.
|
|
338
|
-
- **`sheetGrabberVisible` is iOS-only.** Android shows no grabber; don't rely on it as the only "this is draggable" affordance.
|
|
339
|
-
- **Android form sheets can't host native headers or nested stacks.** Keep the sheet's content a single screen; if it needs its own navigation, use `presentation: 'modal'` instead.
|
|
340
|
-
- **`fitToContents` needs explicitly sized content.** A `flex: 1` root has no intrinsic height to fit — size the content, or the detent is wrong.
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
## Toast
|
|
345
|
-
|
|
346
|
-
```jsx
|
|
347
|
-
// Module scope — layout-animation builders live outside the component.
|
|
348
|
-
const TOAST_ENTER = FadeInDown.duration(300).easing(EASE_OUT);
|
|
349
|
-
const TOAST_EXIT = FadeOutDown.duration(250).easing(EASE_OUT);
|
|
350
|
-
|
|
351
|
-
<Animated.View
|
|
352
|
-
entering={TOAST_ENTER}
|
|
353
|
-
exiting={TOAST_EXIT}
|
|
354
|
-
style={{ position: 'absolute', bottom: insets.bottom + 16, left: 16, right: 16 }}
|
|
355
|
-
/>
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
- **The 300ms cap holds here too.** A toast isn't an exception — it's uninvited, so if anything it should be quicker and quieter than motion the user asked for.
|
|
359
|
-
- **It exits the way it entered.** Entering from the bottom and leaving to the side reads as two unrelated elements.
|
|
360
|
-
- **Exit ~20% faster than entry.** The user has finished reading; the arrival deserves the time, the departure doesn't.
|
|
361
|
-
- **Safe area insets, always.** A toast at `bottom: 16` sits under the home indicator on every modern iPhone.
|
|
362
|
-
|
|
363
|
-
If toasts stack and the list reflows, add `itemLayoutAnimation` and expect to tune the opacity against the reflow by eye — there's no formula for that pair. Look at it again the next day.
|
|
364
|
-
|
|
365
|
-
---
|
|
366
|
-
|
|
367
|
-
## Firing something once at a threshold
|
|
368
|
-
|
|
369
|
-
When a crossing point matters — a detent, a snap, a pull-to-refresh arming — don't poll it from JS and don't `scheduleOnRN` every frame.
|
|
370
|
-
|
|
371
|
-
```jsx
|
|
372
|
-
const armed = useSharedValue(false);
|
|
373
|
-
|
|
374
|
-
useAnimatedReaction(
|
|
375
|
-
() => pullDistance.get() > REFRESH_THRESHOLD,
|
|
376
|
-
(isArmed, wasArmed) => {
|
|
377
|
-
if (isArmed !== wasArmed) {
|
|
378
|
-
armed.set(isArmed);
|
|
379
|
-
scheduleOnRN(Haptics.impactAsync, Haptics.ImpactFeedbackStyle.Light);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
);
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
The comparison runs on the UI thread every frame; the JS call happens twice per pull. That's the pattern for every "do something when the animation reaches X".
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: animation-vocabulary
|
|
3
|
-
description: "Reverse glossary: turn a vague description of a motion effect into its exact name — a popover growing from its trigger is origin-aware, iOS overscroll is rubber-banding, items appearing one after another with a delay is a stagger. Use for \"what's it called when…\" or \"what do you call it when…\"."
|
|
4
|
-
tags: [motion, animation, glossary, terminology, naming]
|
|
5
|
-
recommends: [animate, apple-design]
|
|
6
|
-
profiles: [full]
|
|
7
|
-
origin: emilkowalski (MIT, adapted)
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Animation Vocabulary
|
|
11
|
-
|
|
12
|
-
Turn a vague description of a motion or effect into the precise term, so the user knows what to ask for.
|
|
13
|
-
|
|
14
|
-
## Quick Start
|
|
15
|
-
|
|
16
|
-
The user describes an effect loosely. You return the matching term(s) in this format:
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
**Stagger** — Animate several items one after another with a small delay between each, creating a cascade.
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
If several terms could fit, list the best match first, then 1–2 alternates with a one-line note on how they differ.
|
|
23
|
-
|
|
24
|
-
## Instructions
|
|
25
|
-
|
|
26
|
-
1. **Read for intent, not keywords.** Users describe what they *see* or *feel* ("springy", "slides off", "draws itself in"), not the technical name. Map the sensation to the glossary below.
|
|
27
|
-
2. **Quote the glossary verbatim.** Its descriptions are authoritative — use them as-is, don't paraphrase.
|
|
28
|
-
3. **Disambiguate close terms.** When two compete (*Clip-path* vs *Mask*, *Pop in* vs *Bounce*, *Shared element transition* vs *Layout animation*), contrast them so the user can pick.
|
|
29
|
-
4. **When nothing matches exactly,** name the closest term and say plainly it's an approximation, or describe the effect in the glossary's vocabulary (e.g. "that's a *stagger* of *scale-in* entrances").
|
|
30
|
-
5. **Stay within this glossary.** If a term genuinely isn't here, say so rather than inventing one — though you may explain the concept using these words.
|
|
31
|
-
6. **Keep it tight.** A naming question wants a name, not an essay. Lead with the term; expand only if asked.
|
|
32
|
-
|
|
33
|
-
## Examples
|
|
34
|
-
|
|
35
|
-
**Example 1 — feel-based**
|
|
36
|
-
User: "What's it called when a popover seems to grow out of the button you clicked instead of from its middle?"
|
|
37
|
-
Output:
|
|
38
|
-
```
|
|
39
|
-
**Origin-aware animation** — An element animates out of its trigger, like a popover growing from the button that opened it instead of from its own center which is the default in CSS.
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Example 2 — disambiguation**
|
|
43
|
-
User: "The thing where one image turns into another image."
|
|
44
|
-
Output:
|
|
45
|
-
```
|
|
46
|
-
**Morph** — One shape smoothly turns into another shape, e.g. Dynamic Island.
|
|
47
|
-
|
|
48
|
-
Close alternates:
|
|
49
|
-
- **Crossfade** — if they simply fade over each other in the same spot.
|
|
50
|
-
- **Shared element transition** — if an element travels and transforms from one position into another.
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**Example 3 — physics feel**
|
|
54
|
-
User: "That iOS scroll where it resists and snaps back when you pull too far."
|
|
55
|
-
Output:
|
|
56
|
-
```
|
|
57
|
-
**Rubber-banding** — Resistance and snap-back when you drag past a boundary (the iOS overscroll feel).
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Glossary
|
|
61
|
-
|
|
62
|
-
_Adapted from the vocabulary page at [animations.dev](https://animations.dev/) (MIT). It is a
|
|
63
|
-
snapshot, not a live mirror: this catalog does not control that page, so treat any drift as the
|
|
64
|
-
upstream page being newer — and stay inside this glossary rather than inventing a term._
|
|
65
|
-
|
|
66
|
-
### Entrances & Exits — how elements appear and disappear
|
|
67
|
-
- **Fade in / Fade out** — Element appears or disappears by changing opacity.
|
|
68
|
-
- **Slide in** — Element enters by sliding in from off-screen (left, right, top, or bottom).
|
|
69
|
-
- **Scale in** — Element grows from smaller to full size as it appears, often paired with a fade.
|
|
70
|
-
- **Pop in** — Element appears with a slight overshoot, like it bounces into place.
|
|
71
|
-
- **Reveal** — Content is uncovered gradually, often by animating a clip-path or mask.
|
|
72
|
-
- **Enter / Exit** — The animation an element plays when it's added to or removed from the screen.
|
|
73
|
-
|
|
74
|
-
### Sequencing & Timing — coordinating multiple elements or moments
|
|
75
|
-
- **Keyframes** — Defined points in an animation (0%, 50%, 100%) that the browser fills the gaps between.
|
|
76
|
-
- **Interpolation / Tween** — Generating all the in-between frames between a start and end value, so motion is continuous.
|
|
77
|
-
- **Stagger** — Animate several items one after another with a small delay between each, creating a cascade.
|
|
78
|
-
- **Orchestration** — Deliberately timing multiple animations so they feel like one coordinated motion.
|
|
79
|
-
- **Delay** — Time before an animation starts.
|
|
80
|
-
- **Duration** — How long an animation takes.
|
|
81
|
-
- **Fill mode** — Whether an element keeps its first or last frame's styles before the animation starts or after it ends (e.g. forwards).
|
|
82
|
-
- **Stepped animation** — An animation that is divided into discrete steps, like a countdown timer.
|
|
83
|
-
|
|
84
|
-
### Movement & Transforms — changing an element's position, size, or angle
|
|
85
|
-
- **Translate** — Move an element along the X or Y axis.
|
|
86
|
-
- **Scale** — Make an element bigger or smaller.
|
|
87
|
-
- **Rotate** — Spin an element around a point.
|
|
88
|
-
- **Skew** — Slant an element along the X or Y axis, shearing it out of its rectangular shape.
|
|
89
|
-
- **3D tilt / Flip** — Rotate in 3D space (rotateX / rotateY) to add depth.
|
|
90
|
-
- **Perspective** — How strong the 3D effect looks — a lower value exaggerates depth, like the viewer is closer.
|
|
91
|
-
- **Transform origin** — The anchor point a scale or rotation grows or spins from.
|
|
92
|
-
- **Origin-aware animation** — An element animates out of its trigger, like a popover growing from the button that opened it instead of from its own center which is the default in CSS.
|
|
93
|
-
|
|
94
|
-
### Transitions Between States — connecting one state, view, or element to another
|
|
95
|
-
- **Crossfade** — One element fades out as another fades in, in the same spot.
|
|
96
|
-
- **Continuity transition** — A change that keeps the user oriented by visually connecting before and after. For example, making the same rectangle bigger and smaller.
|
|
97
|
-
- **Morph** — One shape smoothly turns into another shape, e.g. Dynamic Island.
|
|
98
|
-
- **Shared element transition** — An element travels and transforms from one position into another, like a thumbnail expanding into a card.
|
|
99
|
-
- **Layout animation** — When an element's size or position changes, it animates to the new spot instead of snapping.
|
|
100
|
-
- **Accordion / Collapse** — A section smoothly expands and collapses its height to show or hide content.
|
|
101
|
-
- **Direction-aware transition** — Content slides one way going forward and the opposite way going back, so navigation has a sense of direction.
|
|
102
|
-
|
|
103
|
-
### Scroll — motion tied to scrolling or navigating between views
|
|
104
|
-
- **Scroll reveal** — Elements fade or slide into place as they enter the viewport.
|
|
105
|
-
- **Scroll-driven animation** — An animation whose progress is tied directly to scroll position.
|
|
106
|
-
- **Parallax** — Background and foreground move at different speeds while scrolling, creating depth.
|
|
107
|
-
- **Page transition** — An animation that plays when navigating from one page or route to another.
|
|
108
|
-
- **View transition** — The browser morphs between two states or pages, connecting shared elements.
|
|
109
|
-
|
|
110
|
-
### Feedback & Interaction — responding to the user's actions
|
|
111
|
-
- **Hover effect** — Visual change when the cursor moves over an element.
|
|
112
|
-
- **Press / Tap feedback** — A subtle scale-down when an element is clicked, so it feels physical.
|
|
113
|
-
- **Hold to confirm** — A progress effect that fills up while the user holds a button.
|
|
114
|
-
- **Drag** — Moving an element by grabbing it, often with momentum when released.
|
|
115
|
-
- **Drag to reorder** — Dragging items in a list to rearrange them, while the others shift to make room.
|
|
116
|
-
- **Swipe to dismiss** — Dragging an element off-screen to close it, like a drawer or toast.
|
|
117
|
-
- **Rubber-banding** — Resistance and snap-back when you drag past a boundary (the iOS overscroll feel).
|
|
118
|
-
- **Shake / Wiggle** — A quick side-to-side jitter signaling an error or rejected input.
|
|
119
|
-
- **Ripple** — A circle expanding from the point of a tap, confirming the press.
|
|
120
|
-
|
|
121
|
-
### Easing — how speed changes over an animation
|
|
122
|
-
- **Easing** — The rate at which an animation speeds up or slows down.
|
|
123
|
-
- **Ease-out** — Starts fast, ends slow. The default for most UI and anything responding to the user.
|
|
124
|
-
- **Ease-in** — Starts slow, ends fast. Usually avoided; can feel sluggish.
|
|
125
|
-
- **Ease-in-out** — Slow, fast, slow. Good for elements already on screen moving from A to B.
|
|
126
|
-
- **Linear** — Constant speed. Avoid for UI; reserve for spinners or marquees.
|
|
127
|
-
- **Cubic-bezier** — A custom easing curve you define for precise control.
|
|
128
|
-
- **Asymmetric easing** — A curve that accelerates and decelerates at different rates. Feels more alive than a symmetric one.
|
|
129
|
-
|
|
130
|
-
### Spring Animations — physics-based motion as an alternative to fixed-duration easing
|
|
131
|
-
- **Spring** — Motion driven by physics (tension, mass, damping) rather than a set duration.
|
|
132
|
-
- **Stiffness / Tension** — How strongly the spring pulls toward its target. Higher feels snappier.
|
|
133
|
-
- **Damping** — How quickly a spring settles. Lower damping means more bounce and oscillation.
|
|
134
|
-
- **Mass** — How heavy the animated element feels. More mass makes it slower and more sluggish.
|
|
135
|
-
- **Bounce** — A spring that overshoots and settles, adding playfulness.
|
|
136
|
-
- **Perceptual duration** — How long a spring feels finished, even though it keeps micro-settling underneath.
|
|
137
|
-
- **Momentum** — Motion that carries velocity, especially after a drag or interruption.
|
|
138
|
-
- **Velocity** — How fast and in which direction an element is moving. A spring carries it into the next animation when interrupted, so a flicked element keeps its speed.
|
|
139
|
-
- **Interruptible animation** — An animation that can be smoothly redirected mid-flight instead of finishing first.
|
|
140
|
-
|
|
141
|
-
### Looping & Ambient Motion — animations that run on their own
|
|
142
|
-
- **Marquee** — Text or content that scrolls continuously in a loop.
|
|
143
|
-
- **Loop** — An animation that repeats, a set number of times or infinitely.
|
|
144
|
-
- **Alternate (yoyo)** — A loop that plays forward then reverses each iteration, instead of jumping back to the start.
|
|
145
|
-
- **Orbit** — An element circling around another in a continuous path.
|
|
146
|
-
- **Pulse** — A gentle repeating scale or opacity change to draw attention.
|
|
147
|
-
- **Float** — A gentle, continuous up-and-down drift that makes a static element feel alive and weightless.
|
|
148
|
-
- **Idle animation** — Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
|
|
149
|
-
|
|
150
|
-
### Polish & Effects — the small touches that separate good from great
|
|
151
|
-
- **Blur** — A blur filter used to soften an element or mask tiny imperfections.
|
|
152
|
-
- **Clip-path** — Clipping an element to a shape, used for reveals, masks, and before/after sliders.
|
|
153
|
-
- **Mask** — Hiding or revealing parts of an element using a shape or gradient — like clip-path, but with soft, fadeable edges.
|
|
154
|
-
- **Before / after slider** — A draggable divider that wipes between two overlaid images to compare them.
|
|
155
|
-
- **Line drawing** — An SVG path that draws itself in, like an invisible pen tracing it.
|
|
156
|
-
- **Text morph** — Text that animates character by character when it changes, drawing attention to the new value.
|
|
157
|
-
- **Skeleton / Shimmer** — A placeholder with a moving sheen shown while content loads.
|
|
158
|
-
- **Number ticker** — Digits rolling or counting up to a value.
|
|
159
|
-
- **Tabular numbers** — Fixed-width digits so numbers don't shift around as they change. Essential for tickers, timers, and counters.
|
|
160
|
-
- **Typewriter** — Text appearing one character at a time, as if being typed.
|
|
161
|
-
|
|
162
|
-
### Performance — what keeps motion smooth instead of stuttering
|
|
163
|
-
- **Frame rate (FPS)** — Frames drawn per second. 60fps is the baseline for smooth motion; 120fps on newer displays.
|
|
164
|
-
- **Jank** — Visible stutter when the browser drops frames because it can't keep up with the animation.
|
|
165
|
-
- **Dropped frame** — A frame the browser missed its deadline to draw, causing a tiny hitch in motion.
|
|
166
|
-
- **Compositing** — Letting the GPU move or fade an element on its own layer without redoing layout or paint.
|
|
167
|
-
- **will-change** — A CSS hint that an element is about to animate, so the browser can promote it to its own layer ahead of time.
|
|
168
|
-
- **Layout thrashing** — Animating properties like width, height, top, or left that force the browser to recalculate layout every frame, causing jank.
|
|
169
|
-
|
|
170
|
-
### Principles to Know — concepts that guide when and how to animate
|
|
171
|
-
- **Purposeful animation** — Motion should serve a function — orient, give feedback, show relationships — not just decorate.
|
|
172
|
-
- **Anticipation** — A small wind-up in the opposite direction before a move, hinting at what's about to happen.
|
|
173
|
-
- **Follow-through** — Parts of an element keep moving and settle slightly after the main motion stops, adding weight.
|
|
174
|
-
- **Squash & stretch** — Deforming an element as it moves to convey weight, speed, and flexibility.
|
|
175
|
-
- **Perceived performance** — The right animation makes an interface feel faster, even when it isn't.
|
|
176
|
-
- **Frequency of use** — The more often a user sees an animation, the shorter and subtler it should be.
|
|
177
|
-
- **Spatial consistency** — Animating so an element keeps its identity and position across states, so users never lose track of where things went.
|
|
178
|
-
- **Hardware acceleration** — Animating transform and opacity lets the GPU keep motion smooth.
|
|
179
|
-
- **Reduced motion** — Respecting the user's prefers-reduced-motion setting by toning down or removing motion.
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## Credit
|
|
184
|
-
|
|
185
|
-
Adapted for the rsc catalog from **[emilkowalski/skills](https://github.com/emilkowalski/skills)**
|
|
186
|
-
(MIT, commit `d23d7f8`) by Emil Kowalski — the design-engineering and animation philosophy behind
|
|
187
|
-
[Sonner](https://sonner.emilkowal.ski), [Vaul](https://vaul.emilkowal.ski) and
|
|
188
|
-
[animations.dev](https://animations.dev). The craft bar here is his; the routing, gates and evals
|
|
189
|
-
that make it an rsc skill are not. Nothing in this body is a substitute for his course.
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
skill: animation-vocabulary
|
|
2
|
-
|
|
3
|
-
should_trigger:
|
|
4
|
-
- prompt: "What's it called when a popover seems to grow out of the button you clicked instead of from its middle?"
|
|
5
|
-
why: "A naming question answered by a specific glossary term (origin-aware animation)."
|
|
6
|
-
- prompt: "What's the name for that iOS scroll that resists and snaps back when you pull too far?"
|
|
7
|
-
why: "Rubber-banding; a feel-based description mapped to the exact term."
|
|
8
|
-
- prompt: "What do you call it when items appear one after another with a small delay?"
|
|
9
|
-
why: "Stagger; the canonical reverse-lookup case."
|
|
10
|
-
- prompt: "I want to describe an effect to a designer but I don't know the right word for it."
|
|
11
|
-
why: "The skill's stated purpose: give the user the vocabulary to prompt with."
|
|
12
|
-
- prompt: "Is the thing where one image turns into another called a morph or a crossfade?"
|
|
13
|
-
why: "Disambiguation between two close terms, which the skill handles explicitly."
|
|
14
|
-
|
|
15
|
-
should_not_trigger:
|
|
16
|
-
- prompt: "Build me that origin-aware popover animation."
|
|
17
|
-
route_to: "animate"
|
|
18
|
-
why: "Naming is done; this is implementation."
|
|
19
|
-
- prompt: "Explain the physics of springs — damping, response, velocity handoff."
|
|
20
|
-
route_to: "apple-design"
|
|
21
|
-
why: "The mechanism and its values, not the name of an effect."
|
|
22
|
-
- prompt: "Review whether the stagger delay in this list is right."
|
|
23
|
-
route_to: "review-animations"
|
|
24
|
-
why: "A judgement on existing motion, not a naming question."
|
|
25
|
-
- prompt: "Translate our UI copy into Catalan."
|
|
26
|
-
route_to: "translation-l10n"
|
|
27
|
-
why: "Also a words-and-terms request, but a different domain entirely."
|
|
28
|
-
|
|
29
|
-
capability:
|
|
30
|
-
- scenario: "User describes an effect that is not in the glossary: 'the thing where the whole page melts into liquid when you click'."
|
|
31
|
-
expect: "Says plainly that no glossary term matches rather than inventing one, then describes the effect using the glossary's own vocabulary (for example a morph plus a mask reveal), and stays inside the curated list."
|