立方体旋转动画效果

css

         #container{
width: 400px;
height: 400px;
-webkit-perspective:;
perspective:;
-webkit-perspective-origin:50% 225px;
perspective-origin:50% 225px; }
#stage{
width: 300px;
height:300px; -webkit-transition: -webkit-transform 2s;
transition: transform 2s;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d; }
#shape{
width: 200px;
height:200px;
position: relative;
top: 100px;
margin:0 auto;
transform-style: preserve-3d;
}
#shape{
-webkit-animation: spin 8s infinite linear; }
.plane{
position: absolute;
width: 200px;
height:200px;
background: #c23c00;
border: 1px solid #000;
font-size: 100px;
color:#fff;
text-align: center;
line-height: 200px;
-webkit-transition: -webkit-transform 2s, opacity 2s;
transition: transform 2s, opacity 2s;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
#shape.backface .plane{
-webkit-backface-visibility: visible;
backface-visibility: visible;
} .cube>.one{
opacity: 0.5 ;
-webkit-transform: scale3d(1.2, 1.2, 1.2) rotateX(90deg) translateZ(100px);
transform: scale3d(1.2, 1.2, 1.2) rotateX(90deg) translateZ(100px)
}
.cube>.two{
opacity: 0.5 ;
-webkit-transform: scale3d(1.2, 1.2, 1.2) translateZ(100px);
transform: scale3d(1.2, 1.2, 1.2) translateZ(100px);
}
.cube>.three{
opacity: 0.5 ;
-webkit-transform: scale3d(1.2, 1.2, 1.2) rotateY(90deg) translateZ(100px);
transform: scale3d(1.2, 1.2, 1.2) rotateY(90deg) translateZ(100px);
}
.cube > .four{
opacity: 0.5 ;
-webkit-transform: scale3d(1.2, 1.2, 1.2) rotateY(180deg) translateZ(100px);
transform: scale3d(1.2, 1.2, 1.2) rotateY(180deg) translateZ(100px);
}
.cube > .five{
opacity: 0.5 ;
-webkit-transform: scale3d(1.2, 1.2, 1.2) rotateY(-90deg) translateZ(100px);
transform: scale3d(1.2, 1.2, 1.2) rotateY(-90deg) translateZ(100px);
}
.cube > .six{
opacity: 0.5 ;
-webkit-transform: scale3d(1.2, 1.2, 1.2) rotateX(-90deg) translateZ(100px);
transform: scale3d(1.2, 1.2, 1.2) rotateX(-90deg) translateZ(100px);
}
@-webkit-keyframes spin{
0% {
-webkit-transform : rotateY(0);
transform : rotateY(0);
}
100% {
-webkit-transform : rotateY(-360deg);
transform : rotateY(-360deg);
}
}
@keyframes spin{
0% {
-webkit-transform : rotateY(0);
transform : rotateY(0);
}
100% {
-webkit-transform : rotateY(-360deg);
transform : rotateY(-360deg);
}
}
perspective:视距
 transform-style: preserve-3d; 3d动画必须,且放在父元素上
translateZ(100px) (100px是高度的一半)
动画加在shape上(.cube的父级,则整体都会旋转)

html

<div id="container" >
<div id="stage">
<div id="shape" class="cube backface">
<div class="plane one">1</div>
<div class="plane two">2</div>
<div class="plane three">3</div>
<div class="plane four">4</div>
<div class="plane five">5</div>
<div class="plane six">6</div>
</div>
</div>
</div>

最新文章

  1. python安装numpy和pandas
  2. 空间复杂度是什么?What does ‘Space Complexity’ mean? ------geeksforgeeks 翻译
  3. LeetCode Binary Tree Longest Consecutive Sequence
  4. 命令行参数 main()函数设计
  5. HDU4055 - number string(DP)
  6. redis.conf配置文件详解
  7. hdu 4609 3-idiots(快速傅里叶FFT)
  8. linux两种增加交换分区(swap)的方法
  9. SpringMVC学习系列- 表单验证
  10. ios数组基本用法和排序
  11. Android乐学成语之自定义Adapter
  12. django-admin.py失效的问题合集!
  13. DHTML【3】--HTML
  14. Java学习记录第一章
  15. ubuntu14.04 64位 安装JDK1.7
  16. linux网络编程之二-----多播(组播)编程
  17. 【转】CENTOS/RHEL 7 系统中设置SYSTEMD SERVICE的ULIMIT资源限制
  18. 中文分词库及NLP介绍,jieba,gensim的一些介绍
  19. 2. 决策树(Decision Tree)-ID3、C4.5、CART比较
  20. 4-[HTML]-body常用标签1

热门文章

  1. Mysql 中 trim 的用法
  2. document.documentElement.scrollTop
  3. G1日志分析
  4. [svc][jk]gpu温度监测
  5. Eclipse Jetty Integration
  6. 2015&amp;#183;Fool&amp;#39;s Day&amp;#183;NND
  7. 【JAVA设计模式】外观模式(Facade Pattern)
  8. c3p0 一个数据库链接的例子
  9. Python 常用内置模块(加密模块 hashlib,Base64)
  10. Linux定时备份数据到百度云盘