effect
FIG effect as
Realization of ideas
- Using several box-shadow property write circle, these circle scattered together to form a pattern of clouds
- after writing the following pseudo-element projector-style
- before pseudo-element write yellow lightning style
dom structure
With two nested div container on it, the parent container to control the position of the icon display, sub-containers used to write the clouds style. The shadows and lightning style pseudo-elements are used on it, these are defined in the css.
<div class="container">
<div class="stormy"></div>
</div>
css styles
Follow the steps implemented css
1, the first to write parent container style, the way to add the entire page background color, convenient preview
body{
background: rgba(73,74,95,1);
}
.container{
width: 170px;
height: 170px;
position: relative;
margin: 250px auto;
}
专门建立的学习Q-q-u-n ⑦⑧④-⑦⑧③-零①② 分享学习方法和需要注意的小细节,不停更新最新的教程和学习技巧(从零基础开始到前端项目实战教程,学习工具,全栈开发学习路线以及规划)
2, writing style clouds, clouds do not forget to have a vertical movement of animation
.stormy{
width: 50px;
height: 50px;
position: absolute;
left: 80px;
top: 70px;
margin-left: -60px;
background: #222;
border-radius: 50%;
box-shadow: #222 64px -15px 0 -5px,
#222 25px -25px,
#222 30px 10px,
#222 60px 15px 0 -10px,
#222 85px 5px 0 -5px;
animation: stormy 5s ease-in-out infinite;
}
@keyframes stormy{
50%{
transform: translateY(-20px);
}
}
3, shadow style, also has animation
.stormy::after{
content: '';
width: 120px;
height: 15px;
position: absolute;
left: 5px;
bottom: -60px;
background: #000;
border-radius: 50%;
opacity: 0.2;
transform: scale(0.7);
animation: stormy_shadow 5s ease-in-out infinite;
}
@keyframes stormy_shadow{
50%{
transform: translateY(20px) scale(1);
opacity: 0.05;
}
}
4, lightning style
.stormy::before{
display: block;
content: '';
width: 0;
height: 0;
position: absolute;
left: 57px;
top: 70px;
border-left: 0px solid transparent;
border-right: 7px solid transparent;
border-top: 43px solid yellow;
box-shadow: yellow -7px -32px;
transform: rotate(14deg);
transform-origin: 50% -60px;
animation: stormy_thunder 2s steps(1, end) infinite;
}
@keyframes stormy_thunder{
0%{
transform: rotate(20deg);
opacity: 1;
}
5%{
transform: rotate(-34deg);
opacity: 1;
}
10%{
transform: rotate(0deg);
opacity: 1;
}
15%{
transform: rotate(-34deg);
opacity: 0;
}
}
OK, done. Pressing steps, you can achieve cool slightly thunder weather icon on your page -