Javatpoint Logo
Javatpoint Logo

CSS Rotate Animation

In this article, we will discuss the CSS rotate animation. We can animate elements to make the web page look eye-catching.

The "animation" property and the "transform" property of CSS allow us to animate HTML elements.

Syntax of properties utilized for rotating the HTML element:

The "transform" is a CSS property that takes value as rotate(degree), and the "animation" is a CSS property that takes value as rotate, time, and duration.

Demonstrations of CSS Rotate Animation

Let us comprehend the CSS rotate animation with the help of demonstrations.

Demonstration 1:

In this demonstration, we will rotate the HTML element so we can define the @keyframes, which is utilized for providing animation. We will utilize the animation and transform property to rotate the div element.

Code:

Output:

Here, in the output below, we can witness the div element. You can write the code on your device to see the live rotation of a div element.

CSS Rotate Animation

Demonstration 2:

We will demonstrate the rotating ring in this demonstration.

Code:

Output:

We can witness the ring in the output below, and you can write the code on your device to see the live rotation of a ring.

CSS Rotate Animation

Demonstration 3:

We will create the two rotating balls in this illustration.

Code:

Output:

Here, in the result downwards, we can witness the two balls. You can compose the code on your device to see the two balls rotating live.

CSS Rotate Animation

Demonstration 4:

We are going to build the rotated image in this illustration. We will utilize the <image> tag to add the image on the web page and rotate the image in a clockwise direction with the assistance of the rotate() function.

Code:

Output:

We can clearly witness the image in the output provided downwards. You can compose the code on your device to see the live rotation of an image.

CSS Rotate Animation

Demonstration 5:

We will construct the image rotating in an anti-clockwise direction with the assistance of the rotate() function.

Code:

Output:

We can witness the image in the output below and you can write the code in your device to see the live rotation of an image.

CSS Rotate Animation

Demonstration 6:

We will rotate the rectangle in this demonstration.

Code:

Output:

We can witness the rectangle in the output below. You can compose the code on your device to see the live rotation of a rectangle.

CSS Rotate Animation

Conclusion

This article has taught us about CSS rotate animation. We can utilize CSS's "animation" and "transform" properties to rotate the HTML element.


Next TopicCSS Rotate Text





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA