Skip to main content
rule CX Codex

animation-gpu-properties — Claude Code rule: GPU-friendly animations

animation-gpu-properties — a rule that keeps animations off width, height, top, left, margin and padding and moves them onto transform and opacity, so no layout pass runs per frame.

MIT ★ 1,216 updated 2026-10-24

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add fcakyon/claude-codex-settings
/plugin install react-skills@claude-settings
Open on GitHub

What animation-gpu-properties does

The rule names width, height, top, left, margin and padding as properties to keep out of animations: each frame that touches them re-runs layout. Instead it points to transform (translate, scale, rotate) and opacity, which the GPU draws without a layout pass. The frontmatter marks the impact as HIGH.

Three React Native snippets show the swap. One collapsible panel animates height from 0 to 200, and that is the wrong way. The fixed version keeps height at 200, sets the transform origin to the top, and animates scaleY with opacity. The third snippet slides content in with translateY and a fade.

The snippets import useAnimatedStyle and withTiming from react-native-reanimated. On a project built around a different animation library, those patterns need re-expressing by hand; pasting the code in will not work.

What it helps with

  • replace a height animation in a collapsible panel
  • move a slide-in transition onto translateY
  • audit components for animated margin or padding
  • explain why an expanding panel drops frames
  • rewrite a size transition with scaleY and opacity

Example prompts for the agent

  • Rewrite the panel animation with scaleY and opacity; keep height fixed.
  • Check SlideIn for animated top or margin and switch them to translateY.
  • Find every component that animates width, height or padding.

How to install animation-gpu-properties

1Plugin marketplace

/plugin marketplace add fcakyon/claude-codex-settings
/plugin install react-skills@claude-settings

2Manually: put the files in place

.claude/rules/animation-gpu-properties.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about animation-gpu-properties

How do I install animation-gpu-properties in Claude Code?

Add the marketplace first: /plugin marketplace add fcakyon/claude-codex-settings. Then install the plugin: /plugin install react-skills@claude-settings. The rule file sits at .claude/rules/animation-gpu-properties.md.

What does animation-gpu-properties do?

It tells the agent to keep width, height, top, left, margin and padding out of animations and use transform and opacity instead, so layout is not recalculated per frame.

Which properties can be animated without a layout pass?

transform with translate, scale or rotate, plus opacity. Every other property counts as a layout trigger here.

Source text

animation-gpu-properties.md · MIT
---
title: Animate Transform and Opacity Instead of Layout Properties
impact: HIGH
impactDescription: GPU-accelerated animations, no layout recalculation
tags: animation, performance, reanimated, transform, opacity
---

## Animate Transform and Opacity Instead of Layout Properties

Avoid animating `width`, `height`, `top`, `left`, `margin`, or `padding`. These trigger layout recalculation on every frame. Instead, use `transform` (scale, translate) and `opacity` which run on the GPU without triggering layout.

**Incorrect (animates height, triggers layout every frame):**

```tsx
import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated'

function CollapsiblePanel({ expanded }: { expanded: boolean }) {
  const animatedStyle = useAnimatedStyle(() => ({
    height: withTiming(expanded ? 200 : 0), // triggers layout on every frame
    overflow: 'hidden',
  }))

  return <Animated.View style={animatedStyle}>{children}</Animated.View>
}
```

**Correct (animates scaleY, GPU-accelerated):**

```tsx
import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated'

function CollapsiblePanel({ expanded }: { expanded: boolean }) {
  const animatedStyle = useAnimatedStyle(() => ({
    transform: [
      { scaleY: withTiming(expanded ? 1 : 0) },
    ],
    opacity: withTiming(expanded ? 1 : 0),
  }))

  return (
    <Animated.View style={[{ height: 200, transformOrigin: 'top' }, animatedStyle]}>
      {children}
    </Animated.View>
  )
}
```

**Correct (animates translateY for slide animations):**

```tsx
import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated'

function SlideIn({ visible }: { visible: boolean }) {
  const animatedStyle = useAnimatedStyle(() => ({
    transform: [
      { translateY: withTiming(visible ? 0 : 100) },
    ],
    opacity: withTiming(visible ? 1 : 0),
  }))

  return <Animated.View style={animatedStyle}>{children}</Animated.View>
}
```

GPU-accelerated properties: `transform` (translate, scale, rotate), `opacity`. Everything else triggers layout.

© fcakyon · MIT · fcakyon/claude-codex-settings

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set113

The whole set →
spreadsheet spreadsheet enforces formula-safe workflows, styling standards, and layout checks when working with .xlsx, .csv, and .tsv files. CX Codex +1 ★ 1,216repo stars paper-search-usage paper-search-usage guides coding agents to query academic databases, fetch citation graphs, and download research papers via Paper Search CLI. CX Codex +1 1installs setup setup guides the agent through installing and debugging Paper Search CLI. Replaces Docker MCP with direct CLI calls for paper search and DOI lookup. CX Codex +1 ★ 1,216repo stars review-pr The review-pr skill checks pull requests for bugs, regressions, risky changes, and missing tests. Use it to get a focused list of issues before approving a PR. CX Codex +1 ★ 1,216repo stars rerender-no-inline-components The rerender-no-inline-components rule flags React components declared inside other components, a pattern that causes remounts on parent renders. Use it when state, focus, or scroll position keeps resetting. CX Codex +1 ★ 1,216repo stars state-ground-truth state-ground-truth — a rule that stops agents from storing derived visual values in state. Keeps React and Reanimated logic centered on facts. CX Codex +1 ★ 1,216repo stars ui-styling ui-styling enforces modern React Native styling practices: smooth continuous borders, gap spacing, CSS boxShadow syntax, and native gradients. CX Codex +1 ★ 1,216repo stars ui-measure-views ui-measure-views guides agents to measure React Native view dimensions using useLayoutEffect alongside onLayout without triggering unneeded re-renders. CX Codex +1 ★ 1,216repo stars

Project sponsors

Companies that keep this analytics open