css还是蛮有意思的哦,效果啥的也不差,我给大家安利一个聚光灯效果,真的非常奈斯,效果如图:
中间的圆圈是不断地移动的,
html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/聚光灯.css">
</head>
<body>
<h1>SPOTLIGHT</h1>
</body>
</html>
重点来了:
*{
margin: 0;
padding: 0;
}
body{
background: #222;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
h1{
color: #333;
font-size: 8rem;
position: relative;
}
h1:after{
content: "SPOTLIGHT";
color: transparent;
position: absolute;
left: 0;
top: 0;
background: -webkit-linear-gradient(
left,#c23616,#192a56,#00d2d3,yellow,#6D214F,#2e86de,#4cd137,#e84118
);
background-clip: text;
-webkit-background-clip: text;
clip-path: circle(100px at 0% 50%);
-webkit-clip-path: circle(100px at 0% 50%);
animation: Light 5s infinite;
}
@keyframes Light{
0%{
clip-path: circle(100px at 0% 50%);
-webkit-clip-path: circle(100px at 0% 50%);
}
50%{
clip-path: circle(100px at 0% 50%);
-webkit-clip-path: circle(100px at 100% 50%);
}
100%{
clip-path: circle(100px at 0% 50%);
-webkit-clip-path: circle(100px at 0% 50%);
}
}
效果非常的完美!