CSS 水滴融合效果

CSS 水滴融合效果

       初步介绍:对水滴元素设置filter属性为blur(6px);进行模糊处理,对水滴的上一层容器添加属性:filter:contrast(30);将模糊了的边框提升对比度,实现效果。

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
	<style type="text/css">
		.containe{
			background: rgba(0,0,0,1.00);
			width: 400px;
			height: 700px;
			filter: contrast(30);
		}
		.drop1{
			position: absolute;
			border-radius: 50%;
			background:rgba(255,255,255,1.00);
			left: 200px;
			top: 500px;
			transform: translate(-50%,-50%);
			width: 200px;
			height: 200px;
			animation: movetotop 4s ease-in-out 1.273s infinite;
			filter: blur(6px);
		}
		
		.drop2{
			position: absolute;
			border-radius: 50%;
			background:rgba(255,255,255,1.00);
			left: 300px;
			top: 400px;
			transform: translate(-50%,-50%);
			width: 200px;
			height: 200px;
			animation: movetotop 4s ease-in-out 1.273s infinite;
			filter: blur(6px);
		}
		
		.drop3{
			position: absolute;
			border-radius: 50%;
			background:rgba(255,255,255,1.00);
			left: 100px;
			top: 300px;
			transform: translate(-50%,-50%);
			width: 200px;
			height: 200px;
			animation: movetotop 4s ease-in-out 1.273s infinite;
			filter: blur(6px);
		}
		
		@keyframes movetotop{
			100%{top: 300px;}
		}
	</style>
</head>

<body>
	<div class="containe">
		<div class="drop1">
			
		</div>
		<div class="drop2">
	
	    </div>
		<div class="drop3">
	
	    </div>
	</div>
</body>
</html>

效果:
在这里插入图片描述

更简单的设置更多水滴的方式:
css中对drop类进行修改,减少代码量:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
	<style type="text/css">
		.containe{
			background: rgba(0,0,0,1.00);
			width: 400px;
			height: 700px;
			filter: contrast(30);
		}
		.drop{
			position: absolute;
			border-radius: 50%;
			background:rgba(255,255,255,1.00);
			left: 200px;
			top: 500px;
			transform: translate(-50%,-50%);
			width: 200px;
			height: 200px;
			animation: movetotop 4s ease-in-out 1.273s infinite;
			filter: blur(6px);
		}
		
		.drop:nth-child(2){
			transform: translate(20px)
		}
		
		.drop:nth-child(3){
			transform: translate(-90px)
		}
		
		@keyframes movetotop{
			100%{top: 300px;}
		}
	</style>
</head>

<body>
	<div class="containe">
		<div class="drop">
			
		</div>
		<div class="drop">
	
	    </div>
		<div class="drop">
	
	    </div>
	</div>
</body>
</html>

        结果与上面的相同。

参考视频:
https://www.bilibili.com/video/BV1S64y1F7Y8?from=search&seid=14579192519791550978

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值