A slightly better solution can be done using @property and css variables.
@property --rotate {
syntax: '<angle>';
initial-value: 0deg;
inherits: false;
}
.gradient-button {
animation: rotate-gradient 1s linear infinite;
background-image: linear-gradient(var(--rotate), red, yellow, green);
}
@keyframes rotate-gradient {
from {
--rotate: 0deg;
}
to {
--rotate: 360deg;
}
}
<button id="fill" class="gradient-button">Fill Form</button>