css3实现的3d旋转效果:
由于css3的出现,实现3d动画效果也更为轻松便捷,下面就是一段能够实现3d旋转效果的代码,希望对大家能够带来参考作用。
代码如下:
蚂蚁部落 * { font-size:14px; color:#fff; padding:0; margin:0;}#container { position:relative; height 300px; width:300px; -webkit-perspective:500; margin-top:200px; margin-right:auto; margin-left:auto;}#parent { margin:10px; width:280px; height:280px; background-color:#666; opacity:0.3; -webkit-transform-style:preserve-3d; -webkit-animation:spin 15s infinite linear;}#parent > div { position:absolute; top:40px; left:40px; width:280px; height:200px; padding:10px; -webkit-box-sizing:border-box;}#parent > :first-child { background-color:#000; -webkit-transform:translateZ(-100px) rotateY(45deg);}#parent > :last-child { background-color:#333; -webkit-transform:translateZ(50px) rotateX(20deg); -webkit-transform-origin:50% top;}/*执行Y轴旋转360度动画*/@-webkit-keyframes spin{ from{ -webkit-transform: rotateY(0); } to{ -webkit-transform: rotateY(360deg); }}
登录后复制
原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=11843
更多内容可以参阅:http://www.softwhy.com/divcss/
立即学习“前端免费学习笔记(深入)”;
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/3109473.html