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
/plugin marketplace add fcakyon/claude-codex-settings
/plugin install react-skills@claude-settingsWhat 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
scaleYandopacity; keepheightfixed. - Check
SlideInfor animatedtopormarginand switch them totranslateY. - Find every component that animates
width,heightorpadding.
How to install animation-gpu-properties
1Plugin marketplace
/plugin marketplace add fcakyon/claude-codex-settings/plugin install react-skills@claude-settings2Manually: put the files in place
.claude/rules/animation-gpu-properties.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/animation-gpu-properties.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/animation-gpu-properties.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/animation-gpu-properties.mdManually: put the files in place
.clinerules/animation-gpu-properties.mdStep 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