If you're looking for a solution, I recommend checking out this post: How to Fill a percentage of an SVG and animate the fill
One approach is to generate an SVG shape such as a star:
<svg width="100px" height="100px" viewBox="0 0 100 100"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<polygon fill="red" stroke="blue" stroke-width="10"
points="350,75 379,161 469,161 397,215
423,301 350,250 277,301 303,215
231,161 321,161" />
</svg>
You can then add a linear gradient to it like this:
<linearGradient y2="100%" x2="100%" y1="100%" x1="0%" id="F1g">
<stop stop-color="#00FF00" offset="0%" id="F1gst1"/>
<stop stop-color="#FFFFFF" offset="0%" id="F1gst2"/>
</linearGradient>
This method is quicker to implement, more adaptable, and uses less network resources compared to generating multiple images with gradual changes.