StealThis .dev

Game — Health / Mana / XP Bar Variants

A neon sci-fi HUD showcase of six game stat-bar variants: a segmented ten-cell health bar, a gradient health bar with a delayed damage-chip trail, a shield-over-health stack that absorbs hits first, a self-regenerating mana bar, an XP bar with level-up overflow flash, and a centered boss banner with phase ticks. Combat-sim buttons deal damage, heal, cast spells and grant XP, driving fill animations, color thresholds, bar shake, toasts and a pulsing low-health red vignette.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Health / Mana / XP Bar Variants

A dark, angular HUD-styled gallery of the stat bars every game UI needs. Six variants sit in clipped-corner panels: a segmented health bar built from ten beveled cells (with a partial-cell warning state), a smooth gradient health bar where a red “damage chip” trails behind the real fill, a stacked bar where a cyan shield absorbs damage before green health, a violet mana bar that passively regenerates 4 MP per second, an XP bar with a level orb, and a boss-style centered name plate with a long, phase-ticked health bar.

Everything is driven by one shared combat simulator. Damage buttons drain health (shield first on the stacked bar), heal restores it, casting a spell spends mana and grants a trickle of XP, and the XP button can overflow the bar — triggering a strobing LEVEL UP flash, a popping level orb and a carry-over of the remaining XP into the next level. Bars shake on impact, switch from green to amber to pulsing red as health drops, and below 30% health a red vignette pulses around the whole viewport.

The fills animate with transform: scaleX() for cheap GPU compositing, the chip trail uses a longer delayed CSS transition rather than JS timers, and every meter exposes role="meter" with live aria-valuenow updates. A small toast() helper narrates each event via aria-live, and reduced-motion preferences collapse all animation.

Illustrative UI only — fictional games, studios, characters, and data. Not engine integrations.