I have created a simple css animation that translates an pseudo element vertically. This animation works great in Chrome, FireFox and Safari but not so much in Microsoft Edge or Internet Explorer.
I am struggling to figure out the reason for this bug. Any help would be great!
How the animation should look:
How it looks in Edge and IE:
Animation example: https://jsfiddle.net/9x5vckhb/
#keyframes scroll {
0% {
transform: translate(-50%, 20%);
opacity: 0;
},
30% {
opacity: 1;
},
40% {
opacity: 1;
},
70% {
transform: translate(-50%, 120%);
opacity: 0;
},
100% {
transform: translate(-50%, 120%);
opacity: 0;
}
}
I am wondering if this is a bug or not. I for the life could not wrap my head around this. It seemed like the x & y were being swapped after the first animation loop. Switched to transform3d() and it worked perfectly.
Fiddle
&:before {
content: '•';
font-size: round($width/100*63.3);
top: 0;
transform: translate3d(-50%, 30%, 0);
animation: scroll ease 3s;
animation-iteration-count: infinite;
}
And
#keyframes scroll {
0% {
transform: translate3d(-50%, 20%, 0);
opacity: 0;
},
30% {
opacity: 1;
},
40% {
opacity: 1;
},
70% {
transform: translate3d(-50%, 120%, 0);
opacity: 0;
},
100% {
transform: translate3d(-50%, 120%, 0);
opacity: 0;
}
}
Related
I have an SVG with a simple CSS animation which works perfectly in every browser.
Except Safari (tested on Safari 15.3 on a MacOS M1).
.foobar {
position: absolute;
top: 0;
right: 0;
width: 40%;
animation: rotate 10s linear infinite;
}
#keyframes rotate {
0% {
transform: translate(50%, -50%);
}
100% {
transform: translate(50%, -50%) rotate(-360deg);
}
}
The first keyframe is applied (the translate), but it stays frozen on this frame.
Oddly enough, Safari requires to specify the rotate on the first keyframe:
#keyframes rotate {
0% {
transform: translate(50%, -50%) rotate(0deg);
}
100% {
transform: translate(50%, -50%) rotate(-360deg);
}
}
And now it works 🤷♂️
I wanna make a drop animation when the page loads similar to a working example I've seen at someone else but mine doesn't. The image doesn't drop at all, does not transition from 0 opacity to 1 opacity. It just suddenly appears after the given duration. Help me, please.
.cover img{
height: 60vh;
filter: drop-shadow(1px 5px 3px black);
position: relative;
left: 60px;
animation: drop 1.5s ease;
}
#keyframes drop{
0% {
opacity: 0%;
transform: translateY(-80px);
}
100% {
opacity: 1%;
transform: translateY(0px);
}
}
What I think you've done wrong is used a percentage in the opacity. You just need the number.
#keyframes drop {
0% {
opacity: 0;
transform: translateY(-80px);
}
100% {
opacity: 1;
transform: translateY(0px);
}
}
Does this help?
I installed animate.css and am quite happy with it. Only one thing I cannot change: the amount of the position change.
In particular I use the animation "fadeInUp" and want to change from what point exactly the fading starts. At the moment it's too much.
I checked the css file but the only thing I found concerning this is:
#-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
#keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}
I can't see how I can change that here. Any help is highly appreciated.
I'm using Chrome Version 37.0.2062.120 m
I have a carousel created in owl carousel 2 and added a number of different CSS3 animations for transitions. The problem is Chrome always keeps a section of the top left of the carousel on screen during any transition.
It is not an element being kept on screen, but a glitch of different sizes cut through the carousel.
I have included an example here:
Javascript
this.$el.owlCarousel({
nav:true,
autoplay:true,
items:1,
margin:5,
loop:true,
center:true,
onTranslated: _.bind(this.translated,this),
animateIn: 'fadeInDown', // <-- css3 transition class
animateOut: 'fadeOutDown', // <-- css3 transition class
});
// gets the id of the slide and updates the data
translated: function (){
var currentSlideId = this.$el.find(".owl-item.active > .item").attr('id');
slideModule.loadSlide(currentSlideId);
}
css
#-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
#keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}
#-webkit-keyframes fadeOutUp {
0% {
opacity: 1;
}
100% {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
#keyframes fadeOutUp {
0% {
opacity: 1;
}
100% {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
.fadeOutUp {
-webkit-animation-name: fadeOutUp;
animation-name: fadeOutUp;
}
you can try:
owl-carousel .owl-item { -webkit-transform: translateZ(0) !important; }
hope it help :)
I'm looking at optimising CSS animations for performance.
From what I can find out using
.item { transform: translate(-25px,-50px)
is much more efficient than
.item { left: -25px; top: -50px }
I've setup a little animation that move and rotates a box .balloon which as multiple steps to the animation. The problem is though the animation becomes very jerky, even with positioning ans rotation declared for each step
Here is my standard CSS
#keyframes balloon {
0%,100% { left:809px; top:50px; transform: rotate(0deg) }
10% { transform: rotate(-9deg) }
25%,75% { top:25px }
50% { left:235px;top:75px }
45% { transform: rotate(3deg) }
75% { transform: rotate(12deg) }
}
This is my optimised CSS, which is where the jerky animation comes in to effect
#keyframes balloon {
0% { transform: translate(0,0) rotate(0deg) }
10% { transform: translate(-57.5px,-10px) rotate(-9deg) }
25% { transform: translate(-143.75px,-25px) rotate(-4deg) }
45% { transform: translate(-517.5px,22.5px) rotate(3deg) }
50% { transform: translate(-575px,25px) rotate(4.5deg) }
75% { transform: translate(-287.5px,-25px) rotate(12deg) }
100% { transform: translate(0,0) rotate(0deg) }
}
Is there an alternative solution for this?
I've put a CodePen together here.
In your animation-property, try to add a value for the animation-timing-function
Something like
animation: balloon 15s infinite linear;
would make it more smooth.