<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
*{
margin: 0;
padding: 0;
}
body{
width: 100vw;
height: 100vh;
}
.parent{
position: relative;
filter: contrast(24);
position: relative;
background-color: #000;
width: 100vw;
height: 100vh;
}
.a{
width: 100px;
height: 100px;
filter: blur(12px);
background-color: #fff;
position: absolute;
top: 100px;
left: 50%;
animation: animationA 0.8s ease-in-out infinite alternate;
}
.b{
width: 100px;
height: 100px;
filter: blur(12px);
background-color: #fff;
position: absolute;
top: 100px;
left: calc(50% + 100px);
animation: animationB 0.8s ease-in-out infinite alternate;
}
@keyframes animationA {
0%{
transform: rotate(45deg) translateX(-50px);
}
100%{
transform: rotate(-45deg) translateX(50px);
}
}
@keyframes animationB {
0%{
transform: rotate(-45deg) translateX(50px);
}
100%{
transform: rotate(45deg) translateX(-50px);
}
}
</style>
<body>
<div class="parent">
<div class="a"></div>
<div class="b"></div>
</div>
</body>
</html>
文章来源地址https://www.toymoban.com/news/detail-612714.html
文章来源:https://www.toymoban.com/news/detail-612714.html
到了这里,关于CSS通过设置filter实现元素交融效果的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!