前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >3D盒子动画

3D盒子动画

作者头像
py3study
发布2020-01-14 10:40:32
5860
发布2020-01-14 10:40:32
举报
文章被收录于专栏:python3

3D盒子动画

素材:

  1. 正方形图片若干
wKiom1YBDU-y4-omAAUYi4p4SE8309.jpg
wKiom1YBDU-y4-omAAUYi4p4SE8309.jpg
wKiom1YBDVDRR2KUAAYBWnAZ2V8360.jpg
wKiom1YBDVDRR2KUAAYBWnAZ2V8360.jpg
wKioL1YBD5DSuL4vAAYwQFOGExc357.jpg
wKioL1YBD5DSuL4vAAYwQFOGExc357.jpg
wKiom1YBDVKQbcodAAQt589-5d0969.jpg
wKiom1YBDVKQbcodAAQt589-5d0969.jpg
wKioL1YBD5GgbK_kAAPbUHL0H6w102.jpg
wKioL1YBD5GgbK_kAAPbUHL0H6w102.jpg
wKioL1YBD5Li4LbJAAYQkD4dyvU392.jpg
wKioL1YBD5Li4LbJAAYQkD4dyvU392.jpg

以下为源码:

---------------------------------------------------------

代码语言:javascript
复制
<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>3D动画box</title>
  <style type=text/css>
  
.warpper{position:fixed;top:30%;left:40%;perspective:1000px;}
.cube{
width:300px;height:300px;
transform-style:preserve-3d;/*设置3D环境*/
 }
.side{
width:300px;height:300px;
background:rgba(255,121,134,0.6);
position:absolute;
font-size:60px;
color:#fff;
line-height:300px;
text-align:center;
border:1px solid red;
border-radius: 50%;
}
.side_top{
width:300px;height:300px;
/*background:rgba(255,121,134,0.6);*/
background-p_w_picpath: url(img/01.png);
position:absolute;
font-size:60px;
color:#fff;
line-height:300px;
text-align:center;
border:1px solid red;
/*border-radius: 50%;*/
opacity:0.9;
}
.side_bottom{
width:300px;height:300px;
/*background:rgba(255,121,134,0.6);*/
background-p_w_picpath: url(img/02.png);
position:absolute;
font-size:60px;
color:#fff;
line-height:300px;
text-align:center;
border:1px solid red;
/*border-radius: 50%;*/
opacity: 0.9;
}
.side_left{
width:300px;height:300px;
/*background:rgba(255,121,134,0.6);*/
background-p_w_picpath: url(img/03.png);
position:absolute;
font-size:60px;
color:#fff;
line-height:300px;
text-align:center;
border:1px solid red;
/*border-radius: 50%;*/
opacity: 0.9;
}
.side_right{
width:300px;height:300px;
/*background:rgba(255,121,134,0.6);*/
background-p_w_picpath: url(img/04.png);
position:absolute;
font-size:60px;
color:#fff;
line-height:300px;
text-align:center;
border:1px solid red;
/*border-radius: 50%;*/
opacity: 0.9;
}
.side_back{
width:300px;height:300px;
/*background:rgba(255,121,134,0.6);*/
background-p_w_picpath: url(img/05.png);
position:absolute;
font-size:60px;
color:#fff;
line-height:300px;
text-align:center;
border:1px solid red;
/*border-radius: 50%;*/
opacity: 0.9;
}
.side_front{
width:300px;height:300px;
/*background:rgba(255,121,134,0.6);*/
background-p_w_picpath: url(img/06.png);
position:absolute;
font-size:60px;
color:#fff;
line-height:300px;
text-align:center;
border:1px solid red;
/*border-radius: 50%;*/
opacity: 0.7;
}
.top{transform:rotateX(90deg) translateZ(150px);}
.bottom{transform:rotateX(-90deg) translateZ(150px);}
.left{transform:rotateY(-90deg) translateZ(150px);}
.right{transform:rotateY(90deg) translateZ(150px);}
.back{transform:rotateX(180deg) translateZ(150px);}
.front{transform:rotateY(0deg) translateZ(150px);}
  </style>
 </head>
 <body>
 
<div class="warpper">
<div class="cube" id="cube">
<div class="top side_top">1</div>
<div class="bottom side_bottom">2</div>
<div class="left side_left">3</div>
<div class="right side_right">4</div>
<div class="back side_back">5</div>
<div class="front side_front">6</div>
</div>
</div>
<!--<script type="text/javascript" src="js/niannian-kuku.js"></script>-->
<script type="text/javascript">
var cubeDom = document.getElementById("cube");
var y = 0;
setInterval(function(){
if(y>360){
y=0; 
}
y += 5;
cubeDom.style.transform = "rotateY("+y+"deg) rotateX("+y+"deg)";
//document.body.style.background = kuku.RandomColor();
//document.body.innerHTML = kuku.RandomNmb(1,11);
},100);
</script>
 </body>
</html>

--------------------------------------------

效果图:

wKiom1YBDjSzziU9AAIekPSN-Js000.jpg
wKiom1YBDjSzziU9AAIekPSN-Js000.jpg
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/07/12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档