Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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…

andreev-danilaот andreev-danila★ 24 звезды на GitHub20 установок в других каталогах

Об этом скилле

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-skia stops at v2.14. v3 publishes as react-native-skia and requires Reanimated 4 (react-native-worklets >= 0.7.0), Android API 26+ with Vulkan 1.1, and iOS 15.1+. Stay on react-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 a SharedValue on the JS thread (blocking round-trip to UI thread).
  • Prefer shared.get() / shared.set() over shared.value (React Compiler safe). Use lazy init useSharedValue(() => ...) for expensive objects and shared.modify(...) for in-place array/typed-array updates.
  • Minimize JS↔UI crossings: use scheduleOnRN(fn, ...args) / scheduleOnUI(fn, ...args) from react-native-worklets (not deprecated curried runOnJS/runOnUI), and never per frame.
  • For Skia v3 <Canvas>, avoid per-frame React renders: pass SharedValues or select(sv, key) directly to Skia props/uniforms. The UI thread only writes updated values; a native thread pool replays Graphite frames.
  • Explicitly .dispose() (or use using) 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

  1. Define what animates, duration/physics, interruption rules, and input source (state, gesture, scroll, clock).
  2. Pick the lightest primitive from the table above (prefer CSS / <Animated.Text> / retained <Canvas> before imperative loops).
  3. Keep one UI-thread data flow (no per-frame setState, no JS-thread shared-value reads).
  4. Keep static Skia props and gestures memoized (or React Compiler compiled) so React commits stay cold.
  5. Run a perf pass in release or Android debugOptimized builds (see references/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,
Полный SKILL.md на GitHub

Установить reanimated-skia-performance в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/dev-tuning.mdreferences/perf-checklist.mdreferences/reanimated-v4.mdreferences/skia-graphite-v3.mdreferences/skia-shaders.md

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), без исполняемых скриптов.

Похожие скиллы

Сравнить reanimated-skia-performance с