SVG restart Attribute Last Updated : 23 Jul, 2025 Comments Improve Suggest changes 1 Likes Like Report The restart attribute is used to decide whether an animation will restart or not. The attribute is used by the <animate>, <animateColor>, <animateMotion>, <animateTransform> and <set> elements.Syntax:restart="always | whenNotActive | never"Attribute Values: This attribute accepts three values as mentioned above and described below:always: It specifies that the animation can always be restarted.whenNotActive: It specifies that the animation can only be restarted when it is not active. If one tries to restart the animation during its active duration then those attempts are ignored.never: It specifies that the animation cannot be restarted for the time the document is loaded.The below examples illustrate the use of this attribute:Example 1: HTML <!DOCTYPE html> <html> <body> <div style="color: green;"> <h1>GeeksforGeeks</h1> <svg viewBox="0 0 520 200" xmlns="https://www.w3.org/2000/svg"> <rect y="30" x="10" width="60" height="60" fill="green"> <animate attributeName="x" from="10" to="50" dur="1s" repeatCount="1" restart="always" /> </rect> <a id="geeks" style="cursor: pointer;"> <text style="font-size: 10px;" y="10"> On Clicking here, the animation will restart </text> <text style="font-size: 10px;" y="20"> even if it is currently in animation. </text> </a> </svg> </div> <script> document.getElementById("geeks") .addEventListener("click", event => { document.querySelector("animate") .beginElement(); }); </script> </body> </html> Output:Example 2: HTML <!DOCTYPE html> <html> <body> <div style="color: green;"> <h1>GeeksforGeeks</h1> <svg viewBox="0 0 520 200" xmlns="https://www.w3.org/2000/svg"> <rect y="30" x="10" width="60" height="60" fill="green"> <animate attributeName="x" from="10" to="50" dur="1s" repeatCount="1" restart="whenNotActive" /> </rect> <a id="geeks" style="cursor: pointer;"> <text style="font-size: 10px;" y="10"> On Clicking here, the animation will only </text> <text style="font-size: 10px;" y="20"> restart when it is not currently active. </text> </a> </svg> </div> <script> document.getElementById("geeks") .addEventListener("click", event => { document.querySelector("animate") .beginElement(); }); </script> </body> </html> Output: Comment T thacker_shahid Follow 1 Improve T thacker_shahid Follow 1 Improve Article Tags : Web Technologies HTML HTML-SVG SVG-Attribute Explore HTML BasicsHTML Introduction5 min readHTML Editors5 min readHTML Basics7 min readStructure & ElementsHTML Elements5 min readHTML Attributes8 min readHTML Headings4 min readHTML Paragraphs5 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks3 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables10 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics6 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List15+ min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like