栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Html/CSS > CSS教程

CSS3 3D酷炫立方体变换动画的实现

CSS教程 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

我爱撸码,撸码使我感到快乐!

大家好,我是Counter,本章微博主要利用了CSS3的一些新特性,

主要用到关键帧来使3D图形运动起来,涉及到了一些抽象的思想,立体的想象。

先给大家看看完成的效果,代码也不是很难,每行代码都给到了详细注释,纯CSS,没有用到JS,CSS3不错。

效果如下:

每一行基本都有注释,就不重复说了,代码如下:




    
    
    
    3D旋转
    
 
 .wrapper {
     
     perspective: 500px;
     
     margin: 100px auto 0;
     width: 200px;
     height: 200px;
     
 }
 
 .box {
     
     position: relative;
     
     transform-style: preserve-3d;
     width: 200px;
     height: 200px;
     
     animation: move 8s linear infinite;
 }

 
 div[class^="item"] {
     position: absolute;
     top: 0;
     left: 0;
     width: 200px;
     height: 200px;
     
     text-align: center;
     
     line-height: 200px;
 }

 
 
 
 .item1 {  
     
     transform: translateZ(100px);
     
     background-color: rgba(255, 0, 0, 0.6);
 }
 
 .item2 {
     
     transform: translateZ(-100px);
     background-color: rgba(72, 42, 245, 0.6);
 }
 
 .item3 {
     
     transform: rotateX(90deg) translateZ(100px);
     background-color: rgba(217, 230, 36, 0.6);
 }
 
 .item4 {
     
     transform: rotateX(90deg) translateZ(-100px);
     background-color: rgba(58, 7, 51, 0.6);
 }
 
 .item5 {
     
     transform: rotateY(90deg) translateZ(-100px);
     background-color: rgba(241, 142, 75, 0.6);
 }
 
 .item6 {
     
     transform: rotateY(90deg) translateZ(100px);
     background-color: rgba(125, 178, 238, 0.6);
 }

 
 @keyframes move {
     0% {
  transform: rotateX(0) rotateY(0) rotateZ(0);
     }
     100% {
  transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
     }
 }
    


    
 
     1
     2
     3
     4
     5
     6
 
    

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/215139.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号