html 立体相册

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<style type="text/css">
	body
	{
		/*视距,观察者与图像的距离*/
		perspective: 800px;
	}
	@keyframes myAnimation{
		from{
			/*运动开始各轴偏转的位置*/
			transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
		}
		to{
			/*运动结束各轴偏转的位置*/
			transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
		}
	}
	/*动画效果相关属性*/
	.container{
		animation-name: myAnimation;
		/*时长*/
		animation-duration: 10s;
		/*速度曲线*/
		animation-timing-function: linear;
		/*循环次数*/
		animation-iteration-count: infinite;
		/*运动状态*/
		animation-play-state: running;
	}
	.container{
		width: 200px;
		height: 200px;
		position: relative;
		margin: 250px auto;
		transform-style: preserve-3d;/*改为3d模式*/
		/*transform:rotateX(45deg) rotateY(45deg);*/
	}
	.container > img{
		width: 200px;
		height: 200px;
		position: absolute;
	}
	.container>img:nth-child(2){
		/*将图片向左移动200个像素*/
		left: -200px;
		/*定义图片的旋转轴,将图像的最右边做为旋转轴*/
		transform-origin: right;
		/*将图片延y轴旋转90°*/
		transform: rotateY(90deg);
	}
	.container>img:nth-child(3){
		right:-200px;
		transform-origin: left;
		transform: rotateY(-90deg);
	}
	.container>img:nth-child(4){
		top: -200px;
		transform-origin: bottom;
		transform: rotateX(-90deg);
	}
	.container>img:nth-child(5){
		bottom: -200px;
		transform-origin: top;
		transform: rotateX(90deg);
	}
	.container>img:nth-child(6){
		transform: translateZ(200px);
	}
	.container:hover>img:nth-child(1){
		transform: translateZ(-100px);
	}
	.container:hover>img:nth-child(2){
		left: -300px;
		transform-origin: right;
		transform: rotateY(90deg);
	}
	.container:hover>img:nth-child(3){
		right:-300px;
		transform-origin: left;
		transform: rotateY(-90deg);
	}
	.container:hover>img:nth-child(4){
		top: -300px;
		transform-origin: bottom;
		transform: rotateX(-90deg);
	}
	.container:hover>img:nth-child(5){
		bottom: -300px;
		transform-origin: top;
		transform: rotateX(90deg);
	}
	.container:hover>img:nth-child(6){
		transform: translatez(300px);
	}
	</style>
</head>
<body>
	<div class="container">
		<img src="C:\Users\....\Desktop\新建文件夹 (3)\1.png">
		<img src="C:\Users\....\Desktop\新建文件夹 (3)\2.png">
		<img src="C:\Users\....\Desktop\新建文件夹 (3)\3.png">
		<img src="C:\Users\....\Desktop\新建文件夹 (3)\4.png">
		<img src="C:\Users\....\Desktop\新建文件夹 (3)\5.png">
		<img src="C:\Users\....\Desktop\新建文件夹 (3)\6.png">
	</div>
</body>
</html>

效果:正方体图片旋转,当鼠标触碰立体相册时,各个面的图片向外伸展。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值