Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't think that it can be done with transforms. May be you can do it with keyframes. A similar code:</p> <pre><code>@-webkit-keyframes rotate1 { from {-webkit-transform: rotate(0deg)} to {-webkit-transform: rotate(180deg)} } @-webkit-keyframes rotate2 { from {-webkit-transform: rotate(180deg)} to {-webkit-transform: rotate(360deg)} } #rotable { background-color: red; -webkit-animation-name: rotate2; -webkit-animation-duration: 3s; -webkit-transform: rotate(180deg); } #rotable:hover { background-color: yellow; -webkit-animation-name: rotate1; -webkit-animation-duration: 3s; } </code></pre> <p>does a similar thing to what you want. Notice that the turning direction is always the same.</p> <p>Another posibility, mixing transition and animation (for the change where the transition would go in the opposite direction ...)</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.container { perspective: 500px; } .test { transform: rotate(360deg); transition: transform 4s; } .container:hover .test { transform: rotateY(180deg); animation: turn 4s; } @keyframes turn { from {transform: rotate(0deg);} } div { display: inline-block; width: 200px; height: 200px; } .test { background-color: lightblue; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt; &lt;div class="test"&gt;TEST&lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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