HTML DOM Style animation Property Last Updated : 13 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The style animation property makes it possible to animate transitions from one CSS style to another CSS style. It configures the timing, delay, duration, and other details of how the sequence of animation should progress. The animation contains two components, one is CSS describing the component and another is a set of keyframes that indicate the start and end states of styles. Syntax: It is used to return the animation property object.style.animationIt is used to set the animation property object.style.animation="name duration timingFunction delay iterationCount direction fillMode playState" Property Values animationName: Describes the name of the keyframe attached to the selector.animationDuration: Describes the time and how long an animation takes place.animationTimingFunction: Describes the speed of the animation.animationDelay: Describes the delay before the animation will start.animationIterationCount: Describes the number of times an animation takes place.animationDirection: Describes if the animation should play in reverse on alternate cycles.animationFillMode: Describes what values to apply when the animation ends.animationPlayState: Describes whether an animation is running or paused. Return Values: It returns a string value that represents the animation property of an element. Example 1: In this example, we will use DOM Style animation Property HTML <!DOCTYPE html> <html> <head> <style> #GFG { width: 90px; height: 90px; background: green; color: white; position: relative; text-align: center; /* -webkit- is used for safari browser */ -webkit-animation: GFG_Move_1 1s infinite; animation: GFG_Move_1 1s infinite; } /* For Opera, Chrome and Safari browser */ @-webkit-keyframes GFG_Move_1 { from { left: 250px; } to { left: 500px; } } /* For Opera, Chrome and Safari browser */ @-webkit-keyframes GFG_Move_2 { from { left: 350px; top: 0px; } to { left: 350px; top: 200px; } } @keyframes GFG_Move_1 { from { left: 250px; } to { left: 500px; } } @keyframes GFG_Move_2 { from { left: 350px; top: 0px; } to { left: 350px; top: 200px; } } </style> </head> <body> <button onclick="myGeeks()"> Change Animation </button> <p> Click on button to change the animation. </p> <script> function myGeeks() { /* This code run on safari browser */ document.getElementById("GFG").style.WebkitAnimation = "GFG_Move_2 4s 2"; document.getElementById("GFG").style.animation = "GFG_Move_2 4s 2"; } </script> <div id="GFG">GFG</div> </body> </html> Output: Example 2: In this example, we will use DOM Style animation Property HTML <!DOCTYPE html> <html> <head> <title> HTML DOM Style animation Property </title> <style> #GFG { width: 90px; height: 90px; background: green; position: relative; color: white; text-align: center; /* /* For Opera, Chrome, Safari*/ -webkit-animation: GFG_Move_1 1s infinite; animation: GFG_Move_1 1s infinite; } /* For Opera, Chrome, Safari*/ @-webkit-keyframes GFG_Move_1 { from { left: 0px; } to { left: 90px; } } /* For Opera, Chrome, Safari */ @-webkit-keyframes GFG_Move_2 { from { top: 0px; background: green; width: 100px; } to { top: 200px; background: yellow; width: 150px; height: 150px; } } @keyframes GFG_Move_1 { from { left: 0px; } to { left: 95px; } } @keyframes GFG_Move_2 { from { top: 0px; background: green; width: 100px; } to { top: 200px; background: yellow; width: 150px; height: 150px; } } </style> </head> <body> <button onclick="myGeeks()"> Change Animation </button> <p> Click on button to change the animation. </p> <script> function myGeeks() { /* For Opera, Chrome, Safari */ document.getElementById("GFG").style.WebkitAnimation = "GFG_Move_2 4s 2" document.getElementById("GFG").style.animation = "GFG_Move_2 4s 2"; } </script> <div id="GFG">GFG</div> </body> </html> Output: Supported Browsers: The browser supported by Style animation Property are listed below: Google Chrome 43 and aboveEdge 12 and aboveInternet Explorer 10.0 and aboveMozilla Firefox 16.0 and aboveOpera 30.0 and aboveSafari 9.0 and above Comment More infoAdvertise with us P PranchalKatiyar Follow Improve Article Tags : Web Technologies HTML Web technologies HTML-DOM HTML-Property +1 More Similar Reads HTML DOM cancelable Event Property The cancelable event property indicates whether the event's default action can be prevented. If the value is true, the default action can be prevented using event.preventDefault(). If false, the default action cannot be prevented. It is a read-only property.It is a read-only boolean property.Syntax: 1 min read HTML DOM Style borderImageRepeat Property The borderImageRepeat style property in HTML DOM is used to set or return the borderImageRepeat property. It specifies whether the border image should repeat to fill the area, stretched to fill the area, set to the initial value, inherit property from its parent, etc. Depending on the need it will b 4 min read HTML | DOM Style borderImageOutset Property In the Style borderImageOutset Space which contains the border, image is to be painted is called the border-image space. By default, the boundaries of the border image area match with the boundaries of the elementâs border-box. However, these boundaries can be extended using the border-image-outset 4 min read HTML | DOM Figcaption Object The Figcaption Object in HTML DOM is used to represent the HTML <figcaption> element. The figcaption element is accessed by getElementById(). Syntax: document.getElementById("ID"); Where ID represent the element id. Example 1: html <!DOCTYPE html> <html> <head> <title> 2 min read HTML | DOM Style backgroundRepeat Property The backgroundRepeat property in HTML DOM is used to set or return the CSS backgroundRepeat property. It also checks whether the background-image is repeated or not. Syntax: It is used to returns the backgroundRepeat property.object.style.backgroundRepeat It is used to set the backgroundRepeat prope 2 min read HTML | DOM DList Object The DOM DList Object is used to represent the HTML <dl> tag. The Dlist element is accessed by getElementById(). Syntax: document.getElementById("ID");< Where âidâ is the ID assigned to the âdlâ tag.Example-1: html <!DOCTYPE html> <html> <head> <title>HTML DOM DList O 2 min read HTML DOM insertBefore() Method The insertBefore() method in HTML DOM is used to insert a new node before the existing node as specified by the user. Syntax: node.insertBefore( newnode, existingnode ) Parameters: This method accepts two parameters as mentioned above and described below: newnode: It is the required parameter. This 2 min read HTML DOM attributes Property The attributes property in HTML DOM returns the group of node attributes specified by NamedNodeMap objects. The NamedNodeMap object represents the collection of attribute objects and can be accessed by index number. The index number starts at 0. Syntax: node.attributes Return Value: It returns the N 2 min read HTML| DOM Variable Object The DOM Variable Object is used to represent HTML <var> element. The var element is accessed by getElementById(). Syntax: var element = document.getElementById("ID"); Where âidâ is the ID assigned to the âvarâ tag. Example-1: HTML <!DOCTYPE html> <html> <head> <title>HT 2 min read HTML DOM Style borderBottomLeftRadius Property The borderBottomLeftRadius property in HTML DOM is used to set or return the radius of the border of the bottom-left corner. Syntax: It returns the borderBottomLeftRadius Property.object.style.borderBottomLeftRadiusIt is used to set the borderBottomLeftRadius property.object.style.borderBottomLeftRa 2 min read Like