5

The following code renders a perfect rotating circle in safari, but not in chrome.

<style>
.circle{
    height:1000px;
    width:1000px;
    background-color:#000;
    border-radius: 50%;
}

@-webkit-keyframes rotating {
from{
    -webkit-transform: rotate(0deg);
}
to{
    -webkit-transform: rotate(360deg);
}
}

.rotating {
    -webkit-animation: rotating 2s linear infinite;
    -webkit-transform-origin: center;
}
</style>

<div class="circle rotating">
</div>

http://jsfiddle.net/p4ban9cs/

It does not renders perfectly, the problem is visible when rotating a big circle, it's like a wiggling circle on chrome.

thank you for help.

13
  • 2
    so what is the problem, not rotating ? not perfect circle ? Commented Dec 23, 2014 at 12:48
  • Your fiddle works for me in Chrome. Commented Dec 23, 2014 at 13:02
  • @AndréDion For me it renders a "wiggling" circle (chrome 39 wind 7)
    – web-tiki
    Commented Dec 23, 2014 at 13:03
  • 6
    There is an uresolved duplicate question at stackoverflow.com/questions/24070899/… The suggestion seems to be to use an image.. Commented Dec 23, 2014 at 13:24
  • 1
    @ensixte if it is for overflowed content of the same element why not remove the outer shadow and set overflow:hidden to it ? jsfiddle.net/L2r6tjq8/2 Commented Dec 23, 2014 at 14:07

1 Answer 1

1

Adding an outer element as a wrapper and apply same styling to it, to mask the inner circle rotation as seen in this Fiddle

<div class="overlay">
    <div class="circle rotating">Test</div>
</div>

.overlay{
    height:1000px;
    width:1000px;
    box-shadow:0 0 0 10px #000 ;
    background:black;
    border-radius: 50%;
}
2
  • Thank you for the help =), but it does not seems to work, just change the color of the overlay box-shadow to see the result jsfiddle.net/p4ban9cs/18 with the same colour it seems correct but that doesn't solve the problem, i tried a lot of hiding tricks but no one works (no visually perfect result), that is why i gone to the base of the problem, why chrome renders like that ?! thank you again for your help.
    – ensixte
    Commented Dec 23, 2014 at 14:31
  • @ensixte It was not meant to be fix the base of the problem. It was meant to visually look good ;-) The problem seems to be an issue with how chrome calculates border-radius I tried verifying this by rotating without border-radius but it's hard to confirm it rotating around the correct pivot point, making a perfect circle with the corners...
    – Anima-t3d
    Commented Dec 23, 2014 at 14:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.