creating-reanimated-animations
БесплатноБез исполняемых скриптовНе проверенGenerate React Native Reanimated animation code for React Native apps. Use when user asks to create, implement, or add animations in React Native — including…
от estevg★ 16 звёзд на GitHubОб этом скилле
React Native Reanimated Code Generator
Generate performant animation code using React Native Reanimated. Supports both v3 and v4.
Version Detection
Check the project's package.json to determine the version:
- v4 (New Architecture only): requires
react-native-workletsas separate dependency - v3 (supports Legacy and New Architecture): single package install
Setup
Reanimated v4 (latest)
npm install react-native-reanimated react-native-worklets
Babel plugin: 'react-native-worklets/plugin' (must be last in plugins list).
For Expo: no Babel config needed. Run npx expo prebuild after install.
Reanimated v3
npm install react-native-reanimated
Babel plugin: 'react-native-reanimated/plugin' (must be last in plugins list).
Core Pattern
Every animation follows three steps:
import Animated, { useSharedValue, useAnimatedStyle, withTiming } from 'react-native-reanimated';
function Component() {
// 1. Create shared value (lives on UI thread)
const offset = useSharedValue(0);
// 2. Bind to style
const animatedStyle = useAnimatedStyle(() => ({
transform: [{ translateX: offset.value }],
}));
// 3. Trigger animation
const handlePress = () => {
offset.value = withTiming(200, { duration: 500 });
};
return (
<Animated.View style={[styles.box, animatedStyle]}>
<Pressable onPress={handlePress}><Text>Move</Text></Pressable>
</Animated.View>
);
}
Animation Selection
| User wants | Function | Key params |
|---|---|---|
| Smooth fixed-duration transition | withTiming(to, {duration, easing}) |
Default: 300ms, Easing.inOut(Easing.quad) |
| Natural bouncy feel | withSpring(to, {mass, damping, stiffness}) |
Default: mass=1, damping=10, stiffness=100 |
| Momentum after fling | withDecay({velocity, clamp}) |
Needs initial velocity from gesture |
| Clamp spring range | withClamp({min, max}, withSpring(to)) |
v4: limits spring overshoot |
| Loop/pulse/shake | withRepeat(anim, reps, reverse) |
reps=0 for infinite (v4), reps=-1 (v3) |
| Multi-step choreography | withSequence(anim1, anim2, ...) |
Runs in order |
| Delayed start | withDelay(ms, anim) |
Delays any animation |
Spring tuning: lower damping (5–8) = more bounce, higher stiffness (150–200) = snappier, higher mass (2–3) = heavier.
Quick Patterns
Fade
const opacity = useSharedValue(0);
const style = useAnimatedStyle(() => ({ opacity: opacity.value }));
// Show: opacity.value = withTiming(1);
// Hide: opacity.value = withTiming(0);
Slide from side
const translateX = useSharedValue(-SCREEN_WIDTH);
const style = useAnimatedStyle(() => ({
transform: [{ translateX: translateX.value }],
}));
// Enter: translateX.value = withSpring(0);
Scale on press
const scale = useSharedValue(1);
const style = useAnimatedStyle(() => ({
transform: [{ scale: scale.value }],
}));
// In: scale.value = withSpring(0.95);
// Out: scale.value = withSpring(1);
Interpolation
import { interpolate, Extrapolation } from 'react-native-reanimated';
const style = useAnimatedStyle(() => ({
opacity: interpolate(scrollY.value, [0, 100], [1, 0], Extrapolation.CLAMP),
transform: [{
scale: interpolate(scrollY.value, [0, 100], [1, 0.8], Extrapolation.CLAMP),
}],
}));
Scroll-linked animation
const scrollY = useSharedValue(0);
const scrollHandler = useAnimatedScrollHandler({
onScroll: (event) => { scrollY.value = event.contentOffset.y; },
});
<Animated.ScrollView onScroll={scrollHandler}>{children}</Animated.ScrollView>
Or simpler with useScrollOffset (v4) / useScrollViewOffset (v3):
const ref = useAnimatedRef<Animated.ScrollView>();
const scrollOffset = useScrollOffset(ref); // auto-tracks scroll position
<Animated.ScrollView ref={ref}>{children}</Animated.ScrollView>
Layout Animations (Mount/Unmount)
Built-in presets — no shared values needed:
import Animated, { FadeIn, SlideInRight, SlideOutLeft } from 'react-native-reanimated';
<Animated.View entering={FadeIn.duration(400).delay(100)} exiting={SlideOutLeft.duration(300)}>
{content}
</Animated.View>
Presets: FadeIn/Out, SlideIn/OutLeft/Right/Up/Down, ZoomIn/Out, BounceIn/Out, FlipInEasyX/Y, LightSpeedIn/Out, PinwheelIn/Out, RollIn/Out, RotateIn/Out, StretchIn/Out.
Modifiers: .duration(ms), .delay(ms), .springify(), .damping(n), .stiffness(n), .randomDelay(), .reduceMotion(), .withCallback().
Layout Transitions (position/size changes)
Animate when component position or size changes:
import { LinearTransition, SequencedTransition } from 'react-native-reanimated';
<Animated.View layout={LinearTransition.springify().damping(15)} />
Transitions: LinearTransition, SequencedTransition, FadingTransition, JumpingTransition, CurvedTransition, EntryExitTransition.
Keyframe Animations (complex entering/exiting)
Установить creating-reanimated-animations в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл creating-reanimated-animations?
Generate React Native Reanimated animation code for React Native apps. Use when user asks to create, implement, or add animations in React Native — including transitions, gestures, scroll-linked effects, layout animations, layout transitions, entering/exiting animations, CSS animations, CSS transitions, shared element transitions, color animations, parallax, fade, slide, scale, spring, timing, decay, keyframes, worklets, accordion, bottom sheet, flip card, collapsing header, or any motion effect using react-native-reanimated. Also use for integrating react-native-gesture-handler with Reanimated, understanding worklets, animating between screens, testing animations with Jest, or checking which properties are animatable.
Как установить скилл creating-reanimated-animations?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл creating-reanimated-animations запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic