I have a problem to do an animation where I have circle
in svg
and I need to make it increase until I cover the whole screen, like a FAB
that turns into a div, I've done an animation of that but with a lot of background-size
and background-position
.
The simplest and best-performing mode was using transform: scale();
, it was the way I wanted it, but here comes the problem, in Firefox it worked perfectly, but in Chrome (and in Opera I'm using) svg stays 'blurred' so to speak while scale
is occurring.
There's some way to fix this even if I have to use some js library or something, because I've tried everything I know and it did not work. Here is the code I'm using.
$(document).ready(function() {
$(".btn").click(function () {
svg = $(this);
if(svg.attr("class") == "btn active") {
svg.attr("class", "btn");
}
else {
svg.attr("class", "btn active");
}
});
})
.btn {
fill: #1dc7ff;
width: 3.5rem;
height: 3.5rem;
border-radius: 50%;
cursor: pointer;
position: fixed;
right: 1rem;
bottom: 1rem;
transition: .05s;
}
.btn:active {
transform: scale(.95);
transition: 4s;
}
.btn.active {
transform: scale(100);
transition: 10s;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><svgclass="btn">
<circle cx="1.75rem" cy="1.75rem" r="1.75rem"></circle>
</svg>
Note: I tried to use the code below that I found in several forums but did not solve:
svg {
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
transform: translateZ(0);
}