html旋转相册

一、实验题目

做一个旋转的3d相册,当鼠标停留在相册时,相册向四面散开

二、实验代码

复制代码
<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Document</title>
		<style>
			body{
				perspective: 1500px;
			}
			@keyframes myAnimation {
				from{
					transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
				}
				to{
					transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
				}
			}
			
			.container{
				margin:200px;
				position: relative;
				transform-style: preserve-3d;
				/* animation:myAnimation 5s linear 0s infinite; */
				animation-name: myAnimation;
				animation-duration: 5s;
				animation-timing-function: linear;
				animation-delay: 0s;
				animation-iteration-count: infinite;
				
			}
			.container:hover>img:first-child{
				left: -300px;
			}
			.container:hover>img:nth-child(2){
				top: -300px;
			}
			.container:hover>img:nth-child(3){
				left: 300px;
			}
			.container:hover>img:nth-child(4){
				top: 300px;
			}
			.container:hover>img:nth-child(6){
				transform: translateZ(300px);
			}
			.container:hover>img:nth-child(5){
				transform: translateZ(-100px);
			}
			.container>img{
				width: 200px;
				height: 200px;
				position: absolute;
				border: 1px solid red;
				transition: 3s;
			}
			.container>img:first-child{
				left: -200px;
				transform-origin: right;
				transform: rotateY(90deg);
			}
			.container>img:nth-child(2){
				top:-200px;
				transform-origin: bottom;
				transform:rotateX(-90deg);
			}
			.container>img:nth-child(3){
				left: 200px;
				transform-origin: left;
				transform:rotateY(-90deg)
			}
			.container>img:nth-child(4){
				top: 200px;
				transform-origin: top;
				transform: rotateX(90deg);
			}
			.container>img:nth-child(6){
				transform: translateZ(200px);
			}
		</style>
	</head>
	<body>
		<div class="container">
			<img src="https://img1.baidu.com/it/u=4141189809,1768157998&fm=253&fmt=auto&app=138&f=JPEG?w=667&h=500" alt="">
			<img src="https://img0.baidu.com/it/u=2016271455,67708748&fm=253&fmt=auto&app=138&f=PNG?w=500&h=402" alt="">
			<img src="https://img2.baidu.com/it/u=2015943875,2629908785&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=666" alt="">
			<img src="https://img2.baidu.com/it/u=106832573,1691962947&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=682" alt="">
			<img src="https://img0.baidu.com/it/u=2104936347,2912513001&fm=253&fmt=auto&app=138&f=JPEG?w=389&h=500" alt="">
			<img src="https://img1.baidu.com/it/u=1599285144,422526079&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375" alt="">
		</div>
	</body>
</html>

三、实验效果

相关推荐
郑州光合科技余经理13 分钟前
海外国际版同城服务系统开发:PHP技术栈
java·大数据·开发语言·前端·人工智能·架构·php
Access开发易登软件21 分钟前
Access开发实战:绘制漏斗图实现业务转化分析
数据库·信息可视化·html·vba·图表·access
一行注释25 分钟前
前端数据加密:保护用户数据的第一道防线
前端
纪伊路上盛名在31 分钟前
记1次BioPython Entrez模块Elink的debug
前端·数据库·python·debug·工具开发
xiaoxue..33 分钟前
React 之 Hooks
前端·javascript·react.js·面试·前端框架
旧梦吟37 分钟前
脚本网页 三人四字棋
前端·数据库·算法·css3·html5
莫物39 分钟前
element el-table表格 添加唯一标识
前端·javascript·vue.js
我看刑41 分钟前
【已解决】el-table 前端分页多选、跨页全选等
前端·vue·element
我会一直在的1 小时前
Fiddler基础使用介绍
前端·测试工具·fiddler
小明记账簿1 小时前
前端文件流下载方法封装
前端