1
I’m having a problem making an animation where I have one circle
in svg
and I need to make it go up to cover the entire screen, like a FAB
which transforms into a div, I’ve done an animation of this but with a lot of fun background-size
and background-position
.
The simplest and best performing mode was using transform: scale();
, was the way I wanted but here comes the problem, Firefox worked perfectly, but in Chrome (and Opera I’m using) svg is 'blurred' so to say while the scale
.
There is some way to fix this even if you have to use some js library or something like that, because I’ve tried everything I know and nothing helped. Follow 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>
<svg class="btn">
<circle cx="1.75rem" cy="1.75rem" r="1.75rem"></circle>
</svg>
Obs: I have tried to use the code below that I found in several forums but not solved:
svg {
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
transform: translateZ(0);
}
I think it depends on the browser. Which one are you testing? At least in Chrome/OSX I don’t see much problem with animation. She’s a little fast, maybe that’s the cause of the blur?
– bfavaretto
Ready I edited the speed
– Bruno Romualdo
I know it only looks like this in Chrome and Opera, but since they are very used browsers (Chrome yoke) I need to solve this.
– Bruno Romualdo
kk the problem is not the speed of the animation but the way the
svg
is blurred during animationscale
as I left the example in the image.– Bruno Romualdo
I think what you had to do was the opposite: create a giant svg and put it initially smaller. So it wouldn’t burst. What you tha doing is creating a small and increasing... the browser bursts it when it increases.
– Sam
All right @Dvd I’ve seen something like this in an English forum but I couldn’t understand, I could make an example
– Bruno Romualdo
Blz @Dvd your suggestion worked, put an example so that I as answered.
– Bruno Romualdo