sine-wave-loop — Claude Code rule: what it does, how to install
sine-wave-loop — a GSAP rule that gives a settled scene element light jitter, or one bounded breathing loop, driven by Math.sin once its entry animation ends.
AGPL-3.0 ★ 78,316 updated 2026-10-24
.claude/rules/sine-wave-loop.mdWhat sine-wave-loop does
The rule teaches the agent to keep a held element from looking frozen in an HTML and GSAP scene. One long tween moves a phase value from 0 to 2π, and each onUpdate turns it into a small Math.sin offset for scale or translateY. Since sin(0) is 0, the idle begins exactly where the entry animation stopped, so nothing jumps.
The file holds a scene template with a headline and an accent dot that pulses out of phase with it, built on GSAP loaded from CDN as [email protected]. Variants layer a second, faster frequency on top or fade the amplitude to zero over the last 20% of the idle, which the rule recommends once idle runs past 6 s. Values like SCALE_AMP and IDLE_DUR are placeholders you fill in.
The rule itself says to reach for it last. Reveal lines as the voiceover gets to them first, then try light jitter. A full breathing loop is meant for a single hero element, so don't let the agent put it on every headline.
What it helps with
- Keep a settled headline from looking frozen with light jitter
- Move from an entry animation into idle with no visible jump
- Pulse an accent dot out of phase with the headline
- Fade idle motion to rest before a scene transition
- Fit a set number of sine cycles into a given idle length
Example prompts for the agent
- Apply the sine-wave-loop rule: add subtle jitter to the headline after its entry animation.
- Use sine-wave-loop to give the hero one bounded breathing loop, with the amplitude fading out over the last 20% of idle.
- Make the accent dot pulse out of phase with the headline, following the sine-wave-loop rule.
How to install sine-wave-loop
Manually: put the files in place
.claude/rules/sine-wave-loop.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/sine-wave-loop.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/sine-wave-loop.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/sine-wave-loop.mdManually: put the files in place
.clinerules/sine-wave-loop.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about sine-wave-loop
How do I install sine-wave-loop in Claude Code?
Save the rule file as .claude/rules/sine-wave-loop.md.
What does sine-wave-loop do?
It drives small Math.sin offsets from a GSAP tween, so a held element in a scene keeps a trace of motion after its entry animation.
Why does the rule say to use it last?
It treats scaling text up and down as a cheap trick. It prefers revealing elements in time with the voiceover, then light jitter, and keeps the full breathing loop for one hero element.