0
What the hell is animate tag doing ???? In below code. Pls can some one explain me
<svg width="1000" height="250"> <rect width="150" height="150" fill="orange"> <animate attributeName="x" from="0" to="300" dur="3s" fill="freeze" repeatCount="2"/> </rect> </svg>
1 Resposta
+ 1
The animate element is used to animate an attribute or property of an element over time.
The attributeName attribute indicates the name of the CSS property or attribute of the target element that is going to be changed during an animation.
It is not shown but <rect> has an x="0" and y="0" (x,y axis) attribute that controls the position of the element.
So animate attributename="x" from="0" to="300"
Means animate the x attribute from x0 location to x300 along the x axis
Thus <rect> appears to moves from x0 to x300
dur means duration, eg. how long will it take for the movement.
Fill defines the final state of the animation.
freeze (Keep the state of the last animation frame) | remove (Keep the state of the first animation frame)
repeat count means how many times the animation will complete.
I hope this information helped. Happy coding!