Index of every page on this site: llms.txt
All skills
Run it yourself

Production animation patterns for React Native using Reanimated 4, Skia, WebGPU, and TypeGPU. Covers CSS transitions, CSS animations, CSS pseudo-selectors, CSS callbacks, shared value animations, canvas animations with react-native-skia, GPU shader animations, layout animations, scroll-driven animations, particle systems, procedural noise, SDF rendering, performance tuning, and accessibility. Trigger on: Reanimated, useSharedValue, useAnimatedStyle, withSpring, withTiming, withDecay, withRepeat, withSequence, CSS transition, CSS animation, layout animation, FadeIn, SlideIn, ZoomIn, LinearTransition, keyframe, interpolate, scrollTo, useFrameCallback, react-native-skia, Skia Canvas, Atlas, usePathInterpolation, usePathValue, useClock, useTexture, SKSL, interpolateColors, Picture API, canvas animation, sprite animation, WebGPU, react-native-wgpu, TypeGPU, GPU shader, WGSL, particle system, Perlin noise, SDF, Three.js, react-three-fiber, animation performance, or any request to animate UI in React Native.

Use this Skill: https://skilld.dev/gh/software-mansion-labs/skills/animations

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

canvas-atlas.md

≈624 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Atlas: Batched Sprite and Tile Animation

The Atlas component renders many instances of the same texture in a single draw call with per-instance transforms. Use it for tile maps, sprite animations, and any scene with hundreds of similar objects.

Combine with useTexture (creates the texture on the UI thread) and useRSXformBuffer (efficiently animates per-sprite transforms in a worklet):

import {
  Skia,
  Canvas,
  Atlas,
  Rect,
  Group,
  rect,
  useTexture,
  useRSXformBuffer,
} from '@shopify/react-native-skia';
import { useSharedValue } from 'react-native-reanimated';
import { GestureDetector, Gesture } from 'react-native-gesture-handler';

const size = { width: 25, height: 11.25 };
const strokeWidth = 2;
const textureSize = {
  width: size.width + strokeWidth,
  height: size.height + strokeWidth,
};

export const SpriteGrid = () => {
  const pos = useSharedValue({ x: 0, y: 0 });
  const texture = useTexture(
    <Group>
      <Rect
        rect={rect(strokeWidth / 2, strokeWidth / 2, size.width, size.height)}
        color="cyan"
      />
      <Rect
        rect={rect(strokeWidth / 2, strokeWidth / 2, size.width, size.height)}
        color="blue"
        style="stroke"
        strokeWidth={strokeWidth}
      />
    </Group>,
    textureSize
  );

  const gesture = Gesture.Pan().onChange((e) => (pos.value = e));
  const count = 150;
  const gridWidth = 256;

  const sprites = new Array(count)
    .fill(0)
    .map(() => rect(0, 0, textureSize.width, textureSize.height));

  const transforms = useRSXformBuffer(count, (val, i) => {
    'worklet';
    const tx = 5 + ((i * size.width) % gridWidth);
    const ty = 25 + Math.floor(i / (gridWidth / size.width)) * size.width;
    const r = Math.atan2(pos.value.y - ty, pos.value.x - tx);
    val.set(Math.cos(r), Math.sin(r), tx, ty);
  });

  return (
    <GestureDetector gesture={gesture}>
      <Canvas style={{ flex: 1 }}>
        <Atlas image={texture} sprites={sprites} transforms={transforms} />
      </Canvas>
    </GestureDetector>
  );
};

RSXform

Atlas transforms use a compressed rotation-scale-translate matrix [scos, ssin, tx, ty]:

// Identity (no transform)
Skia.RSXform(1, 0, 0, 0);

// Scale by 2, translate to (50, 100)
Skia.RSXform(2, 0, 50, 100);

// Rotate by PI/4, translate to (50, 100)
const r = Math.PI / 4;
Skia.RSXform(Math.cos(r), Math.sin(r), 50, 100);

// Scale by 2, rotate by PI/4 with pivot (25, 25)
Skia.RSXformFromRadians(2, r, 0, 0, 25, 25);

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides comprehensive documentation and production patterns for React Native animations using Reanimated 4, Skia, and WebGPU. It includes instructions for environment setup, package installation, and configuration for the New Architecture. All referenced resources, including Node.js packages and external documentation, belong to the vendor (Software Mansion) or established community libraries. No malicious patterns or security risks were identified.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: MEDIUM · 1 issue

Signed by skilld at 43cde80. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 months ago

README badge

README badge for software-mansion-labs/skills/animations