How it works
This loading animation bar is the indeterminate progress bar you see at the top of apps while a page or request loads: a thin track in a faint tint of your color, with a solid segment sweeping from left to right over and over. The track has overflow: hidden and fully rounded ends. Inside it, an absolutely positioned fill takes Segment width percent of the track and is moved with transform: translateX from -100% (fully off the left edge) to a value calculated so it leaves completely on the right.
Since translate percentages refer to the segment's own width, the end position is 100 divided by the segment percentage, times 100%. The tool computes that for you, so changing Segment width never leaves a gap or a jump at the end of the sweep.
Use it for page transitions, file uploads before you know the size, or a bar pinned to the top of a modal. Parameters: Width, Height, Color, Segment width, Duration and Easing. A 2 to 4px height works for a top-of-page bar; 6 to 10px suits a card. The default cubic-in-out easing makes the segment speed up through the middle, which reads as "working" better than linear.
The element uses role="progressbar" with aria-label="Loading" and no aria-valuenow, which is how ARIA expresses an indeterminate state. Once you know real progress, switch to a determinate bar with aria-valuenow and a width or scaleX that matches it.
How do I turn this into a real progress bar with a percentage?
Remove the sweep animation from the fill, set left to 0 and drive its width (or transform: scaleX with transform-origin left) from your progress value. Add aria-valuenow, aria-valuemin="0" and aria-valuemax="100" to the progressbar element and update aria-valuenow as the upload or task advances. A short transition on the changing property smooths out jumpy updates.
Can I pin the bar to the top of the page?
Yes. Wrap it in a fixed container with top: 0, left: 0, right: 0 and a high z-index, and set the track width to 100% instead of a pixel value. Height of 3px is typical for that position. Show it when navigation or a fetch starts and remove it when the request settles.
Is there a GIF version of this progress bar animation?
Yes, the editor can export the same animation as a GIF or MP4 for slides, emails or tools that cannot run CSS. Free exports are 480p with a small watermark; Pro ($8/month) exports up to 1080p without the watermark and adds transparent WebM. The CSS, Tailwind and React code stays free.