Loading...
.progress-bar {
animation: grow linear;
animation-timeline: scroll(self);
}.progress-bar {
transform-origin: left;
animation: grow linear;
animation-timeline: scroll(root);
}
@keyframes grow {
from { transform: scaleX(0); }
}The bar itself doesn't scroll, so 'self' never moves it; 'root' follows the page scroll.
animation-timeline: scroll() is declared after the animation shorthand.@supports, and the page works without it.@media (prefers-reduced-motion: reduce).scroll() uses the 'nearest' ancestor scroll container and the 'block' axis.
Use scroll() when progress follows how far a container is scrolled. Use view() when it follows one element moving through the scrollport.