Note that there are some explanatory texts on larger screens.

plurals
  1. POMaking this CSS3 animate rotation only rotate once
    primarykey
    data
    text
    <p>I'm attempting to animate a pie chart that rotates from 0 degrees to whatever degree I want it to end on (lets say 300 degrees, doesn't matter). There's an underlying circle with one that rotates on top. As it stands right now, the pie chart rotates a full 360 degrees before ending with the final degree position (300 in this case). Right now it only works in Chrome.</p> <p><strong><a href="http://jsfiddle.net/BkJY7/9/" rel="nofollow">JSFiddle</a></strong></p> <p>My HTML:</p> <pre><code>&lt;div class="spinner"&gt; &lt;span&gt;&lt;em&gt;&lt;/em&gt;&lt;/span&gt; &lt;span&gt;&lt;em&gt;&lt;/em&gt;&lt;/span&gt; &lt;/div&gt; </code></pre> <p>My CSS:</p> <pre><code>.spinner { width: 250px; height: 250px; background: #aaa; margin: 0 auto; position: relative; } .spinner:after { position: absolute; content: ""; width: 0%; height: 0%; border-radius: 100%; background: #fff; top: 10%; left: 10%; } .spinner span em { background: #0e728e; -webkit-animation-duration: 6s; } @-webkit-keyframes rotate-rt { 0% { -webkit-transform: rotate(0deg); } 25% { -webkit-transform: rotate(180deg); } 100% { -webkit-transform: rotate(180deg); } } @-webkit-keyframes rotate-lt { 0% { -webkit-transform: rotate(0deg); } 25% { -webkit-transform: rotate(0deg); } 50% { -webkit-transform: rotate(120deg); } 100% { -webkit-transform: rotate(120deg); } } .spinner { border-radius: 100%; position: relative; } .spinner span { width: 50%; height: 100%; overflow: hidden; position: absolute; } .spinner span:first-child { left: 0; } .spinner span:last-child { left: 50%; } .spinner span em { border-radius: 250px; position: absolute; width: 100%; height: 100%; -webkit-animation-iteration-count: 1; -webkit-animation-timing-function: linear; -webkit-animation-fill-mode: forwards; } .spinner span:first-child em { left: 100%; border-top-left-radius: 0; border-bottom-left-radius: 0; -webkit-animation-name: rotate-lt; -webkit-transform-origin: 0 50%; } .spinner span:last-child em { left: -100%; border-top-right-radius: 0; border-bottom-right-radius: 0; -webkit-animation-name: rotate-rt; -webkit-transform-origin: 100% 50%; } </code></pre>
    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.
 

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