没办法额QAQ
这玩意儿尝试了半天也没弄好,放弃了,代码留在这。
<style> /*最外层容器样式*/ .wrap { 100px; height: 100px; margin: 150px; position: relative; } /*包裹所有容器样式*/ .cube { 50px; height: 50px; margin: 0 auto; transform-style: preserve-3d; transform: rotateX(-30deg) rotateY(-80deg); animation: rotate linear 20s infinite; } @-webkit-keyframes rotate { from { transform: rotateX(0deg) rotateY(0deg); } to { transform: rotateX(360deg) rotateY(360deg); } } .cube div { position: absolute; 200px; height: 200px; opacity: 0.8; transition: all .4s; } /*定义所有图片样式*/ .pic { 200px; height: 200px; } .cube .out_front { transform: rotateY(0deg) translateZ(100px); } .cube .out_back { transform: translateZ(-100px) rotateY(180deg); } .cube .out_left { transform: rotateY(-90deg) translateZ(100px); } .cube .out_right { transform: rotateY(90deg) translateZ(100px); } .cube .out_top { transform: rotateX(90deg) translateZ(100px); } .cube .out_bottom { transform: rotateX(-90deg) translateZ(100px); } /*定义小正方体样式*/ .cube span { display: block; 100px; height: 100px; position: absolute; top: 50px; left: 50px; } .cube .in_pic { 100px; height: 100px; } .cube .in_front { transform: rotateY(0deg) translateZ(50px); } .cube .in_back { transform: translateZ(-50px) rotateY(180deg); } .cube .in_left { transform: rotateY(-90deg) translateZ(50px); } .cube .in_right { transform: rotateY(90deg) translateZ(50px); } .cube .in_top { transform: rotateX(90deg) translateZ(50px); } .cube .in_bottom { transform: rotateX(-90deg) translateZ(50px); } /*鼠标移入后样式*/ .cube:hover .out_front { transform: rotateY(0deg) translateZ(200px); } .cube:hover .out_back { transform: translateZ(-200px) rotateY(180deg); } .cube:hover .out_left { transform: rotateY(-90deg) translateZ(200px); } .cube:hover .out_right { transform: rotateY(90deg) translateZ(200px); } .cube:hover .out_top { transform: rotateX(90deg) translateZ(200px); } .cube:hover .out_bottom { transform: rotateX(-90deg) translateZ(200px); } </style> <!-- 外层最大容器 --> <div class="wrap"> <!--包裹所有元素的容器--> <div class="cube"> <!--前面图片 --> <div class="out_front"> <img src="http://00imgmini.eastday.com/mobile/20180923/20180923150152_34c4fc3f15186758ebe028d8c8a8e2d6_1.jpeg" class="pic"> </div> <!--后面图片 --> <div class="out_back"> <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1539942412598&di=d8548e2765de72cd7f980d8949ab439b&imgtype=0&src=http%3A%2F%2Fp1.qhimgs4.com%2Ft017406031c3131f5be.jpg" class="pic"> </div> <!--左面图片 --> <div class="out_left"> <img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1543371375,260692947&fm=11&gp=0.jpg" class="pic"> </div> <!--右面图片 --> <div class="out_right"> <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1539944086383&di=66bf34a4e502232fe56bf5f617691fab&imgtype=jpg&src=http%3A%2F%2Fimg2.imgtn.bdimg.com%2Fit%2Fu%3D89186382%2C853095126%26fm%3D214%26gp%3D0.jpg" class="pic"> </div> <!--上面图片 --> <div class="out_top"> <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1539944480770&di=37a1951b0980b70c0c03c2b414c8973e&imgtype=0&src=http%3A%2F%2Fimg.18183.com%2Fuploads%2Fallimg%2F180910%2F241-1P910104Q9.jpg%40%252118183" class="pic"> </div> <!--下面图片 --> <div class="out_bottom"> <img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1654508906,970946453&fm=26&gp=0.jpg" class="pic"> </div> <!--小正方体 --> <span class="in_front"> <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1539944217193&di=0a647610e67c6400048297a3d13db5f9&imgtype=0&src=http%3A%2F%2Fnewsimg.5054399.com%2Fuploads%2Fuserup%2F1809%2F031020021545.jpg" class="in_pic"> </span> <span class="in_back"> <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1539942589717&di=c4e1a053bc6a494a51db66719e49251e&imgtype=0&src=http%3A%2F%2Fpic.87g.com%2Fupload%2F2018%2F0507%2F20180507015257266.jpg" class="in_pic"> </span> <span class="in_left"> <img src="http://www.zuiimg.com/images/2018/10/20/8f327bd32b3b9a6033d45a092fe78a12.jpg" class="in_pic"> </span> <span class="in_right"> <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1539944574509&di=02e7ad5eae8f9ee970d9e32d29263f1e&imgtype=0&src=http%3A%2F%2Fnewsimg.5054399.com%2Fuploads%2Fuserup%2F1712%2F121A02Cc1.jpg" class="in_pic"> </span> <span class="in_top"> <img src="http://www.zuiimg.com/images/2018/10/20/b763de864f438ce065083ae4ccade7a0.jpg" class="in_pic"> </span> <span class="in_bottom"> <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1540540879&di=a0bebec704c35eab0cd84c002aa8a41d&imgtype=jpg&er=1&src=http%3A%2F%2Fimg1.gamedog.cn%2F2018%2F06%2F07%2F2876074-1P60G059450.jpg" class="in_pic"> </span> </div> </div>