帝王谷资源网 Design By www.wdxyy.com
- 当元素进行旋转时,他的坐标轴也跟着他进行旋转
- 注意-y方向问题
旋转立方体的效果
分析
- 一个容器包含6个div
- position:absolute 之后6个面完全重合
- 通过trandform:rotateX/Y/Z(),translateX/Y/Z()调整到相应位置
- 添加transition动画效果
- 注意这里面的旋转是绕着他的中心线进行旋转的所以唯一100px
- 他在旋转时,他的坐标轴也是跟着他进行旋转的(这很重要)
代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> *{ margin: 0px; padding: 0px; } body{ perspective: 800px; background: #000000; } #container{ height: 200px; width: 200px; margin: 100px auto 0; position: relative; transform-style: preserve-3d; animation: move 1s ease infinite; } @keyframes move{ from{ transform: rotateY(0deg) rotateZ(0deg); } to{ transform: rotateY(360deg) rotateZ(360deg); } } #container>div{ height: 100%; width: 100%; border-radius: 5px; background: rgba(255,255,255,0.5); position: absolute; left: 0px; right: 0px; text-align: center; line-height: 200px; font-size: 30px; } #one{ transform:rotateX(-90deg) translateZ(100px); } #two{ transform:translateZ(100px) ; } #three{ transform: rotateY(-90deg) translateZ(100px); } #four{ transform: rotateY(-180deg) translateZ(100px); } #five{ transform: rotateY(90deg) translateZ(100px); } #six{ transform: translateZ(-100px); } </style> </head> <body> <div id="container"> <div id="one">1</div> <div id="two">2</div> <div id="three">3</div> <div id="four">4</div> <div id="five">5</div> <div id="six">6</div> </div> </body> </html>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com
暂无评论...
更新日志
2024年07月08日
2024年07月08日
- 孙露《不让我的眼泪陪我过夜》HQCDII 限量版 [WAV+CUE][517M]
- dnf巴卡尔武器怎么融合
- 魔兽世界wlk最强职业是什么 wlk最吃香最强职业推荐
- dnf巴卡尼单人和多人区别
- 群星《大热唱片DSD》APE+CUE
- 草蜢2012《软硬草蜢》3CD[WAV+CUE整轨]
- 雨林唱片发烧大碟-陈果《明知故犯HQCD》[WAV+CUE]
- 群星.2024-狐妖小红娘月红篇电视剧原声带【恒星引力】【FLAC分轨】
- 许美静.1998-好美静【上华】【WAV+CUE】
- 谭咏麟.1996-独一无二【宝丽金】【WAV+CUE】
- dnf平民怎么弄宠物
- dnf弓箭手职业
- dnf强化基础精通适合哪些职业
- V.A中国管弦乐纪念名盘《乡之音》FLAC
- [雨果]赵鹏《赵鹏·LPCD45》LPCD45[WAV+CUE]