reanimated-skia-performance
БесплатноБез исполняемых скриптовНе проверенWrite and review high-performance React Native animations and 2D graphics using react-native-reanimated (v4.8+), react-native-worklets (v0.14+), and…
Об этом скилле
Reanimated + Skia Performance
Target stack: react-native-skia v3 (Graphite), react-native-reanimated 4.8+, react-native-worklets 0.14+.
Skia v2 note:
@shopify/react-native-skiastops at v2.14. v3 publishes asreact-native-skiaand requires Reanimated 4 (react-native-worklets >= 0.7.0), Android API 26+ with Vulkan 1.1, and iOS 15.1+. Stay onreact-native-skia@2(OpenGL ES) only when you must support Android < API 26, non-Vulkan devices, Android TV, or Expo Go.
Defaults
- Keep animation state off the JS thread:
useSharedValue,useDerivedValue, worklets. Never read aSharedValueon the JS thread (blocking round-trip to UI thread). - Prefer
shared.get()/shared.set()overshared.value(React Compiler safe). Use lazy inituseSharedValue(() => ...)for expensive objects andshared.modify(...)for in-place array/typed-array updates. - Minimize JS↔UI crossings: use
scheduleOnRN(fn, ...args)/scheduleOnUI(fn, ...args)fromreact-native-worklets(not deprecated curriedrunOnJS/runOnUI), and never per frame. - For Skia v3
<Canvas>, avoid per-frame React renders: passSharedValues orselect(sv, key)directly to Skia props/uniforms. The UI thread only writes updated values; a native thread pool replays Graphite frames. - Explicitly
.dispose()(or useusing) per-frame Skia NativeState objects (SkGraphiteRecording, offscreen images) inside UI/worklet loops; the UI runtime collects garbage rarely.
Choose the Renderer and Primitive
| Use case | Recommended primitive | Why |
|---|---|---|
| State-driven style change | Reanimated CSS transitions | Declarative, runs in native core, eligible for platform-backed animations |
| Hover, press, or focus feedback | Reanimated CSS pseudo selectors (:active, :hover, :focus) |
Zero React state, zero re-renders |
| Keyframe loops (pulse, shimmer) | Reanimated CSS animations (animationName) |
Declarative keyframes off JS thread |
| Animated numbers / live text | <Animated.Text>{sharedValue}</Animated.Text> (v4.8+) |
Updates text on UI thread without React re-renders |
| Screen-to-screen hero transition | Shared Element Transitions (sharedTransitionTag + <SharedTransitionBoundary>) |
Default ON in v4.8; moves the live view itself |
| Gestures / physics (< ~100 low-end Android / < ~500 iOS RN views) | useAnimatedStyle + withSpring / withTiming / withDecay |
Full UI-thread control; add *_SYNCHRONOUSLY_UPDATE_UI_PROPS when scaling |
| Fixed-structure 2D drawing / shaders | Retained Skia <Canvas> |
Zero JS work and zero UI-thread draw cost during animation |
| Many Skia props updated together | select(groupedSV, 'key') |
1 Reanimated mapper instead of N |
| Thousands of filled rects, rrects, or circles | Skia.ShapeBlob + canvas.drawShapes(blob) |
1 drawVertices call; keeps vertices across frames |
| Many textured / rotated / scaled sprites | <Atlas> + useRSXformBuffer |
1 drawVertices call; use react-native-webgpu instancing at extreme counts |
| Dynamic meshes with thousands of points | <Vertices> with Float32Array + sv.modify() |
Single native memcpy instead of per-point JSI reads |
| Dynamic draw-command count / custom frame loop | <Picture> inside <Canvas> or <SkiaGraphiteView> |
Immediate-mode recording from JS, UI (useFrameCallback), or Worker Runtime |
| Many small static drawings (icons, thumbnails) | Batch in one canvas, image snapshot, or react-native-webgpu <NativeBufferView> |
Avoids allocating one swap chain per <Canvas> |
Workflow
- Define what animates, duration/physics, interruption rules, and input source (state, gesture, scroll, clock).
- Pick the lightest primitive from the table above (prefer CSS /
<Animated.Text>/ retained<Canvas>before imperative loops). - Keep one UI-thread data flow (no per-frame
setState, no JS-thread shared-value reads). - Keep static Skia props and gestures memoized (or React Compiler compiled) so React commits stay cold.
- Run a perf pass in release or Android
debugOptimizedbuilds (seereferences/perf-checklist.md).
Patterns
Shared values (React Compiler safe)
import { useEffect } from 'react';
import { useSharedValue, withTiming } from 'react-native-reanimated';
const progress = useSharedValue(0);
// Lazy initializer (Reanimated 4.4+) avoids rebuilding on every render:
const points = useSharedValue(() => new Float32Array(2048));
useEffect(() => {
progress.set(withTiming(1, { duration: 400 }));
}, [progress]);
Reanimated CSS transitions, pseudo selectors, and keyframes
import Animated from 'react-native-reanimated';
// Zero-state press/hover transition + state-driven transition
<Animated.View
style={{
width: expanded ? 240 : 160,
opacity: { default: 0.9, ':active': 0.7 },
transform: { default: [{ scale: 1 }], ':active': [{ scale: 0.96 }] },
transitionProperty: ['width', 'opacity', 'transform'],
transitionDuration: 180,
Установить reanimated-skia-performance в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл reanimated-skia-performance?
Write and review high-performance React Native animations and 2D graphics using react-native-reanimated (v4.8+), react-native-worklets (v0.14+), and react-native-skia (v3+ Graphite: Canvas, SkiaGraphiteView, ShapeBlob, Atlas, Vertices, runtime effects/shaders). Use for: gesture-driven interactions, spring/timing transitions, CSS transitions/animations/pseudo-selectors, Animated.Text counters, Shared Element Transitions, Skia drawings, animated shader uniforms, immutable PathBuilder/path interpolation, dev-mode tuning panels, and diagnosing animation jank (JS/UI thread stalls, New Architecture commits, per-frame allocations, GPU/Graphite bottlenecks).
Как установить скилл reanimated-skia-performance?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл reanimated-skia-performance запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic