Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

data-morph

Animate an element's clip-path between matching shapes: pulse, breathe, wave. One cycle by default; data-morph-loop loops with pause on hover, focus, data-paused and reduced motion.

Overview

data-morph animates an element's clip-path between two shape() paths with the same points, so its edges throb, breathe or undulate. It is pure CSS keyframes in the utils layer, behind @supports.

By default the animation runs once (2.5 to 4 seconds) and the element ends as a plain rectangle. Add data-morph-loop to keep it going.

Usage

Options

ValueMotionDuration
pulseThe edges draw in by half the depth and back out3s
breatheA curved bottom edge morphs into a curved top edge4s
waveThe top and bottom edges undulate2.5s
AttributeEffect
data-morph-loopRepeat forever instead of running once. The loop pauses on hover and while the element or any ancestor has data-paused.
data-pausedOn the element or an ancestor: pauses a loop. The same attribute pauses VB's other effects, so one page-level pause button can stop them all.

Styling

Custom propertyDefaultEffect
--shape-morph-depth0.75remHow far the shape cuts into the element. Elements other than media (img, video, canvas, svg, picture, iframe) get this much padding by default, so text is not clipped.

Your own padding wins over the default; keep it at least --shape-morph-depth. Override animation-duration or animation-timing-function as usual: the cyber theme uses steps(8) for a glitchy feel and kawaii a bouncy easing.

A morph needs the element's clip-path to itself. On an element that also has data-clip, data-cutout, data-border-shape, data-shape-start or data-shape-end the animation is skipped and the static shape stays. Any other clip-path on the element is replaced while the animation runs.

Accessibility

  • Pause, Stop, Hide (WCAG 2.2.2). The default single cycle stops within 5 seconds. A data-morph-loop runs indefinitely, so give users a way to stop it: it pauses on hover and stops while focus is inside it, and a toggle that sets data-paused (on the element or the page) pauses it for good.
  • prefers-reduced-motion: reduce turns the animation off, as do forced colours mode and print.
  • While focus is inside the element the animation is removed entirely, so the clip never cuts off a focus ring.
  • Use it on decorative surfaces. The motion carries no meaning, and the text inside must be readable without it.

Examples

Pulse and breathe run once; the wave card loops (hover it to pause).

Theme showcases

↑