Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I just did this exact same thing today. I came across this question this morning, so wanted to post a bit of help.</p> <p>Generated code:</p> <pre><code>&lt;div class="view-Cylinder-Background" style="width: 100%; height: 100%; position: absolute; left: 0px; right: 0px; -webkit-perspective-origin-x: 50%; -webkit-perspective-origin-y: 50%; -webkit-perspective: 500; "&gt; &lt;div style="width: 100%; height: 100%; -webkit-transform-style: preserve-3d; -webkit-transform: translateZ(1222.3099629457563px); "&gt; &lt;div style="-webkit-transform-style: preserve-3d; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; width: 0px; -webkit-transition-property: -webkit-transform; -webkit-transition-duration: 0.5s; -webkit-transform: rotateY(-748.5000000000005deg); "&gt; &lt;div class="view-Cylinder-Item" style="position: absolute; left: -77px; -webkit-transform: rotateY(0deg) translateZ(1195.5154099609108px) translateY(0px); -webkit-transition-property: -webkit-transform; -webkit-transition-duration: 0.5s; "&gt; &lt;div style="-webkit-transform: rotateY(180deg); "&gt; &lt;div style="background-image: url(images/panarama.jpg); width: 153px; height: 1024px; background-position: 0px 0px; "&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="view-Cylinder-Item" style="position: absolute; left: -77px; -webkit-transform: rotateY(7.2deg) translateZ(1195.5154099609108px) translateY(0px); -webkit-transition-property: -webkit-transform; -webkit-transition-duration: 0.5s; "&gt; &lt;div style="-webkit-transform: rotateY(180deg); "&gt; &lt;div style="background-image: url(images/panarama.jpg); width: 153px; height: 1024px; background-position: 153.6px 0px; "&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="view-Cylinder-Item" style="position: absolute; left: -77px; -webkit-transform: rotateY(14.4deg) translateZ(1195.5154099609108px) translateY(0px); -webkit-transition-property: -webkit-transform; -webkit-transition-duration: 0.5s; "&gt; &lt;div style="-webkit-transform: rotateY(180deg); "&gt; &lt;div style="background-image: url(images/panarama.jpg); width: 153px; height: 1024px; background-position: 307.2px 0px; "&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>the outer divs are the cylinder itself. The 3 "view-Cylinder-Item" divs are faces on that cylinder. This particular example is split into 50 faces (cut for brevity sake), so each face is rotated by <code>7.2 degrees</code>. The <code>translateZ</code> of the faces is calculated by basic geometry (pythagoras: <code>sqrt( radius^2 - face_width^2 )</code>. Radius is calculated as <code>imageWidth / Pi / 2</code> and is used in the <code>translateZ</code> of the wrapping div (<code>1222... pixels</code>). Each face is also offset by <code>-50%</code> (<code>left: -77px</code>) to place it in the correct location.</p> <p>Hope this helps a bit, I know this is question is a few months old.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload