基本信息
源码名称:3D立方体旋转
源码大小:1.66M
文件格式:.zip
开发语言:CSS
更新时间:2021-09-07
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

html/css制作的3D立方体旋转

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<style type="text/css">
* {    padding: 0;    margin: 0;}
#container{    
width: 100%;    
height: 650px;    
display:flex;    
align-items: center;    
justify-content: center;    
perspective: 500px;
background-color: #eee;
}
#box{    
width: 200px;    
height:200px;    
transform-style:preserve-3d;    
transform: translateZ(-100px);    
transition: transform 1s;    
animation: spin 10s linear infinite;
}
#box div{    
width: 200px;    
height:200px;    
position: absolute;
}
span{    
width: 200px;    
height: 200px;
display: block;  
text-align: center;
line-height: 200px;  
background-color:rgba(0,0,0,0.8);
color: white;
font-size: 40px;}/*立方体的六个面*/
.front{    
transform: translateZ(100px);           /*往外移动100像素*/
}
.back{    
transform: translateZ(-100px) rotateY(180deg); /*往里移动100像素,绕Y轴旋转180度*/
}
.left{    
transform: translateX(-100px) rotateY(-90deg);      /*往左移动100像素,绕Y轴旋转90度*/
}
.right{    
transform: translateX(100px) rotateY(90deg);      /*往右移动100像素,绕Y轴旋转90度*/
}
.top{    
transform: translateY(-100px) rotateX(90deg);      /*向上移动100像素,绕X轴旋转90度*/
}
.bottom{    
transform: translateY(100px) rotateX(-90deg);        /*向下移动100像素,绕X轴旋转90度*/
}
/*动画*/
@keyframes spin{    
0% {transform: rotateX(0deg);}    
50% {transform: rotateX(180deg);}  
100% {transform: rotateX(360deg);}  

}

</style>
</head>
<body>
<div id="container">        
<div id="box">            
<div class="front"><span>1</span></div><!--图片地址改为对应的本地地址-->            
<div class="back"><span>2</span></div>            
<div class="left"><span>3</span></div>            
<div class="right"><span>4</span></div>            
<div class="top"><span>5</span></div>            
<div class="bottom"><span>6</span></div>        
</div>
</div>
</body>
</html>