animation-performance
Use when an animation is janky, choppy, stutters or drops frames, when choosing which property to animate on performance grounds, when choosing declarative over script-driven motion, or when reaching for a GPU layer. Triggers: animation is janky, stutters, drops frames, laggy drag, choppy shadow, blur is slow, why is my popout laggy, animace seka, trha to. Finds the cause before changing code. Easing, duration and whether to animate are animate; judging motion as a whole is review-animations; writing the fix in a stack is its family skill.
- License 许可
- GPL-3.0
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- animation-performance
- description
- Use when an animation is janky, choppy, stutters or drops frames, when choosing which property to animate on performance grounds, when choosing declarative over script-driven motion, or when reaching for a GPU layer. Triggers: animation is janky, stutters, drops frames, laggy drag, choppy shadow, blur is slow, why is my popout laggy, animace seka, trha to. Finds the cause before changing code. Easing, duration and whether to animate are animate; judging motion as a whole is review-animations; writing the fix in a stack is its family skill.
03 SKILL.md 正文
Animation Performance
Imagine a toast at 30 fps: same easing, same durations, same code, and nobody would care. Performance is not a polish pass after the motion is good; it is what lets good motion register at all. This skill serves the person whose animation drops frames: the question is never "does it look right" but "does each frame finish in time". The developer's own machine is the least representative device the animation will run on, so the bar is a mid-range device, and a 120 Hz screen halves the budget. It does not pick curves or judge whether the motion should exist.
Hard rules
- Animate's property whitelist by default; anything else needs a reason. If a cheaper property gives the same picture, use it even when the expensive one "seems fine".
- Name the cause before changing code. "Promoted a layer, seems smoother" is not a diagnosis.
- Never conclude "it is fine" from a fast machine. Say which findings come from code and which need a recording on a real device.
- Never a catch-all transition, because it animates whatever changes next, layout properties included.
- Which property you animate is yours to control; hardware acceleration is something the platform may grant. Spend the effort on the first.
Symptom to fix
| Symptom | Fix |
|---|---|
| Stutters | animate the whitelisted properties (animate), not size, margin or position |
| Shadow animation choppy | animate a cheaper shadow form, or fade a prepared one |
| Janks only during navigation or loading | move it off the thread that is busy then |
| A library shorthand drops frames on a busy thread | inspect what drives it and move the work off that thread; web-motion holds the Motion-specific form |
| Hand-rolled animation drops frames | no state per frame: write the value, not a re-render |
| Drag gets laggier as the list grows | stop animating an inherited value; set it on the element |
| Blur transition lags | keep animated blur under 20 px (2 px softens a crossfade) |
| Unexpected properties animate | name the properties instead of a catch-all |
| 1 px shift when motion starts or ends | promote the element to its own layer, only once you see it |
The budget
60 fps gives 16.7 ms a frame, 120 Hz gives 8 ms: design against the smaller. A layout pass on a complex page can take over 100 ms, which is a dozen missed frames, not one. Two things decide it: what you animate (work per frame) and where it runs (whether other work can block it).
What you animate. Layout, then paint, then composite; the cost differs by an order of magnitude.
| Tier | Properties |
|---|---|
| Composite only, cheapest | transform, opacity, and where the engine supports it filter, clip and background colour |
| Paint and composite | shadow, corner radius, text colour |
| Layout, paint and composite | size, padding, margin, position, border width |
Swap down a tier: a scale instead of a size; a translate instead of a position or margin; opacity instead of display or visibility; a drop shadow instead of a box shadow. A padding animation and a scale look the same and only one cannot regress on a slow device. Layout properties also move the wrong things: animating a sidebar's left margin re-lays-out the page beside it every frame, a translate does not.
Where it runs. Motion driven by script on the main thread competes with everything else and its frame is late when the thread is busy; declarative motion the platform can hand to the compositor or render thread stays smooth whatever the script does. Watch for motion that plays while the app does heavy work (a page transition, a tab indicator during navigation, anything beside fetching or loading): a tab indicator animated by script dropped frames at the moment the next page loaded, and moving it to declarative motion fixed it. Acceleration is progressive enhancement: percentage transforms are the right call for unknown sizes even where an engine declines to accelerate them, because correctness beats a best-effort optimisation.
Three traps that look correct
- State per frame. A state update on every animation frame, pointer move, scroll or drag re-renders every 16.7 ms and the render alone blows the budget. Write the value to the element, or use a motion value.
- Inherited variables. A drag distance written to a variable that a child's transform reads recalculates styles for every descendant each frame; a drawer lagged past about 20 items with no re-render at all. Set the transform on the element itself.
- Blur. Animated blur gets expensive fast; under 20 px.
Layer promotion (a hint that gives the element its own layer) costs GPU memory per layer and
engines already promote what animates transform or opacity. Add it only after you see the
shift or measured dropped frames, on the element that animates, never on a container.
Script animation is allowed. Main-thread motion only suffers when the app is busy during it. The split: declarative motion for simple motion and anything that plays while the app is busy; a library for complex, interruptible, gesture-driven motion (springs, layout and exit animations, momentum).
Workflow
- Find what animates: a table of element, driver, properties, plays during. Expand catch-all transitions and shorthands into what they really animate.
- Diagnose, in the order each is usually the cause: which properties (layout first, then shadow and corner radius, easy to miss); does the jank coincide with a busy page; is the UI re-rendering per frame; does it worsen as content grows; is an inherited value animated at all; blur over 20 px; and last, layer promotion. Confirm with a recording, not by feel: the profiler's frame view for dropped frames and long tasks, the animation inspector to slow it. Profile on a real mid-range device; CPU throttling on a desktop models a slow CPU, not a weak GPU.
- Report each finding as element and
file:line, cause, before, after, and verified (from code or needs a device recording), ordered by cost, layout before paint, busy thread before idle. Then stop; fixes are applied when asked.
Say it in the reply
The animation table, then one block per finding as in step 3, closing with what was verified from code and what still needs a recording on a real device.
How each fix is written and measured on a stack is its family: desktop (desktop-ui, qml-ui), terminal (cli-ui, tui-ui), web (css-ui, react-ui, web-motion).
Adapted from skills/animation-performance/SKILL.md in github.com/emilkowalski/skills, MIT licence, Emil Kowalski.
04 同仓库更多 Skills
worktrunk
Use when working with git worktrees or wt (worktrunk): creating, switching, merging or removing a branch workspace, configuring wt (project or personal config, workflow hooks around switch, commit and merge, commit-message generation, hook approvals), or a wt command that failed. Triggers: make a worktree for this branch, wt merge, wt remove, configure wt, .config/wt.toml, run tests before merge, install deps when a worktree is created, wt hook, wt switch does not cd, nastav wt, wt nefunguje.
web-ladder
Use when a task needs something the internet holds: look something up, search the web, find which page answers a question, read a page, check a library's current docs, a page that needs a browser or shows a captcha. Runs one research loop: searxng search, keywords, cases, search again up to three times, Context7 for a library, Tavily when the keywords will not come, one page in a browser, the person on a wall. Triggers: look this up, search the web, find out online, read this page, check the docs, the page is blocked, captcha, najdi na webu, otevri tu stranku. A multi-round question goes to the qsm-web:web-research agent; one tool's commands are its own skill (searxng, browserbox, opensrc).
searxng
Use when running a web search through the person's own SearXNG instance with qsm-web searxng: choosing a search profile or engines, the instance, time range or language, reading its JSON, a suspended engine. Triggers: search with searxng, qsm-web searxng, search profile, niche search, academic search, IT search, vyhledavaci profil, searxng is down, which engines. The research loop around it is the web-ladder skill.
opensrc
Use when the source code of an open-source library or repository is needed on disk to read: the docs are silent, the behaviour must be checked in code, the version the project pins. Runs qsm-web opensrc get with a package spec or a repository address. Triggers: get the source of this package, clone this library, read the library's code, qsm-web opensrc, stahni zdrojak knihovny. Library docs are the Context7 skill; the research loop is the web-ladder skill.
browserbox
Use when one page needs a real browser through qsm-web browserbox: content built by script, a page that blocks plain fetching, a captcha to solve or hand to the person, a scripted sequence of clicks, a login the person is present for. Triggers: open it in a browser, the page is empty without JavaScript, captcha, take over the browser, run these steps on the page, log in to this site, browserbox. When to reach for a browser at all is the web-ladder skill.
usage
Use when the user wants a review of how they use Claude Code, or setup hands over after a first install: review my Claude Code usage, audit my setup, what does my setup cost, where did my tokens go, clean up my Claude Code, usage report, zkontroluj moje pouzivani. One walkthrough of four stages (machine, work, habits, extensions), questions after each, then one plan. A question about one topic (which hooks are slow) goes to that topic's skill; this session's tokens alone is `/qsm-usage`.