css3 实现纸带翻转效果

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>css3 实现纸带翻转效果</title>
		<style type="text/css" media="screen">
			*{margin:0;padding:0;}
			html,body{display:flex;flex-direction:column;justify-content:center;align-items: center;width:100%;height:100%;background-color:#334D5C;}
			.msg{color:#fff;margin:20px 0;}
			.cont{display:flex;perspective: 1000px;transform-style: preserve-3d;transform:translate3d(0,0,0) rotateY(40deg);}
			.fold{width:20px;height:150px;background-color:rgba(255,255,255,.8);animation:move 4s infinite ease;transform-origin:center top;}
			.fold:nth-of-type(1){animation-delay: .05s;}
			.fold:nth-of-type(2){animation-delay: .1s;}
			.fold:nth-of-type(3){animation-delay: .15s;}
			.fold:nth-of-type(4){animation-delay: .2s;}
			.fold:nth-of-type(5){animation-delay: .25s;}
			.fold:nth-of-type(6){animation-delay: .3s;}
			.fold:nth-of-type(7){animation-delay: .35s;}
			.fold:nth-of-type(8){animation-delay: .4s;}
			.fold:nth-of-type(9){animation-delay: .45s;}
			.fold:nth-of-type(10){animation-delay: .5s;}
			.fold:nth-of-type(11){animation-delay: .55s;}
			.fold:nth-of-type(12){animation-delay: .6s;}
			.fold:nth-of-type(13){animation-delay: .65s;}
			.fold:nth-of-type(14){animation-delay: .7s;}
			.fold:nth-of-type(15){animation-delay: .75s;}
			.fold:nth-of-type(16){animation-delay: .8s;}
			.fold:nth-of-type(17){animation-delay: .85s;}
			.fold:nth-of-type(18){animation-delay: .9s;}
			.fold:nth-of-type(19){animation-delay: .95s;}
			.fold:nth-of-type(20){animation-delay: 1s;}
			.fold:nth-of-type(21){animation-delay: 1.05s;}
			.fold:nth-of-type(22){animation-delay: 1.1s;}
			.fold:nth-of-type(23){animation-delay: 1.15s;}
			.fold:nth-of-type(24){animation-delay: 1.2s;}
			.fold:nth-of-type(25){animation-delay: 1.25s;}
			.fold:nth-of-type(26){animation-delay: 1.3s;}
			.fold:nth-of-type(27){animation-delay: 1.35s;}
			.fold:nth-of-type(28){animation-delay: 1.4s;}
			.fold:nth-of-type(29){animation-delay: 1.45s;}
			.fold:nth-of-type(30){animation-delay: 1.5s;}
			.fold:nth-of-type(31){animation-delay: 1.55s;}
			.fold:nth-of-type(32){animation-delay: 1.6s;}
			.fold:nth-of-type(33){animation-delay: 1.65s;}
			.fold:nth-of-type(34){animation-delay: 1.7s;}
			.fold:nth-of-type(35){animation-delay: 1.75s;}
			.fold:nth-of-type(36){animation-delay: 1.8s;}
			.fold:nth-of-type(37){animation-delay: 1.85s;}
			.fold:nth-of-type(38){animation-delay: 1.9s;}
			.fold:nth-of-type(39){animation-delay: 1.95s;}
			.fold:nth-of-type(40){animation-delay: 2s;}
			.fold:nth-of-type(41){animation-delay: 2.05s;}
			.fold:nth-of-type(42){animation-delay: 2.1s;}
			.fold:nth-of-type(43){animation-delay: 2.15s;}
			.fold:nth-of-type(44){animation-delay: 2.2s;}
			.fold:nth-of-type(45){animation-delay: 2.25s;}
			.fold:nth-of-type(46){animation-delay: 2.3s;}
			.fold:nth-of-type(47){animation-delay: 2.35s;}
			.fold:nth-of-type(48){animation-delay: 2.4s;}
			.fold:nth-of-type(49){animation-delay: 2.45s;}
			.fold:nth-of-type(50){animation-delay: 2.5s;}
			@keyframes move{
				0%{transform:rotateX(0);}
				100%{transform:rotateX(360deg);}
			}
		</style>
	</head>
	<body>
		<h1 id="msg" class="msg">Move the mouse around</h1>
		<div id="cont" class="cont">
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
			<div class="fold"></div>
		</div>
		<script>
			(function () {
				var cont = document.querySelector('#cont');
				document.addEventListener('mousemove',upRotation, false);
				function upRotation(e){
					document.querySelector('#msg').style.opacity = 0;
					cont.style.transform = 'rotateY(' + e.x / 10 + 'deg) rotateZ(-' + e.y / 10 + 'deg)'; 
				}
			})();
		</script>
	</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值