Skip to content

3.1.0

Choose a tag to compare

@gfazioli gfazioli released this 24 Nov 18:12
· 4 commits to master since this release

✨ Features

  • Finite laps: iterations and onComplete. Give iterations a number of laps (2, or 0.5 for half a lap; 'infinite' stays the default) and the border runs that many times, then stops exactly where its last lap ends, with no jump back. onComplete fires once at that moment. A border can now mark an event — a job that started, a save that went through — and then step aside. Run it again by toggling show or animate, or with a new key. The draw variant transitions instead of looping, so it ignores both. New demo: Finite Laps.
  • respectReducedMotion prop. true keeps the border still for people who ask their system to reduce motion, whatever the theme says; false keeps it moving; left unset it follows theme.respectReducedMotion, exactly as before. A still beam rests where progress puts it (the same picture as animate={false}), and a finite run calls onComplete right away instead of leaving it waiting.
  • A multicolour comet. colorStops now colour the comet's tail: position 0 is the head, 100 the end of the tail, and the colours travel with the comet while it fades out.

⚡ Improvements

  • Free while off-screen. A border with the default trigger="always" now pauses while it is scrolled out of the viewport, and when it comes back it catches up on the time it missed, so it is exactly where it would have been: borders staggered with phase stay in step. Browsers do not do this on their own — measured in Chrome, 12 off-screen rings kept costing 230–1400 ms of main-thread time every 10 seconds; paused, nothing. A finite run (see iterations) is never paused, so its onComplete never waits for a scroll.
  • A smoother wedge. The default beamMode="wedge" is now a bell of brightness: it fades in and out with no visible edge, while its colour runs from colorFrom at the back to colorTo at the front. Its width at half brightness is the same as before, so spread keeps meaning what it did.

🐛 Bug Fixes

  • Under reduced motion (theme.respectReducedMotion), the dot and the wedge now rest at progress, like animate={false}; they used to sit at the start of the path.

🛠️ Other

  • --border-animate-beam-start, -from, -to and -end are deprecated and no longer read: the wedge's stops come from spread through the new --border-animate-beam-stops. They stay in the CSS variables type, so vars overrides written for 3.0 still compile.
  • New CSS variables: --border-animate-iterations and --border-animate-beam-stops.

What's Changed

  • ✨ Beam: pause off-screen, finite laps, reduced motion per component, a continuous tail (#57) by @gfazioli in #58

Full Changelog: 3.0.14...3.1.0