I'm doing an animation with CSS variables, where a CSS variable value changes based on the page scroll. That variable is then used on animation with keyframes.
Originally it's updating correctly only on Firefox. Meanwhile, I found a way to make it work on Chrome too, by forcing a repaint, in this case, animate the color from #000 to #001.
/* --scale is dynamic changed by JS */
@keyframes move {
0% {
transform: translateX(0) scale(var(--scale));
color: #000;
}
100% {
transform: translateX(33vw) scale(1.5);
color: #001;
}
}
You can see a demo at codepen