Viewport aware animation pausing

From ychampion/cskill-agents · View interactive version

Viewport aware animation pausing is an AI agent skill from the GitHub repository ychampion/cskill-agents. Stop updating animation ticks as soon as the animated element leaves the viewport so scrollback never forces terminal resets.

How to use this skill

Skill file

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

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)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.