CYBERCN
CyberCN UI
Components

Motion and effects

Glitch animations, timing tokens, and reduced-motion behavior from cybercn.css.

Motion and effects

CyberCN’s motion layer lives in components/ui/cybercn/styles/cybercn.css. Import that stylesheet (see Getting Started) so keyframes, duration variables, and Tailwind theme animations are available.

Timing variables

Glitch-style animations read shared durations from :root:

VariableDefaultRole
--glitched-duration-short1sButtons, list items, link underline scan, heading cursor
--glitched-duration-long3sHorizontal rules, wide scan lines

Override them in your global CSS next to other CyberCN tokens:

:root {
  --glitched-duration-short: 0.75s;
  --glitched-duration-long: 2.5s;
}

Tailwind animation utilities

cybercn.css registers animations under Tailwind’s @theme. Each --animate-* entry becomes an animate-* utility.

UtilityKeyframesTypical use
animate-glitch-hrglitch-hrHr with glitched (geometry still comes from .cyber-hr / clip-hr)
animate-button-hoverbutton-hover.cyber-button hover / focus (main label)
animate-button-hover-beforebutton-hover-before.cyber-button hover / focus (::before frame)
animate-button-hover-afterbutton-hover-after.cyber-button hover / focus (::after tag), .cyber-p hover on ::before
animate-scanned-hscanned-h.scanned-h::after horizontal scan bar
animate-scanned-vscanned-v.scanned-v::after vertical scan bar
animate-scanned-ascanned-aDefault a:hover::after underline
animate-li-glitchedli-glitchedList items with glitched
animate-h1-glitchedh1-glitchedHeading glitched (all levels use this keyframe set in the component API)
animate-h2-glitchedanimate-h4-glitchedh1-glitchedAlternate timings defined in CSS; use manually if you are not using Heading
animate-h1-before-glitchedh1-before-glitchedHeading glitched + h1 (before: pseudo)
animate-h2-before-glitchedh2-before-glitchedHeading glitched + h2 (before: pseudo)

The theme also defines --animation-hx-after for the blinking _ on .cyber-heading and .cyber-p::after (hx-after keyframes). Those rules use a raw animation declaration rather than a dedicated animate-* utility.

What components animate for you

You do not need to add animate-* classes yourself for:

  • Links — base a styles; hover runs animate-scanned-a on the underline pseudo-element.
  • Heading — with glitched, combines animate-h1-glitched with level-specific before: animations or cyber-heading-h3-h4-glitched for h3 / h4.
  • Hr — with glitched, applies animate-glitch-hr (often together with clip-hr-glitched from the HR variants).
  • Button — hover / focus drives the three button-hover* animations on .cyber-button.
  • Paragraph::before can use animate-button-hover-after on hover; ::after uses hx-after.
  • List — item variant glitched adds animate-li-glitched plus staggered durations via :nth-child rules on .animate-li-glitched.

Building blocks: scan wrappers

Add scanned-h or scanned-v on a positioned container; CSS paints a neon bar on ::after with animate-scanned-h or animate-scanned-v. Both classes set position: relative for layout.

Reduced motion

Inside @layer base, cybercn.css applies a global @media (prefers-reduced-motion: reduce) rule: animations are effectively shortened to one step, iteration count is forced to 1, play state is paused, and transitions are minimized. Users who prefer reduced motion therefore get a largely static UI without extra app code.

See also

On this page