mantine-border-animate 3.1.0 — a border that knows when to stop, and when nobody is looking.
Finite laps. iterations={2} runs the animation twice and stops exactly where the last lap ends, with no jump back; onComplete fires once at that moment. So a border can mark an event — a job that started, a save that went through — and then step aside.
Free while off-screen. Browsers keep running CSS animations that are scrolled out of view: measured in Chrome, 12 off-screen rings recalculated styles on every frame and took up to 1.4 s of main-thread time every 10 s. The default trigger now pauses them through an IntersectionObserver, and on the way back moves each animation's currentTime forward by the time it spent paused, so the ring is exactly where it would have been and staggered borders stay in step. A finite run is never paused, so its onComplete never waits for a scroll.
Reduced motion, per component. respectReducedMotion={true} keeps the border still for people who ask their system for less motion, whatever the theme says; left unset, it follows theme.respectReducedMotion as before. A still beam rests where progress puts it. And onComplete still fires: under reduced motion the animations get zero length instead of animation: none, and a zero-length animation still dispatches animationend (checked in Chromium and Firefox, paused ones included).
Also: the default wedge is now a bell of brightness that fades in and out with no visible edge, and colorStops colour the comet's tail from head to end.
https://gfazioli.github.io/mantine-border-animate/
#Mantine #React #WebDev #CSS #Accessibility #FrontEnd