Clay lamp animation by Learn code free online.
beautiful clay oil lamp animation. in this project we will see smoothing fire on clay lamp animation with pure css. we are going to use svg image for clay oil lamp here. so let's start with the html code for lamp. see the below code:
and here is html code for fire on lamp. we need only one div element for it. see the below html code:
here is css code for fire animation. In the below css code body_name is the class name for body tag.
.body_one{
width:1300px;
height: 800px;
background: black;
}
and now this is css code for fire div element, we have used ::before and ::after pseudo elements fto create different colors of flame:
svg{
z-index: 0;
}
.fire{
position:absolute;
top: 20px;
left: 410px;
z-index: 1;
width: 140px;
height: 350px;
border-radius: 50%;
border-top-left-radius: 25%;
border-top-right-radius: 1925%;
background: radial-gradient(circle, rgba(255, 132, 0, 0.83) 0%, rgba(213,172,36,0) 69%);
filter: blur(3px);
transform:rotate(-45%);
animation: light 1.5s linear infinite;
}
.fire::before{
content: '';
position:absolute;
top: 100px;
left: 5px;
width:130px;
height: 250px;
border-radius: 50%;
border-top-right-radius: 0;
background: radial-gradient(circle, rgba(252, 182, 0, 0.83) 0%, rgba(213, 98, 36, 0) 69%);
z-index: 0;
}
.fire::after{
content: '';
position:absolute;
top: 170px;
left: 20px;
width:100px;
height:150px;
border-radius: 50%;
background: radial-gradient(circle, rgba(249, 249, 249, 0.83) 0%, rgba(255, 255, 255, 0) 69%);
filter: blur(6px);
z-index: 2;
}
@keyframes light{
20%{
border-top-left-radius: 1925%;
border-top-right-radius: 25%;
transform:translateY(0px);
}
60%{
transform:translateY(-20px);
}
100%{
border-top-left-radius: 25%;
border-top-right-radius: 1925%;
transform:translateY(0px);
}
}
Copyright2022 Learn code free online. All Rights Reserved.