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.

css-pseudo-selectors.md

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

CSS Pseudo-Selectors

Pseudo-selectors drive interaction state (press, hover, focus) from inside the style, without React state. They work on any Animated component (and on react-native-svg elements from 4.6.0, declared in animatedProps). Docs: pseudo-selectors.

Requires Reanimated 4.5.0. Below that the pseudo object is not understood; use Pressable + React state instead (animations.md, Simple gesture feedback).

Supported everywhere: :hover, :active, :active-deepest, :focus and :focus-within. The remaining CSS pseudo-classes (:focus-visible, :disabled, :checked, ...) work on web only; on native they are dropped with a dev-only warning.

import { Pressable } from 'react-native-gesture-handler';
import Animated from 'react-native-reanimated';

const AnimatedPressable = Animated.createAnimatedComponent(Pressable);

<AnimatedPressable
  onPress={onPress}
  style={{
    backgroundColor: { default: '#eee', ':active': '#ccc' },
    transform: { default: [{ scale: 1 }], ':active': [{ scale: 0.96 }] },
    transitionProperty: ['backgroundColor', 'transform'],
    transitionDuration: 150,
  }}
/>

Selector keys go inside each property; a top-level ':active': { ... } block is not valid. Pseudo-selectors style the pressed element itself. To style its descendants, the Pressable itself below 4.5.0, or an ancestor, use the Pressable-based approaches described under Simple gesture feedback in animations.md.

Rules

  • A selector only switches the value. The switch animates when the property has a transition (transitionProperty and a duration, as for any transition); without one it snaps.
  • default is the resting value. Leaving it out means the selector animates back to the property's own default value, for example transparent for a color or 1 for opacity; the pseudo object owns the property, so a value from an earlier entry of the style array is not used.
  • While a selector matches, its values win over re-renders and regular transitions of the same property. A CSS animation targeting that property still overrides it. Do not drive the same property with an animated style as well; the two do not compose.
  • When several selectors match at once, the one further right in this fixed order wins, whatever the order of keys in the object: :focus-within < :focus < :hover < :active < :active-deepest.
  • The transition callbacks (onCSSTransition*, animations.md) fire for selector-driven transitions too.

Per-selector behavior

  • :active matches the pressed element and every ancestor declaring :active, so a card with :active also reacts when a button inside it is pressed. :active-deepest matches only the innermost element under the finger that declares a press selector, never an ancestor: put it on a container that should react to presses on its own area but stay still while an inner control is pressed.
  • :hover follows the pointer on mouse, trackpad and stylus. On touch a touch-down turns it on for the touched element and its ancestors declaring :hover, and it stays on until a later touch lands outside the element, or a touch that moved past the touch slop is released elsewhere. It has no -deepest variant. For press feedback use :active.
  • :focus matches the element that holds focus itself: on iOS only a text input being edited, on Android and web any focusable element (a View with focusable, keyboard or D-pad focus). Put it on createAnimatedComponent(TextInput); a wrapping View never matches, give it :focus-within, which matches while the element or any descendant holds focus.
  • On iOS :active and :active-deepest never fire on an element whose resting opacity is 0.01 or lower: UIKit skips those views when hit-testing. Write 0.02, visually identical and touchable.

4.5.x differences

Two 4.5.x behaviors were fixed in 4.6.0: :hover reacted only to a hovering pointer (a finger never triggered it), and a re-render could overwrite a matched selector's value (no property lock). Do not rely on either on 4.5.x.

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