{"id":882,"date":"2013-10-11T12:19:11","date_gmt":"2013-10-11T16:19:11","guid":{"rendered":"http:\/\/www.lilithebowman.com\/blog\/?p=882"},"modified":"2013-10-15T10:27:12","modified_gmt":"2013-10-15T14:27:12","slug":"3d-rotating-cube-in-css3","status":"publish","type":"post","link":"https:\/\/www.lilithebowman.com\/blog\/2013\/10\/3d-rotating-cube-in-css3\/","title":{"rendered":"3D Rotating Cube in CSS3"},"content":{"rendered":"<p><a href=\"http:\/\/lilithebowman.com\/rotate3d\/rotate3dtest.html\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.lilithebowman.com\/blog\/wp-content\/uploads\/2013\/10\/translate3d-300x215.png\" alt=\"translate3d\" width=\"300\" height=\"215\" class=\"aligncenter size-medium wp-image-892\" srcset=\"https:\/\/www.lilithebowman.com\/blog\/wp-content\/uploads\/2013\/10\/translate3d-300x215.png 300w, https:\/\/www.lilithebowman.com\/blog\/wp-content\/uploads\/2013\/10\/translate3d.png 744w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I recently set out to see if I could make a cross-browser 3D rotating cube art gallery in only CSS3.<\/p>\n<p>I&#8217;m not finished yet, but this solution is so simple I thought I&#8217;d share what I have so far.<\/p>\n<p>Basically I have 4 walls with no floor or ceiling. I want to have a piece of artwork on each wall and rotate the display so the user can face a new wall with a new piece of art on it.<\/p>\n<p>The code is simple, I&#8217;ve used CSS3 tranforms to achieve the 3D walls.<\/p>\n<p>You can see <a href=\"https:\/\/github.com\/eanbowman\/rotate3d_demo\/blob\/master\/rotate3dtest.html\" target=\"_blank\">the code listing for rotate3d_demo on GitHub<\/a>.<\/p>\n<p>Check out the <a href=\"http:\/\/lilithebowman.com\/rotate3d\/rotate3dtest.html\" target=\"_blank\">rotate3d demo<\/a> here.<\/p>\n<p>Note that Internet Explorer 10 does work but the transition between one state and the other happens pretty much randomly compared to other browsers. IE 10 tries to spin the walls on their top left axis instead of, logically, spinning them in the direction of the translation.<\/p>\n<p><!--iframe src=\"http:\/\/lilithebowman.com\/rotate3d\/rotate3dtest.html\" height=\"704\" width=\"600\" border=\"0\"--><\/p>\n<p>EDIT: You may notice that the transition from the original to the 90 degree rotation is not perfect. That&#8217;s because each element is travelling <strong>directly<\/strong> to its destination instead of following a circular path equidistant from the centre. So in the middle of the animation, the walls are all much closer to the centre than they are at the end of it.<\/p>\n<p>To fix this, I&#8217;d have to key-frame the animation in such a way as to make their paths circular.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently set out to see if I could make a cross-browser 3D rotating cube art gallery in only CSS3. I&#8217;m not finished yet, but this solution is so simple I thought I&#8217;d share what I have so far. Basically I have 4 walls with no floor or ceiling. I want to have a piece [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-882","post","type-post","status-publish","format-standard","hentry","category-daily-musings"],"_links":{"self":[{"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/posts\/882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/comments?post=882"}],"version-history":[{"count":15,"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/posts\/882\/revisions"}],"predecessor-version":[{"id":899,"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/posts\/882\/revisions\/899"}],"wp:attachment":[{"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/media?parent=882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/categories?post=882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lilithebowman.com\/blog\/wp-json\/wp\/v2\/tags?post=882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}