In my design, I have created a simple Spinner icon in Figma. It's meant to be perfectly aligned at the center of an enclosing frame that has dimensions of 64x64. To achieve the rotating effect, I applied CSS rotation as shown below:
let rotation = 0;
function incrementAnimationFrame() {
rotation = (6 + rotation) % 360;
$('#rotationBlock').css('transform', `rotate(${rotation}deg)`);
requestAnimationFrame(incrementAnimationFrame);
}
requestAnimationFrame(incrementAnimationFrame);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="rotationBlock" style="display: block; width: 160px; padding: 0px; margin: 0px;">
<svg preserveAspectRatio="xMidYMid meet" fill="#FFD041" height="160px" viewBox="0 0 64 64">
<path d="M35.6561 2.22362C43.2296...(SVG path data)...8\"></path>
</svg>
</div>
https://codepen.io/jwir3/pen/dyvEQKa
The animation appears to slightly bob up and down, possibly due to how the SVG viewBox is set and the alignment of the Spinner's center. Is there a solution to eliminate this bouncing effect? Could it be an issue with the alignment precision in Figma?