css-transitions
CSS transitions and keyframe animation guardrails — transition/animation properties, will-change, class-based sequencing
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- css-transitions
- type
- planning
- parent
- animation-design-planner
- version
- v0.0
- invocation
- sub-skill
- description
- CSS transitions and keyframe animation guardrails — transition/animation properties, will-change, class-based sequencing
02 资源文件 5
- 脚本scripts/draw_gc_content.py4.1 KB
- 脚本scripts/draw_gene_map.py4.5 KB
- 脚本scripts/draw_plasmid.py4.0 KB
- 脚本scripts/draw_restriction_map.py4.9 KB
- 脚本scripts/draw_sequence_logo.py4.6 KB
03 SKILL.md 正文
CSS Transitions Implementation Guardrails
Invoke as $animation-design-planner frameworks/css-transitions.
This subskill provides CSS transition and keyframe animation guardrails for step 5 of $animation-design-planner. It is invoked automatically when the parent detects CSS-based animation patterns in the project. All baseline guardrails from the parent (transform/opacity preference, reduced-motion, focus/pointer/scroll/z-index rules) still apply.
Guardrails
Sequencing and orchestration
- Use
transitionfor two-state toggles; use@keyframes animationfor multi-waypoint or looping motion. - Chain sequences via
transitionend/animationend— always filter bypropertyNameoranimationNamebecause shorthand declarations fire one event per sub-property. - Stagger children via
animation-delaycombined with a CSS custom property per child (e.g.--i), not JSsetTimeout. - Class toggle order: apply in the same frame. If phase B depends on phase A completing, chain via the end event — do not assume matching durations.
will-change lifecycle
- Apply
will-changejust before the animation starts and remove it after the animation ends. - Permanent
will-changeforces a compositor layer and creates a new stacking context — document explicitly if intentionally kept. - Never use
will-change: contentsorwill-change: scroll-positionspeculatively.
Forced reflow and paint triggers
- The reflow trap: reading a layout property then writing a style in the same synchronous block forces synchronous layout. Batch reads before writes.
- Void-to-value trick: force a reflow between DOM insertion and class addition with
el.offsetHeightto ensure the browser registers the initial state before animating. - Double-rAF pattern (
requestAnimationFrame(() => requestAnimationFrame(() => { ... }))) for maximum reliability on enter transitions when the single-frame trick is insufficient.
Exit animation patterns
- CSS has no animate-then-remove primitive: add an exit class, listen for the end event, then remove the element from the DOM.
- Race guard — the end event never fires if the property isn't actually transitioning. Always set a
setTimeoutfallback matching the expected duration. - Race guard — shorthand fires per sub-property. Filter by
propertyNameor designate a single canonical property for the event listener. - Use
animation-fill-mode: forwardsto hold the final state while DOM removal runs. Remove the element promptly — do not rely onforwardsindefinitely as it holds the compositor layer.
Proof expectations
transitionendfires exactly once for the intended property on each transition.- Rapid toggle (open/close, show/hide) produces no stuck mid-animation states.
will-changeis removed after completion (verify in DevTools Layers panel).prefers-reduced-motion: reducesuppresses or collapses all motion.- Slow-motion review (set durations to 2–3s) confirms sequencing matches the animation contract.
04 同仓库更多 Skills
source-checkout-allowed
Valid source-checkout-only fixture.
deck-install-valid
Valid deck install fixture.
codex-pack-guard-valid
Valid Codex Pack Availability Guard fixture.
codex-missing-skill-valid
Valid Codex missing skill fallback fixture.
codex-base-skill-fallback-valid
Valid Codex base skill fallback fixture.
claude-pack-guard-valid
Valid Claude Pack Availability Guard fixture.