Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transform rotate not working properly in chrome

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.

like image 358
ensixte Avatar asked Nov 09 '22 21:11

ensixte


1 Answers

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%;
}
like image 103
Anima-t3d Avatar answered Nov 15 '22 07:11

Anima-t3d