{"id":387,"date":"2012-11-28T11:45:48","date_gmt":"2012-11-28T03:45:48","guid":{"rendered":"http:\/\/www.bluesdream.com\/blog\/?p=387"},"modified":"2012-12-26T18:01:38","modified_gmt":"2012-12-26T10:01:38","slug":"css3-to-create-3d-rotating-sphere","status":"publish","type":"post","link":"https:\/\/www.bluesdream.com\/blog\/css3-to-create-3d-rotating-sphere.html","title":{"rendered":"CSS3 \u5236\u4f5c3D\u65cb\u8f6c\u7403\u4f53"},"content":{"rendered":"<p>\u4eca\u5929\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4e3b\u8981\u60f3\u8bb2\u7684\u662ftransform-style:preserve-3d\u548cbox-sizing:border-box\u8fd9\u4e24\u4e2a\u5c5e\u6027\u3002<\/p>\n<p>\u5bf9\u4e8epreserve-3d\uff0c\u8fd9\u91cc\u8981\u8bf4\u660e\u7684\u662f\uff0c\u5b83\u53ea\u5f71\u54cd\u8fd9\u4e2a\u5143\u7d20\u7684\u5b50\u5143\u7d20\uff08\u4e8c\u7ea7\u5143\u7d20\uff09\uff0c\u5b59\u5143\u7d20\uff08\u4e09\u7ea7\u5143\u7d20\uff09\u5982\u679c\u4e5f\u60f3\u62e5\u67093D\u6a21\u5f0f\uff0c\u90a3\u4e48\u5c31\u5fc5\u987b\u7ed9\u5b83\u7684\u4e0a\u7ea7\u5143\u7d20\uff08\u7236\u5143\u7d20\uff09\u4e5f\u6dfb\u52a0preserve-3d\u3002<\/p>\n<p>box-sizing\u662f\u6211\u4eec\u5e73\u65f6\u6bd4\u8f83\u5c11\u63a5\u89e6\u5230\u7684\u5c5e\u6027\uff0c\u5176\u5206\u8fa8\u67092\u4e2a\u503ccontent-box\u548cborder-box\u3002<br \/>\ncontent-box\uff1a\u6b64\u5c5e\u6027\u8868\u73b0\u4e3a\u6807\u51c6\u6a21\u5f0f\u4e0b\u7684\u76d2\u6a21\u578b\uff08\u5f53\u6211\u4eec\u8bbe\u7f6e\u5143\u7d20\u7684width\u548cheight\u65f6\uff0c\u5b83\u7684\u5bbd\u5ea6\u4e0d\u5305\u62ecborder\u548cpadding\u3002\u4f8b\uff1awidth:100px; border-width:10px; \u5143\u7d20\u5b9e\u9645\u5bbd\u5ea6\u4e3a220px;\uff09<br \/>\nborder-box\uff1a\u6b64\u5c5e\u6027\u8868\u73b0\u4e3a\u602a\u5f02\u6a21\u5f0f\u4e0b\u7684\u76d2\u6a21\u578b\uff08\u548ccontent-box\u76f8\u53cd\uff0c\u5b83\u7684\u5bbd\u5ea6\u5305\u542bborder\u548cpadding\u3002\u4f8b\uff1awidth:100px; border-width:10px; \u6b64\u65f6\u7684border\u76f8\u5f53\u4e8e\u5185\u8fb9\u8ddd\uff0c\u5143\u7d20\u5b9e\u9645\u5bbd\u5ea6\u4ecd\u4e3a200px;\uff09<\/p>\n<p>\u597d\u4e86\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u770b\u4f8b\u5b50\u5427\uff1a<br \/>\n<!--more--><br \/>\n<strong>HTML CODE:<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;div class=&quot;wrap&quot;&gt;\r\n\t&lt;div class=&quot;inner&quot;&gt;&lt;\/div&gt;\r\n\t&lt;div class=&quot;x&quot;&gt;\r\n\t\t&lt;div class=&quot;x1&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;x2&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;xInner&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;y&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;y1&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;y2&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;yInner&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;z&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;z1&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;z2&quot;&gt;&lt;\/div&gt;\r\n\t\t&lt;div class=&quot;zInner&quot;&gt;&lt;\/div&gt;\r\n\t&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p><strong>CSS CODE:<\/strong><\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n* {\r\n\tmargin:0; padding:0;\r\n\t-webkit-box-sizing: border-box;\r\n\t-moz-box-sizing: border-box;\r\n\t-ms-box-sizing: border-box;\r\n\tbox-sizing: border-box;\r\n}\r\nbody {\r\n\tbackground:black;\r\n}\r\n.wrap {\r\n\tmargin: 150px auto;\r\n\tposition: relative;\r\n\t-webkit-box-sizing: border-box;\r\n\t-moz-box-sizing: border-box;\r\n\t-ms-box-sizing: border-box;\r\n\tbox-sizing: border-box;\r\n}\r\n.wrap, .x, .y, .z {\r\n\twidth: 200px;\r\n\theight: 200px;\r\n\tborder-radius: 50%;\r\n}\r\n.x1, .x2, .y, .y1, .y2, .z, .z1, .z2 , .xInner , .yInner , .zInner {\r\n\tposition: absolute;\r\n}\r\n.x1,.x2,.y1,.y2,.z1,.z2 {\r\n\twidth: 87.5%;\r\n\theight: 87.5%;\r\n\tborder-radius: 50%;\r\n}\r\n.x {\r\n\tposition: relative;\r\n\tborder: 1px solid #FF0099;\r\n\t-webkit-transform-style: preserve-3d;\r\n\t-moz-transform-style: preserve-3d;\r\n\t-ms-transform-style: preserve-3d;\r\n\ttransform-style: preserve-3d;\r\n\t-webkit-animation: mymove 10s linear infinite;\r\n\t-moz-animation: mymove 10s linear infinite;\r\n\t-ms-animation: mymove 10s linear infinite;\r\n\tanimation: mymove 10s linear infinite;\r\n}\r\n.y {\r\n\ttop: 0; left: 0;\r\n\tborder: 2px solid #0099FF;\r\n\t-webkit-transform: rotateX(90deg);\r\n\t-moz-transform: rotateX(90deg);\r\n\t-ms-transform: rotateX(90deg);\r\n\ttransform: rotateX(90deg);\r\n}\r\n.z {\r\n\ttop: 0; left: 0;\r\n\tborder: 1px solid #FFCC33;\r\n\t-webkit-transform: rotateY(90deg);\r\n\t-moz-transform: rotateY(90deg);\r\n\t-ms-transform: rotateY(90deg);\r\n\ttransform: rotateY(90deg);\r\n}\r\n.x1 {\r\n\ttop: 6.25%; left: 6.25%;\r\n\tborder: 1px solid #FF0099;\r\n\t-webkit-transform: translateZ(50px);\r\n\t-moz-transform: translateZ(50px);\r\n\t-ms-transform: translateZ(50px);\r\n\ttransform: translateZ(50px);\r\n}\r\n.x2 {\r\n\ttop: 6.25%; left: 6.25%;\r\n\tborder: 1px solid #FF0099;\r\n\t-webkit-transform: rotateX(180deg) translateZ(50px);\r\n\t-moz-transform: rotateX(180deg) translateZ(50px);\r\n\t-ms-transform: rotateX(180deg) translateZ(50px);\r\n\ttransform: rotateX(180deg) translateZ(50px);\r\n}\r\n.y1 {\r\n\ttop: 6.25%; left: 6.25%;\r\n\tborder: 1px solid #0099FF;\r\n\t-webkit-transform: rotateX(90deg) translateZ(50px);\r\n\t-moz-transform: rotateX(90deg) translateZ(50px);\r\n\t-ms-transform: rotateX(90deg) translateZ(50px);\r\n\ttransform: rotateX(90deg) translateZ(50px);\r\n}\r\n.y2 {\r\n\ttop: 6.25%; left: 6.25%;\r\n\tborder: 1px solid #0099FF;\r\n\t-webkit-transform: rotateX(270deg) translateZ(50px);\r\n\t-moz-transform: rotateX(270deg) translateZ(50px);\r\n\t-ms-transform: rotateX(270deg) translateZ(50px);\r\n\ttransform: rotateX(270deg) translateZ(50px);\r\n}\r\n.z1 {\r\n\ttop: 6.25%; left: 6.25%;\r\n\tborder: 1px solid #FFCC33;\r\n\t-webkit-transform: rotateY(90deg) translateZ(50px);\r\n\t-moz-transform: rotateY(90deg) translateZ(50px);\r\n\t-ms-transform: rotateY(90deg) translateZ(50px);\r\n\ttransform: rotateY(90deg) translateZ(50px);\r\n}\r\n.z2 {\r\n\ttop: 6.25%; left: 6.25%;\r\n\tborder: 1px solid #FFCC33;\r\n\t-webkit-transform: rotateY(270deg) translateZ(50px);\r\n\t-moz-transform: rotateY(270deg) translateZ(50px);\r\n\t-ms-transform: rotateY(270deg) translateZ(50px);\r\n\ttransform: rotateY(270deg) translateZ(50px);\r\n}\r\n.xInner {\r\n\tborder: 1px solid #FF0099;\r\n\twidth: 100%;\r\n\ttop: 50%;\r\n}\r\n.yInner {\r\n\theight: 100%;\r\n\tleft: 50%;\r\n\tborder: 1px solid #0099FF;\r\n\t-webkit-transform: rotateX(90deg);\r\n\t-moz-transform: rotateX(90deg);\r\n\t-ms-transform: rotateX(90deg);\r\n\ttransform: rotateX(90deg);\r\n}\r\n.zInner {\r\n\theight: 100%;\r\n\tleft: 50%;\r\n\tborder: 1px solid #FFCC33;\r\n\t-webkit-transform: rotateY(90deg);\r\n\t-moz-transform: rotateY(90deg);\r\n\t-ms-transform: rotateY(90deg);\r\n\ttransform: rotateY(90deg);\r\n}\r\n\r\n@-webkit-keyframes mymove\r\n{\r\n\t100% { -webkit-transform:  rotateX(360deg) rotateY(180deg) }\r\n}\r\n@-moz-keyframes mymove\r\n{\r\n\t100% { -moz-transform:  rotateX(360deg) rotateY(360deg) }\r\n}\r\n@-ms-keyframes mymove\r\n{\r\n\t100% { -ms-transform:  rotateX(360deg) rotateY(360deg) }\r\n}\r\n@keyframes mymove\r\n{\r\n\t100% { transform:  rotateX(360deg) rotateY(360deg) }\r\n}\r\n<\/pre>\n<p>\u6d4b\u8bd5\u73af\u5883\uff1aChrome\u3001Safari\u3001Firefox\uff08FF\u6d41\u7545\u5ea6\u4e0d\u662f\u5f88\u597d\uff09<\/p>\n<p><a class=\"dlBtn\" title=\"Demo\" href=\"http:\/\/www.bluesdream.com\/case\/css3\/3d-rotating-sphere\/\" target=\"_blank\">Demo<\/a><a class=\"dlBtn\" title=\"Download\" href=\"http:\/\/www.bluesdream.com\/case\/css3\/3d-rotating-sphere\/CSS3RotatingSphere.rar\" target=\"_blank\">Download<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4e3b\u8981\u60f3\u8bb2\u7684\u662ftransform-style:preserve-3d\u548cbox-sizing:border-box\u8fd9\u4e24\u4e2a\u5c5e\u6027\u3002 \u5bf9\u4e8epreserve-3d\uff0c\u8fd9\u91cc\u8981\u8bf4\u660e\u7684\u662f\uff0c\u5b83\u53ea\u5f71\u54cd\u8fd9\u4e2a\u5143\u7d20\u7684\u5b50\u5143\u7d20\uff08\u4e8c\u7ea7\u5143\u7d20\uff09\uff0c\u5b59\u5143\u7d20\uff08\u4e09\u7ea7\u5143\u7d20\uff09\u5982\u679c\u4e5f\u60f3\u62e5\u67093D\u6a21\u5f0f\uff0c\u90a3\u4e48\u5c31\u5fc5\u987b\u7ed9\u5b83\u7684\u4e0a\u7ea7\u5143\u7d20\uff08\u7236\u5143\u7d20\uff09\u4e5f\u6dfb\u52a0preserve-3d\u3002 box-sizing\u662f\u6211\u4eec\u5e73\u65f6\u6bd4\u8f83\u5c11\u63a5\u89e6\u5230\u7684\u5c5e\u6027\uff0c\u5176\u5206\u8fa8\u67092\u4e2a\u503ccontent-box\u548cborder-box\u3002 content-box\uff1a\u6b64\u5c5e\u6027\u8868\u73b0\u4e3a\u6807\u51c6\u6a21\u5f0f\u4e0b\u7684\u76d2\u6a21\u578b\uff08\u5f53\u6211\u4eec\u8bbe\u7f6e\u5143\u7d20\u7684width\u548cheight\u65f6\uff0c\u5b83\u7684\u5bbd\u5ea6\u4e0d\u5305\u62ecborder\u548cpadding\u3002\u4f8b\uff1awidth:100px; border-width:10px; \u5143\u7d20\u5b9e\u9645\u5bbd\u5ea6\u4e3a220px;\uff09 border-box\uff1a\u6b64\u5c5e\u6027\u8868\u73b0\u4e3a\u602a\u5f02\u6a21\u5f0f\u4e0b\u7684\u76d2\u6a21\u578b\uff08\u548ccontent-box\u76f8\u53cd\uff0c\u5b83\u7684\u5bbd\u5ea6\u5305\u542bborder\u548cpadding\u3002\u4f8b\uff1awidth:100px; border-width:10px; \u6b64\u65f6\u7684border\u76f8\u5f53\u4e8e\u5185\u8fb9\u8ddd\uff0c\u5143\u7d20\u5b9e\u9645\u5bbd\u5ea6\u4ecd\u4e3a200px;\uff09 \u597d\u4e86\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u770b\u4f8b\u5b50\u5427\uff1a<\/p>\n","protected":false},"author":1,"featured_media":388,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[93,20,76,78,92,82],"class_list":["post-387","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-front-end","tag-animation","tag-css","tag-css3","tag-html","tag-preserve-3d","tag-transform"],"_links":{"self":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts\/387"}],"collection":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/comments?post=387"}],"version-history":[{"count":0,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts\/387\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/media\/388"}],"wp:attachment":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/media?parent=387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/categories?post=387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/tags?post=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}