写了一个demo关于制作反向旋转及光效动画,以此为总结:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html, body {
height: 100%;
overflow: hidden;
}
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video {
margin: 0;
padding: 0;
border: none;
outline: none;
}
html,body,form,fieldset,p,div,h1,h2,h3,h4,h5,h6 {
-webkit-text-size-adjust: none
}
.div-parse{
width: 100%;
height: 100%;
position: relative;
}
.main{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 736px;
height: 583px;
background: url('./bg.png') no-repeat;
background-size: 100% 100%;
}
.guang{
width: 498px;
height: 314px;
position: absolute;
top: 203px;
left: 106px;
background: url('./g.png') no-repeat;
background-size: 100% 100%;
opacity: 1;
animation: move1 1s linear infinite alternate;
}
@keyframes move1{
from{
opacity: 1;
}
to{
opacity: 0.5;
}
}
.bottom-yuan{
width: 99px;
height: 99px;
position: absolute;
top: 80px;
left: 100px;
background: url('./y2.png') no-repeat;
background-size: 100% 100%;
animation: move2 4s linear infinite;
}
@keyframes move2 {
from{
transform: rotate(360deg);
}
to{
transform: rotate(0deg);
}
}
.top-yuan{
width: 120px;
height: 120px;
position: absolute;
top: 70px;
left: 89px;
background: url('./y.png') no-repeat;
background-size: 100% 100%;
animation: move3 3s linear infinite;
}
@keyframes move3 {
form{
transform: rotate(0deg);
}
to{
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="div-parse">
<div class="main">
<div class="guang"></div>
<div class="yuan">
<div class="bottom-yuan"></div>
<div class="top-yuan"></div>
</div>
</div>
</div>
</body>
</html>
效果是这样的:

demo所需图片资源:




本文分享了一个关于制作反向旋转及光效动画的HTML和CSS代码demo,通过关键帧动画实现元素的透明度变化和逆向旋转,展示了如何在网页中创建动态视觉效果。

529

被折叠的 条评论
为什么被折叠?



