I have a SVG of a play button in my application that I am applying a CSS transform effect to on hover, scaling up by a small amount.
This works fine in Chrome, however in Firefox 54 the inner polygon wiggles slightly when the animation resets after removing the :hover
pseudo-class.
I have tried the answers from: Images wiggles when hover (scale effect) to no avail.
The SVG and CSS I am using, make sure to view in Firefox. The problem is very subtle and it seems like the triangle's scaling resets to a different position, then once the transition concludes it snaps back to it's original position.
How can I fix this in Firefox?
svg {
min-width: 75px;
width: 15%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
-moz-filter: blur(0px);
}
svg circle {
transition: all 0.2s ease-in-out;
transform-origin: 50% 50%;
-moz-filter: blur(0px);
}
svg polygon {
transition: all 0.2s ease-in-out;
transform-origin: 50% 50%;
-moz-filter: blur(0px);
}
span:hover .circle {
fill: #000;
fill-opacity: 1;
transform: scale(1.05);
-webkit-transform: scale(1.05);
-moz-transform: scale(1.05);
-ms-transform: scale(1.05);
-o-transform: scale(1.05);
}
span:hover .triangle {
fill-opacity: 1;
transform: scale(1.05);
-webkit-transform: scale(1.05);
-moz-transform: scale(1.05);
-ms-transform: scale(1.05);
-o-transform: scale(1.05);
}
<span style='width:100%;'>
<svg xmlns='http://www.w3.org/2000/svg' viewBox='-10 -10 237 237'>
<circle class='circle' fill='#666' fill-opacity='0.5' stroke-width='8' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10' cx='109.8' cy='109.8' r='103.3' stroke='#000' />
<polygon class='triangle' fill='#fff' fill-opacity='0.5' stroke-width='8' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10' points='76.5,62.5 153.5,105.8 76.5,154.1' stroke='#000'/>
</svg>
</span>