CSS3动画:3D旋转(立方体)-含背景音乐

效果显示

html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../css/style.css" />
		<link rel="stylesheet" href="../css/animation.css" />
	</head>
	<body>
		<embed  src="../music/小坂明子.mp3"></embed>
		<div id="box">
			<div class="minBox"><img src="../img/11.PNG"/></div>
			<div class="minBox"><img src="../img/22.PNG"/></div>
			<div class="minBox"><img src="../img/33.PNG"/></div>
			<div class="minBox"><img src="../img/44.PNG"/></div>
			<div class="minBox"><img src="../img/55.PNG"/></div>
			<div class="minBox"><img src="../img/66.PNG"/></div>
		</div>		
	</body>
</html>

style.css

@charset "utf-8";

*{margin: 0;padding: 0;}
body{
	background: black;
}
#box{
	width: 300px;
	height: 300px;
/*	background: gold;	*/
	top: 0;
	bottom: 0;
	left: 0;
	right:0;
	margin: auto auto;
	position: fixed;
	transform: rotateX(15deg) rotateY(15deg);
	transform-style: preserve-3d;	
}
.minBox{
	height: 100%;
	width: 100%;
	position: absolute;
}
.minBox>img{
	height: 100%;
	width: 100%;	
}
/*成为立方体*/
#box>div:nth-child(1){
	transform: translatez(150px);
}
#box>div:nth-child(2){
	transform: rotateY(90deg) translatez(150px);
}
#box>div:nth-child(3){
	transform: rotateY(-90deg) translatez(150px);
}
#box>div:nth-child(4){
	transform: rotateX(90deg) translatez(150px);
}
#box>div:nth-child(5){
	transform:rotateX(-90deg) translatez(150px);
}
#box>div:nth-child(6){
	transform: rotateY(180deg) translatez(150px);
}

animation.css

@charset "utf-8";

@keyframes cube{
	from{transform: scale(1)rotateY(20deg) rotateX(20deg);}
	20%{transform: scale(1.5) translateZ(60px) rotateY(70deg) rotateX(70deg);	}
	40%{transform: scale(1) rotateY(110deg) rotateX(110deg);}
	60%{transform: scale(1.5) rotateY(160deg) rotateX(160deg);}	
	80%{transform: scale(1) rotateY(210deg) rotateX(210deg);}	
	to{transform: scale(2) rotateY(260deg) rotateX(340deg);;}
}
#box{
	animation: cube 20s linear infinite;
}

 

源码下载地址:https://github.com/YanHSana/cube

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值