expo-animation – skill Thiết kế & UI cho agent AI
Hướng dẫn tuyển chọn từ upstream cho Expo Animation; dùng khi quy trình khớp với mục tiêu của người dùng.
Cài skill expo-animation bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/expo-animation-23ed0.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /expo-animation – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/expo-animation-23ed0.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $expo-animation – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/expo-animation-23ed0.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /expo-animation – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/expo-animation-23ed0.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /expo-animation – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
When to Use
- Use when this upstream workflow matches the user's stated goal.
- Use when the task requires the procedures documented in this skill.
Building Animations in Expo
This skill was created in collaboration with [Emil Kowalski](https://github.com/emilkowalski) and can also be found in the [emilkowalski/skills](https://github.com/emilkowalski/skills) repository, along with other useful animation skills.
A construction skill for React Native. It turns a request for motion into an implementation that survives a strict review on a real device — not in the simulator, not on a flagship phone in dev mode.
Mobile changes three things about animation, and everything in this skill follows from them:
1. There is no hover. Every affordance the web puts in hover has to live in press, position, or nothing.
2. There are two runtimes. Worklets (Reanimated 4) makes this explicit: the React Native runtime, where React renders and your app logic runs, and the UI runtime, where worklets run every frame (plus optional worker runtimes for background work). An animation that touches the RN runtime stutters the moment the app does anything else. The whole craft is keeping motion on the UI runtime.
3. The user's finger is on the element. Gestures are the primary input, so interruptibility and velocity handoff aren't polish — they're the baseline.
Operating Posture
You are a senior mobile engineer building the animation yourself. Make the call, state the reasoning in one line, write the code. Never present motion options as a menu.
Two failure modes, and the first is worse:
1. Animating something that shouldn't animate. The gate below exists to produce zero lines of code sometimes.
2. Animating the right thing on the wrong thread — a setState per frame, a PanResponder, an animated height. It looks fine in dev on your phone and drops to 20fps on a three-year-old Android.
Hard Rules
1. Run the sequence in order. Steps 1 and 2 gate everything.
2. Reanimated, not core Animated. Core Animated can't be driven by a gesture without crossing the bridge, and useNativeDriver refuses anything but transform and opacity anyway. Reanimated worklets run on the UI thread and keep running while JS is busy.
3. No approximated values. Curves and spring configs come from the tables below.
4. Reduced motion ships with the animation, not as a follow-up.
5. Feel is judged on a release build on the slowest device you support. Nothing else counts as verified.
The Build Sequence
1. Should this animate at all?
| Frequency | Decision |
| --- | --- |
| 100+ times/day — tab switches, keyboard open/close, scrolling, toggles in settings | No animation. Platform default or nothing. Stop here. |
| Tens of times/day — press feedback, list navigation, row selection | Near-imperceptible only: under 150ms, or nothing |
| Occasional — sheets, modals, toasts, onboarding steps | Standard animation |
| Rare / first-time — success states, empty-state illustrations, celebration | The delight budget lives here |
Tab switches never slide. Tabs are peers, not a hierarchy — sliding implies depth that isn't there, and the user pays for it dozens of times a session. animation: 'none'.
If the request fails this gate, say so and don't write it.
2. What is the purpose?
Name it in one word before continuing: feedback, spatial consistency, state indication, preventing a jarring change, explanation, or delight (rare tier only).
Can't name it? Don't build it.
3. Pick the tool — cheapest that works
Walk down; stop at the first that fits.
| Need | Tool |
| --- | --- |
| A state-driven change with no gesture — press, toggle, color, a value flipping | Reanimated CSS transition (transitionProperty in the style) |
| Loop, multi-stage, or plays on mount with no state change | Reanimated CSS animation (animationName keyframes) |
| An element mounting or unmounting, or a list reflowing | Layout animations (entering / exiting / itemLayoutAnimation) |
| Anything a finger touches, or anything derived from scroll | useSharedValue + Gesture + useAnimatedStyle |
| Screen to screen | Native stack options in Expo Router. Never hand-roll this |
| A bottom sheet that is its own screen | presentation: 'formSheet' — it's a real UISheetPresentationController, free and correct |
| Tab bar | NativeTabs (from expo-router/unstable-native-tabs) — the platform's real tab bar, its behaviors and transitions included |
| Context menu, press-and-hold preview | Link.Menu / Link.Preview (Expo Router, iOS-only) — native menus and peek, never rebuilt in JS |
| Header that collapses into a large title | headerLargeTitleEnabled on the native stack (iOS-only; headerLargeTitle is deprecated) — not a scroll worklet |
| Pull to refresh | RefreshControl — hand-roll only when it's a signature interaction (see the threshold recipe) |
| UI that tracks the keyboard | react-native-keyboard-controller — the keyboard's real position, frame by frame, on the UI thread |
| Vector illustration, celebration, empty state | Lottie — for illustration only, never for UI state |
| A huge animated scene, freeform drawing | @shopify/react-native-skia — a canvas, for when the view hierarchy itself is the bottleneck |
Reach for a shared value only when the value is continuous or interruptible. A press scale is a CSS transition; a drag is a shared value. Using a worklet for a two-state toggle is the mobile equivalent of installing a motion library for a fade.
Dependencies. Install with npx expo install <package> — it resolves the version that matches the project's SDK, which plain npm install won't:
| Need | Package |
| --- | --- |
| Animation | react-native-reanimated + react-native-worklets |
| Gestures | react-native-gesture-handler |
| Navigation, sheets, native tabs, menus | expo-router |
| Haptics | expo-haptics |
| Keyboard-following UI | react-native-keyboard-controller (needs KeyboardProvider at the root — see the keyboard recipe) |
| Illustration, celebration | lottie-react-native |
| Very large animated scenes, custom drawing | @shopify/react-native-skia |
4. Pick the properties
transformandopacitygenerally avoid layout recalculation. They still consume rendering resources; profile them. Layout properties such aswidth,height,margin,padding,flex,top,left,gapre-run Yoga on every frame for that node *and its siblings*.- The one exception: an absolutely positioned element with no children — a tab pill, a progress bar fill. It's out of flow, so nothing else re-lays-out, and animating
widthkeeps the corner radius thatscaleXwould smear. - Never
scale(0). Start fromscale(0.9–0.97)+opacity: 0. Nothing in the real world appears from nothing. transformis an array and order matters —[{ translateY }, { scale }]scales after moving; reversed, the translate gets scaled too. Keep translate first unless you want the multiplication.- Android shadows are
elevation, and animating elevation re-renders the shadow every frame. Animate opacity of a pre-shadowed layer instead. - Never animate
BlurViewintensity. On Android it re-renders the blur each frame. Crossfade the opacity of a staticBlurViewinstead. - Percentages work in
translateand are relative to the element's own size —translateY('100%')moves a sheet by its own height whatever its content.
5. Timing or spring
If a finger was involved, use a spring. Springs carry velocity through an interruption; timing curves restart. Everything else uses timing.
Reanimated's spring takes Apple's two designer parameters directly — use this form, not mass/stiffness/damping:
| Interaction | Config |
| --- | --- |
| Default settle, no overshoot | { duration: 400, dampingRatio: 1 } |
| Reposition / snap back after a drag | { duration: 400, dampingRatio: 0.8, velocity } |
| Sheet, drawer | { duration: 300, dampingRatio: 0.8, velocity } |
| Must not pass a hard edge | add overshootClamping: true |
Bounce only when the gesture carried momentum. Overshoot on a menu that faded in feels wrong; overshoot on a card you flicked feels right.
Easing, for everything without a finger on it:
| Situation | Easing |
| --- | --- |
| Entering or exiting | ease-out |
| Moving / morphing on screen | ease-in-out |
| Constant motion (progress, marquee) | linear |
| Default | ease-out |
Never ease-in on UI. It starts slow, delaying the exact moment the user is watching. Reanimated's built-ins are as weak as CSS's — use these:
import { cubicBezier, Easing } from 'react-native-reanimated';
// transitionTimingFunction / animationTimingFunction
const CSS_EASE_OUT = cubicBezier(0.23, 1, 0.32, 1);
// withTiming / .easing(...)
const EASE_OUT = Easing.bezier(0.23… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- visual-design-foundations – Áp dụng nguyên tắc typography, lý thuyết màu sắc, hệ thống khoảng cách và iconography để…
- visual-edit-precision – Dùng khi thực hiện thay đổi UI/frontend dựa trên ngữ cảnh trực quan, khi người dùng chọn…
- expo-tailwind-setup – Thiết lập Tailwind CSS v4 trong Expo với react-native-css và NativeWind v5 để tạo kiểu…
- expo-ui – Xây dựng giao diện native với package @expo/ui: SwiftUI thật trên iOS và Jetpack Compose…
- expo-ui-jetpack-compose – Xây dựng giao diện Android native với Expo SDK 55 bằng Jetpack Compose views/modifiers…
- expo-ui-swift-ui – Xây dựng giao diện iOS native với Expo SDK 55 bằng SwiftUI views/modifiers, nhúng…
- web-component-design – Nắm vững các mẫu component của React, Vue và Svelte, bao gồm CSS-in-JS, chiến lược…
- fal-image-edit – Chỉnh sửa hình ảnh bằng AI với chuyển đổi phong cách và xóa đối tượng