Note that there are some explanatory texts on larger screens.

plurals
  1. POImpress.js Cube - change the direction of transition
    text
    copied!<p>I made a cube in impress.js as my first practice project and its working fine except the transition from face 3 to 4. Faces 1,2,3,4 are all parallel to Z-axis and placed in anticlockwise direction when viewed from top. Transition from 1 -> 2, 2 -> 3 (anticlockwise, from top) is ok but transition from 3->4 is clockwise, ie it moves back to 2 then 1 then 4. Any way to change it so that it moves from 3 -> 4 directly?</p> <p>Here's my code:</p> <p>HTML</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset = "utf-8"&gt; &lt;title&gt;Cube using Impress.js&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="style.css"&gt; &lt;/head&gt; &lt;body class="impress-not-supported"&gt; &lt;div class="fallback-message"&gt; &lt;!-- Message here --&gt; &lt;/div&gt; &lt;div id="impress"&gt; &lt;div id="face-1" class="step" data-z="350"&gt; This is face 1 &lt;/div&gt; &lt;div id="face-2" class="step" data-x="350" data-rotate-y="90"&gt; This is face 2 &lt;/div&gt; &lt;div id="face-3" class="step"data-z="-350" data-rotate-y="180"&gt; This is face 3 &lt;/div&gt; &lt;div id="face-4" class="step" data-x="-350" data-rotate-y="-90"&gt; This is face 4 &lt;/div&gt; &lt;div id="face-5" class="step" data-y="-350" data-rotate-x="90"&gt; This is face 5 &lt;/div&gt; &lt;div id="face-6" class="step" data-y="350" data-rotate-x="-90"&gt; This is face 6 &lt;/div&gt; &lt;/div&gt; &lt;script src="impress.js"&gt;&lt;/script&gt; &lt;script&gt;impress().init();&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>CSS</p> <pre><code>html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; } body { font: normal 70px/70px sans-serif; background: -webkit-radial-gradient(rgb(240, 240, 240), rgb(190, 190, 190)); } b, strong { font-weight: bold } i, em { font-style: italic } .fallback-message { font-family: sans-serif; line-height: 1.3; width: 780px; padding: 10px 10px 0; margin: 20px auto; border: 1px solid #E4C652; border-radius: 10px; background: #EEDC94; } .fallback-message p { margin-bottom: 10px; } .impress-supported .fallback-message { display: none; } .step { -webkit-box-sizing: border-box; -webkit-backface-visibility: hidden; width: 700px; height: 700px; border: 1px solid black; text-align: center; padding: 25px; opacity: .3; } .step.active{ opacity: 1; } </code></pre>
 

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