CSS3动态图

简单的css3的动态图 

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="dongtai tu.css"/>
	</head>
	<body>
		
		<div class="loding1"  >
			<div class="text">
				loding
			</div>
			<div class="box">
				
			</div>
		</div>
		<div class="loding2">
			<div class="text">
				<span>L</span>
				<span>O</span>
				<span>D</span>
				<span>I</span>
				<span>N</span>
				<span>G</span>
				
			</div>
			<div class="box">
				<span></span>
				<span></span>
				<span></span>
				<span></span>
			</div>
		</div>
	</body>
</html>

 

 

 

 

* {
	margin: 0;
	padding: 0;
}

html,
body {
	width: 100%;
	height: 100%;
	background-color: #3C3C3C;
	display: flex; //css3弹性盒子居中
	justify-content: center;
	align-items: center;
}

.loding1,
.loding2 {
	position: relative;
	width: 200px;
	height: 200px;
	margin: 50px;
}

.loding1 .text {
	position: absolute;
	top: 50%;
	left: 50%;
	font-size: 30px;
	color: #FFFF00;
	z-index: 99;
	transform: translate(-50%, -50%);
	/*animation: text1 2s linear infinite;*/
}

.loding1 .box {
	position: absolute;
	top: 50%;
	left: 50%;
	margin-left: -80px;
	margin-top: -80px;
	width: 160px;
	height: 160px;
	background-color: red;
	/*animation: changeShape 2s ease-in-out infinite;*/
}

@keyframes changeShape {
	0% {
		border-radius: 0%;
		background-color: red;
		transform: scale(1);
	}
	50% {
		border-radius: 50%;
		background-color: blue;
	}
	100% {
		border-radius: 0%;
		background-color: red;
		transform: scale(1);
	}
}

@keyframes text1 {
	0% {
		font-size: 30px;
	}
	50% {
		font-size: 24px;
	}
	100% {
		font-size: 30px;
	}
}

@keyframes changeShape {
	0% {
		border-radius: 0%;
		background-color: red;
		transform: scale(1) rotate(0deg);
	}
	50% {
		border-radius: 50%;
		background-color: blue;
		transform: scale(0.5) rotate(360deg);
	}
	100% {
		border-radius: 0%;
		background-color: red;
		transform: scale(1) rotate(720deg);
	}
}

.loding2 .text {
	position: absolute;
	width: 100%;
	text-align: center;
	line-height: 200px;
	color: #FFFF00;
	z-index: 99;
	/*animation: text2 2s linear infinite;*/
}

.loding2 .text span {
	position: relative;
	display: inline-block;
	font-size: 30px;
	height: 100%;
	margin: 0 auto;
	animation: bigger 1.5s linear infinite;
}

.loding2 .box {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: blue;
	overflow: hidden;
	/*animation: changeShape 2s ease-in-out 2;*/
	transform: rotate(45deg);
}

.loding2 .box span {
	width: 5px;
	position: absolute;
	height: 100%;
	background-color: red;
	display: inline-block;
	overflow: hidden;
}

.loding2 .text span:nth-child(2) {
	animation-delay: 0.1s;
}

.loding2 .text span:nth-child(3) {
	animation-delay: 0.2s;
}

.loding2 .text span:nth-child(4) {
	animation-delay: 0.3s;
}

.loding2 .text span:nth-child(5) {
	animation-delay: 0.4s;
}

.loding2 .text span:nth-child(6) {
	animation-delay: 0.5s;
}


/*/上/*/

.loding2 .box span:nth-child(1) {
	top: 5px;
	
	transform-origin: top left;
	transform: rotate(-90deg);
	animation: changeT 1.5s ease-in-out 3;
}


/*右*/

.loding2 .box span:nth-child(2) {
	right: 0px;
	background-color: skyblue;
	animation: changeR 1.5s ease-in-out 3;
}


/*下*/

.loding2 .box span:nth-child(3) {
	bottom: 2px;
	
	transform-origin: bottom;
	transform: rotate(90deg);
	animation: changeB 1.5s ease-in-out 3;
}


/*//左*/

.loding2 .box span:nth-child(4) {
	left: 0px;
	background-color: skyblue;
	animation: changeL 1.5s ease-in-out 3;
}

@keyframes changeT {
	0% {
		left: -200px;
	}
	50% {
		left: 0;
	}
	100% {
		left: 200px;
	}
}

@keyframes changeR {
	0% {
		top: -200px;
	}
	50% {
		top: 0;
	}
	100% {
		top: 200px;
	}
}

@keyframes changeB {
	0% {
		right: 0px;
	}
	50% {
		right: 200px;
	}
	100% {
		right: 400px;
	}
}

@keyframes changeL {
	0% {
		bottom: -200px;
	}
	50% {
		bottom: 0;
	}
	100% {
		bottom: 200px;
	}
}

@keyframes bigger {
	0% {
		transform: scale(1.2);
	}
	50% {
		transform: scale(1.5);
	}
	100% {
		transform: scale(1.2);
	}
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值