How to Make Rolling Tire Animation with Pure CSS Code?
animated rolling tire image

How to Make Rolling Tire Animation with Pure CSS Code?

Rolling Tire Animation: In this lesson we will learn how to create an animated tire with only CSS Code. You could download the code at this post bottom. Follow us for more free lessons.

This lesson is a part of an animated loading page course. These lessons is supported with: SAFHATECH.COM.

You could see the other videos and lessons by going to safhatech.com and going to categories. From the navigation bar and then loading at design.

The order of this lesson is like this:

  • Creating empty HTML file then add HTML code.
  • Creating empty style-sheet file and then adding CSS style.

Lesson 14

This Video explain the same topic ” Rolling Tire Animation”:

https://youtu.be/jEyZ4aGHCYU

Creating empty HTML file then add HTML code.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="style.css" type="text/css" rel="stylesheet">
</head>
<body>

<div class="container">
    <div class="tire">
    <div class="line1"></div>
    <div class="line2"></div>
    <div class="line3"></div>
</div>
</div>
</body>
</html>

Creating empty style-sheet file and then adding CSS style:

body {
    margin: 0;
    padding: 0;
    background-color: #0b3054;
}
.container{
    position: absolute;
    top:50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 300px;
    height: 70px;
    background: transparent;
    border-bottom: 5px solid #ffffff ;
    animation: animate1 5s linear infinite;
}
.tire{
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 50px;
    background: #303030;
    border-radius: 50%;
    border: 7px solid #1e1e1e;
    animation: animate2 5s linear infinite;
}
.line1,.line2,.line3{
    position: absolute;
    top:50%;
    width: 50px;
    height: 3px;
    background-color: white;

}
.line2{
    transform: rotate(60deg);
}
.line3{
    transform: rotate(120deg);
}
@keyframes animate2 {
    0%{
        transform: rotate(0deg);
        left:0;
    }
    50%{
        transform: rotate(360deg);
        left:calc(100% - 50px);
    }
    100%{
        transform: rotate(0deg);
        left:0;
    }

}
@keyframes animate1 {
 0%{
     transform: translate(-50%,-50%) rotate(30deg);
 }
 25%{
     transform: translate(-50%,-50%) rotate(0deg);
 }
 50%{
     transform: translate(-50%,-50%) rotate(-30deg);
 }
 75%{
     transform: translate(-50%,-50%) rotate(0deg);
 }
 100%{
     transform: translate(-50%,-50%) rotate(30deg);
 }
}

Finally: You could Download the code from here:



Consequently You could follow us at :

Website URL: https://www.safhatech.com/

YouTube: https://www.youtube.com/channel/UCIVzh6iykNowNcOUT5Gfasw

Twitter: http:// https://twitter.com/safhatech

Instagram: https://www.instagram.com/safhatech

Facebook: http:// https://www.facebook.com/Safhatech-487171875443687

Phone: 967778283416



Leave a Reply