css动画实现呼吸路灯

利用css的动画可以实现一个呼吸灯:(此处是呼吸路灯)

效果如下:

代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<div>
		<div class="lightOne"></div>
		<div class="lightTwo"></div>
		<div class="lightThree"></div>
		<div class="lightFour"></div>
		<div class="lightFive"></div>
	</div>
	<div>
		<div class="buildingOne"></div>
		<div class="buildingTwo"></div>
		<div class="buildingThree"></div>
		<div class="buildingFour"></div>
		<div class="buildingFive"></div>
	</div>
	<div>
		<div class="footer"></div>
	</div>
</body>
<style>
	.footer{
		width: 100%;
		height: 2px;
		background-color: white;
		position: absolute;
		bottom: 0.5%;
	}
	.buildingFive{
		height: 4px;
		width: 300px;
		background-color: white;
		position: absolute;
		right: 8%;
		bottom: 48%;
	}
	.buildingFour{
		height: 345px;
		width: 40px;
		background-color: white;
		position: absolute;
		right: 16%;
		bottom: 1%;
	}
	.buildingThree{
		width: 0; 
		height: 0; 
		border-left: 200px solid transparent; 
		border-right: 200px solid transparent; 
		border-bottom: 100px solid white; 
		position: absolute;
		right: 4.7%;
		bottom: 68%;
	}
	.buildingTwo{
		height: 150px;
		width: 4px;
		background-color: white;
		position: absolute;
		right: 25%;
		bottom: 48%;
	}
	.buildingOne{
		height: 150px;
		width: 4px;
		background-color: white;
		position: absolute;
		right: 10%;
		bottom: 48%;
	}
	@keyframes xpf{
		0%{
			opacity: 1;
		}
		50%{
			opacity: 0.4;
		}
		100%{
			opacity: 1;
		}
	}
	.lightFive{
		height: 130px;
		width: 130px;
		position: absolute;
		bottom: 53%;
		right: 13.2%;
		opacity: 0.7;
		border-radius: 100%;
		background-color: yellow;
		box-shadow: 0 0 50px yellow;
		animation: xpf 4s infinite;

	}
	.lightFour{
		height: 10px;
		width: 10px;
		position: absolute;
		top: 16%;
		right: 3%;
		border-radius: 100%;
		background-color: yellow;
		box-shadow: 0 0 50px yellow;
		animation: xpf 1s infinite;
	}
	.lightThree{
		width: 0; 
		height: 0; 
		border-left: 10px solid transparent; 
		border-right: 10px solid transparent; 
		border-bottom: 10px solid yellow; 
		position: absolute;
		right: 13%;
		top: 17%;
		animation: xpf 6s infinite;
	}
	.lightTwo{
		width: 0; 
		height: 0; 
		border-left: 10px solid transparent; 
		border-right: 10px solid transparent; 
		border-bottom: 10px solid yellow; 
		position: absolute;
		right: 10%;
		top: 10%;
		animation: xpf 4s infinite;
	}
	.lightOne{
		height: 10px;
		width: 10px;
		position: absolute;
		top: 5%;
		right: 5%;
		border-radius: 100%;
		background-color: yellow;
		box-shadow: 0 0 50px yellow;
		animation: xpf 2s infinite;
	}
	body{
		background-color: black;
		overflow: hidden;
	}
</style>
</html>

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值