I'm exploring how to animate an HTML element's attribute using CSS and looking for guidance.
While I am aware that you can retrieve an attribute using the attr()
CSS function, I am unsure about how to modify it. Specifically, I am attempting to animate the gradientTransform
attribute of my svg
element. I attempted to accomplish this using JavaScript, but I am unsure how to achieve the same infinite animation effect as in CSS.
<defs>
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="0%" gradientTransform="rotate(65)">
<stop offset="0%" stop-color="hsl(220, 60%, 60%)" stop-opacity="1" />
<stop offset="100%" stop-color="hsl(280, 60%, 60%)" stop-opacity="1" />
</linearGradient>
</defs>
My goal is to continuously rotate (alter) the gradientTransform
attribute mentioned above.