agentsclimarketplace

Viewport aware animation pausing

Skill ychampion/cskill-agents/agents/claude-code/skills/viewport-aware-animation-pausing

Stop updating animation ticks as soon as the animated element leaves the viewport so scrollback never forces terminal resets.From its SKILL.md

Install
npx -y skills add ychampion/cskill-agents --skill viewport-aware-animation-pausing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.9 KB, 336 tokens by cl100k_base, as published. Nobody here has run it

SKILL: Viewport-Aware Animation Pausing

Domain: terminal-ui Trigger: Use when terminal animations should stop updating as soon as they scroll out of view, so hidden widgets do not keep forcing redraws. Source Pattern: Distilled from reviewed terminal rendering, layout, animation, and accessibility implementations.

Core Method

Attach each animated widget to visibility state from the terminal viewport. Drive animation ticks only while the widget is actually visible, and freeze the last rendered frame when it scrolls out of view. When the widget becomes visible again, resume from the cached frame instead of recomputing hidden updates. This keeps scrollback stable and avoids unnecessary full-screen resets.

Key Rules

  • Derive visibility from the animation container itself, not from a global assumption that the whole screen is visible.
  • Stop scheduling animation frames while the widget is hidden, then resume cleanly when it returns.
  • Cache the last rendered frame while hidden so the UI can reuse a stable subtree instead of repainting needlessly.
  • Keep viewport visibility and animation scheduling aligned so hidden widgets never force redraw work.

Example Application

For any animated mascot inside a scrollable log, hook the animation container to the viewport hook and deliver the cached subtree when the log scrolls past it; the animation silently stops while the user scrolls and picks up exactly where it left off.

Anti-Patterns (What NOT to do)

  • Continuing to update the shared clock after the animation leaves the viewport.
  • Recreating new React elements on each render while the component is hidden, which defeats the freeze optimization.
  • Depend on global periodic timers that run even when the widget is out of view.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.