Basic Declaration & Usage
@keyframes name-of-animation {
0% { opacity: 0; }
20% { opacity: 1; }
80% { opacity: 0; }
100% { opacity: 1; }
}
.animate-this-element {
animation: name-of-animation 5s infinite;
}
You can use any number of “stops” in the @keyframe
animation, and it’s one of the main strengths of keyframe animations. While CSS transition
is only from one state to another, a keyframe animation can interpolate between many different states during its timeline.
If an animation has the same starting and ending properties, one way to do that is to comma-separate the 0% and 100% values:
@keyframes fontbulger {
0%, 100% {
font-size: 10px;
}
50% {
font-size: 12px;
}
}
Or, you could always tell the animation to run twice (or any even number of times) and tell the direction to alternate
.
Calling keyframe animation with separate properties
.box {
animation-name: bounce;
animation-duration: 4s; /* or: Xms */
animation-iteration-count: 10;
animation-direction: alternate; /* or: normal */
animation-timing-function: ease-out; /* or: ease, ease-in, ease-in-out, linear, cubic-bezier(x1, y1, x2, y2) */
animation-fill-mode: forwards; /* or: backwards, both, none */
animation-delay: 2s; /* or: Xms */
}
Animation Shorthand
Just space-separate all the individual values. The order doesn’t matter except when using both duration and delay, they need to be in that order. In the example below 1s = duration, 2s = delay, 3 = iterations.
animation: test 1s 2s 3 alternate backwards;
Combine transform and animation
@keyframes infinite-spinning {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
Multiple animations
You can comma-separate the values to declare multiple animations on a selector.
.animate-this {
animation:
first-animation 2s infinite,
another-animation 1s;
}
steps()
The steps()
function controls exactly how many keyframes will render in the animation timeframe. Let’s say you declare:
@keyframes move {
from { top: 0; left: 0; }
to { top: 100px; left: 100px; }
}
If you use steps(10) in your animation, it will make sure only 10 keyframes happen in the allotted time.
.move {
animation: move 10s steps(10) infinite alternate;
}
The math works out nicely there. Every one second, the element will move 10px to the left and 10px down, until the end of the animation, and then again in reverse forever.
This can be great for spritesheet animation like this demo by samurai.
Browser Support
This browser support data is from Caniuse, which has more detail. A number indicates that browser supports the feature at that version and up.
Desktop
Chrome | Firefox | IE | Edge | Safari |
---|---|---|---|---|
4* | 5* | 10 | 12 | 5.1* |
Mobile / Tablet
Android Chrome | Android Firefox | Android | iOS Safari |
---|---|---|---|
133 | 135 | 4* | 6.0-6.1* |
More Resources
Old Vendor Syntaxes
@-webkit-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
@-moz-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
@-o-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
#box {
-webkit-animation: NAME-YOUR-ANIMATION 5s infinite; /* Safari 4+ */
-moz-animation: NAME-YOUR-ANIMATION 5s infinite; /* Fx 5+ */
-o-animation: NAME-YOUR-ANIMATION 5s infinite; /* Opera 12+ */
animation: NAME-YOUR-ANIMATION 5s infinite; /* IE 10+, Fx 29+ */
}
is from & to equal to using 0% and 100%?
Yep! It is.
Yep..!!
great information i really enjoy it thankx so much
yes
If you use 0%, 50%, and 100% you can have in-betweens.
(ex. 0% nothing 25% grow 50% skew 75% change color 100% shrink)
Hello Chris Coyier,
The tips and tricks are nice, but if you include the demo link then it would be much helpful. For audience to view the effect live and you too to increase potential returning traffic.
Guys – this is the snippets section! It’s literally the only section of the site that doesn’t have demos/tutorials, it’s purely the grab-n-go snippets… As described!
Font Bulger:
http://jsfiddle.net/keif/p8ytP/
Infinite Spinning:
http://jsfiddle.net/keif/LTvLF/
Trust me, there is no better way to learn this stuff than to try and build your own demo.
This is even more true with JavaScript frameworks, and JSFiddle is an invaluable tool to throw down quick and dirty code to figure pieces out.
hi Adam, doesn’t the inability to do what Spence is looking for sort of defeats the purpose of animating in this way?
I’m encountering exactly the same problem. Any further thoughts on how to resolve it without hover approach?
I agree with Hiren. A demo attached to the snippets (whenever possible) would be very nice.
Agreed on the demo attached to snippets. Just something super-simple.
Hi Chris, you can use -webkit-animation-delay to delay the effects.
hey, Chris, the delay can be found here:
http://css-infos.net/property/-webkit-animation-delay
you can also use shorthand to set multiple declarations in one step:
http://css-infos.net/property/-webkit-animation
cheers!
Atg
Just experimenting, I found the webkit delay syntax is:
“-webkit-animation-delay: 5s;”
Pretty simple!
Hi and many thanks for the code snippet. Can anyone please help me with the following opacity animation:
The div layer starts invisible it then animates to fully visible (after a 2second delay) and remains in that state.
Currently with the code above (including the delay code) I can only get the following:
The div layer starts visible it then animates (flashes invisible then animates) to fully visible (after a 2second delay) and remains in that state.
If I put an opacity: 0; on the div then the following occurs:
The div layer starts invisible it then animates to fully visible (after a 2second delay) and then returns to invisible.
Is what I am attempting even possible or am I just being a Muppet?
many thanks.
Hey Spence –
I think what you’re looking for is only possible on hover/state change. This is how you do it:
1. Put your animate attributes on the element(s) you want to animate, ie:
.box {
-webkit-transition: all 0.2s ease-in-out;
}
2. On the hover:
.box:hover {
background: red;
}
That’s it! Change as necessary.
Adam, doesn’t the inability to do what Spence is looking for sort of defeats the purpose of animating in this way?
I’m encountering exactly the same problem. Any further thoughts on how to resolve it without hover approach?
Hi Spence,
I was just scratching my head about the same question and came across this page:
http://css3animator.com/2010/12/how-to-control-your-css3-animations/
I think this is what you’re looking for, you want to use forwards to make the last keyframe of your animation persist so you can make it look as if something has appeared
I also discovered if you use from and to, this behaviour is the default but it you want to use several keyframed states then it will default back to its original state unless you state the fill-mode
hth.
m.
Just use -webkit-animation-iteration-count: 1;
nice!
thanks Mairead
cool tut
thank you
Hey Chris! Really informative snippet! You’re blog just keeps getting better and better =)
Anyway, you mistakenly repeated ‘has the same’ in “has the same starting…”
Thanks!
Thanks, fixed!
Hi there all!
I’m new to CSS and a bit stuck! I have “2” images 70px By 70px I want “1” to stay still and “2” to rotate. image “2” has just a little dot and image “1” has an inner circle and an outer circle.. So I want the little dot to rotate between the inner and outer circle.. So far I’ve done it but the dot makes a big rotation off the screen!! I don’t no if it’s the stage of my rotation or not using margin’s the right way or the perspective origin not being there or non of the above. Thanks for any help in advance and hope someone knows what I’m going on about
Hi Lee,
It looks like you have to define a different center for the rotation. When you use -webkit-transform: rotate(), you can define the center point for both 2D and 3D rotation with -webkit-transform-origin (http://css-infos.net/property/-webkit-transform-origin)
This is really nice! Thanks guys for sharing this. I’m going to try it now :)
I’ve lost count how many times I’ve come back to this page. A great, simple writeup.
Hello everybody!
What about overriding a @keyframe animation set? I can’t figure out if it’s possible (using chrome).
I explain myself:
I made a webapp with several CSS3 features and @keyframes named sets for UI to interact beautifully. My app is customizable by different connected users. The customization is made by importing a css file that override some colors and layouts. I want people how knows CSS3 awesomness to be able to override my standard animations (triggered via javascript). But it looks like if you write a second @keyframes with the same name than first’s, the second definition is ignored.
Any help with this?
Love it!
nice content but boring site colors, Older site is much better in terms of colors
thank u chris. love it.
I can not load this page in ie8. The loading time take more…
Hi Jack
I realise in web design terms it’s a lifetime since you made your comment here but I was wondering whether you found a solution. I’ve had this problem for over a week and cannot find an answer.
Through much trial and error it appears IE8 simply will not ignore keyframes and as a result just gives up and freezes.
I’ve tried hiding the animations in a conditional comment and only serving them to IE9 + and all other browsers. Which works as expected, only as you probably know, IE10 does not support conditional comments!
Any help would be greatly appreciated…
Hi guys I want to be able to control the “frames” so I have 5 frames inside of one CSS sprite. They represent each state. I want them to play out over a specified amount of time with out the even motion in between I just want it to go from one frame to another over a specified amount of time. It’s hard for me to explain but flash has a way to do this rather easily.
Hey Chris, I think you want to use the step-start property. I used it on this animation (http://codepen.io/ScottJH/full/IAyEp). I realize this comment is over a year old, but hey, thought I’d contribute if I could.
Hello Chris,
I found your website very helpful. I learnt & implemented lot of new ideas from your site.
I was thrilled when I learnt this specific animation trick – usage of keyframes. I have implemented this to highlight the Archives on my site ABAP Help when people hover on it.
Thanks again so much for all these tutorials.
Regards,
Naimesh Patel
I have a question about combining animations – when I try the below I get either ‘leaffall’ OR ‘drop’ randomly on refresh. I was expecting both to happen simultaneously.
Anyone seen this problem?
Thank you so much for this snippet, Chris.
Regards from Brazil!
This is great! I was staying away from CSS3 animations because I thought the syntax was too difficult, but you’ve made it pretty simple to understand. Thanks.
For the infinite loop you could change the “to” value to 359deg to prevent it stopping
Its awesome, very easy to understand and a great thank for giving such a wonderful tutorial. I want to know if i want an animation (eg: text animation -fading) on sentance after another how can I achieve it. We do similar kind of text animation when we create presentations.
“The order doesn’t matter except when using both duration and delay, they need to be in that order. In the example below 1s = duration, 2s = delay, 3 = iterations.”
This doesn’t work, if you set the number of iterations to infinite.
Instead infinite has to be at the end, hasn’t it?
Thanks for this useful snippets! :)
It should be noted that the keyframe sequence is effectively “reset” if the element is altered via jQuery or some other thing. Keyframes for cycling through border colors for a play button on a player gets reset everytime the button switches from “play” to “pause”. For instance:
@keyframes change_border
{
0% {border-color: #202424;}
25% {border-color: #a09b8c;}
75% {border-color: #69707d;}
100% {border-color: #737e88;}
}
div#player_control {
animation: change_border 66s infinite;
animation-direction:alternate;
-moz-animation: change_border 66s infinite;
-moz-animation-direction:alternate;
-webkit-animation: change_border 66s infinite;
-webkit-animation-direction:alternate;
}
This “infinite” sequence of color changing would be interrupted every time the #player_control layer was altered. This is undesirable when other things are also tied to this animation sequence, but aren’t subject to the interruption. Could also simply be undesirable.
I’ve had this same problem. I am animating some list elements on page load so they kind of fly in from the side one at a time and then they are the navigation. On hover, the text in the list element twitches to the side a bit, but when it returns to the default state after the hover effect, the animation is queued again and the list element comes back in from the side again. Very obnoxious.
Have you, or has anyone found a solution to this?
Thank you for this script.
Works great :)
Thanks.
It seems that Android 2.2 doesn’t perform well if you specify more than two states in percentages:
a.) this doesn’t work
b.) this works
You can’t spot the problem if you change user agent in webkit browser (etc. safari) or using Android SDK Tools. Bug seems to appear just on particular Android 2.2 devices.
tested on:
HTC Wildfire
Mozilla/5.0 (Linux; U; Android 2.2.1; sv-se; HTC Wildfire Build/FRG83D) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
HTC Evo
Mozilla/5.0 (Linux; U; Android 2.2; en-us; Sprint APA9292KT Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
thanks “pirohy”
You have some of the best CSS tips. Your directions are often better (more detailed and advanced) than the W3 Schools I appreciate your quality posts Chris. Thank you.
Is there a way to point the animation to another div? Say you make one div like a button to make the other div do the action?
In this example im trying to make it when I hover on the black box the white box will move out of the way. I haven’t seen anything on triggering an animation of one div by hovering on another before, at least not with pure CSS.
Nevermind, I figured it out.
by putting .blackbox:hover and .whitebox in the same selector it acts just the way I want it too.
Awesome snippet by the way. Very helpful.
You could do it with nesting and sibling selectors. You could put both elements in a container div and when you want the white box to move, set the selection to something like:
HTML:
CSS:
You could do it with transitions, or you could queue off an animation the same way if it’s not as simple as a transition.
How do you set the animation parameters to be the parameters of the element from the moment the page loads.
e.g.
So what happens here is that the element will appear on screen, then after 2 seconds it will dissapear and run through the animation. The desired effect is that it appears at opacity 0 until the animation starts, 2 seconds after the page is loaded.
Is there a property I’m missing?
Typical!! Of course I search for ages before I post, then 2 minutes after posting I carry on looking and find the answer!
animation-fill-mode: backwards;
was the solution.
I created this site http://www.css3builder.com it automates the css3 gallery creation by doing the math for the keyframes etc. etc. automatically. You can create one in less than 1 minute for all browsers.
Just a note that the upcoming IE10 will support keyframe syntax without prefixes. So, since IE9 doesn’t support keyframe animations, and since nobody will be using ‘IE10pp’ or whatever, then all examples should now omit the ‘-ms-‘ part.
Also, all the examples on this page should be updated to include the standard syntax, for IE10, upcoming FF16 and other browsers that will eventually support keyframe animations unprefixed.
Page updated! Thanks Louis.
Android browser 2.2 supports it?
I have a animation in an infinite loop. Have any way to set an interval between the loops?
The property “animation-delay” just add a delay before the animation start, then loop without the delay.
I know that I can resolve with a simple “setInterval” script, but I’m trying to figure if have any way to reach to the expected result without that.
When an iOS device is in the process of completing animations #1 and a user scrolls down before animation #2 started, it will simply not load animations set to load later… Any workaround ?
Hey, it would be great if you include the
steps()
timing function. You can see more details here, for example:https://hacks.mozilla.org/2011/09/taking-steps-with-css-animations/
Hello Chris for the basic animation you can use the simple code:
.box{
background: white;
-webkit-transition: background 5s;
}
.box:hover{
background: olive;
-webkit-transition: background 1s;
}
I don’t think anyone has asked this before:
how do you use the
@-webkit-keyframes
syntax in SASS (or LESS, for that matter), where the@
is a special character?bro, where can i test this code with implementing in my site..
i.e sandbox / testdrive ??
Thanks for the content.
This is a very helpful article. Just wondering how you could include audio in the js so it syncs with the play/reset button?
Here is an example of FELIX the cat episode of “The magic bag” done completely using css3 key frame animations. Implemented for webkit browsers only. No JS just pure CSS3
http://pikcle.com/felix/
I couldn’t find any obvious way to delay at either ‘end’ of my looped animation (left to right, in this case).
Ended up using:
<
pre>
@-webkit-keyframes pan {
0%, 10% { -webkit-transform: translate3d( 0%, 0px, 0px); }
90%, 100% { -webkit-transform: translate3d(-50%, 0px, 0px); }
}
Just a bit annoying having to have a fake animation duration to account for delays.
Hey Guys
Is it possible to combine 2 animations for one target.. For example rotating a menu and in the menu time changing its font-size.. Please let me know.. :)
yes its possible
I have used a lot of animations here http://pikcle.com/felix/ works only on webkit browsers, have combined many types of animations for single targets :)
Thanks Melwyn.. Will Try it Out… :)
I think it’s worth pointing out that there are additional properties of
animation-direction
other thannormal
andalternate
; These arereverse
andalternate-reverse
.The MDN docs has the full set of possible values, but their browser compatibility list looks a little stale. If anyone can confirm browser support for these properties I’m sure Mozilla would appreciate it :)
Mahalo
Is it actually possible to make an animation with the property content? Something like…
Thanks
I ran into that just recently. No browser supports it but according to spec writers, they should, and will catch up eventually.
Ya, I think “the solution” for the moment would be to apply a mask over the “…” and animating it to cover the last char, the last two chars, and so on..
Does anyone know of a way to prevent keyframe animations from firing when the browser is resized and it crosses breakpoints? How about on page load?
We’ve a animation in a infinite loop. Have in any manner to set an interval between the loops?
The property “animation-delay” just convey a delay before this animation start, then loop devoid of the delay.
I understand that I can resolve which has a simple “setInterval” piece of software, but I’m looking to figure if have in any manner to reach on the expected result without having that.
Hi, I want to have multiple elements (divs) with different animations. So I have .item1 as you can see below. But I want to make an animation for another item (For example: .item2 with a different slide animation/position), but how can I assign different animations to different elements? Hope someone can help! Thanks!
.item1 {
position: absolute;
background:url(../img/item.png) 0 0 no-repeat;
top: -900px;
width: 400px;
height: 887px;
-webkit-animation: slide 0.5s forwards;
-webkit-animation-delay: 0.5s;
animation: slide 0.5s forwards;
animation-delay: 2s;
animation-name: slide;
}
@-webkit-keyframes slide {
100% { top: -300px; }
}
@keyframes slide {
100% { top: -300px; }
}
Hello! I have something like this now: but I don’t know if this is the right way to do it ( name it slide 1 and slide 2)…
Anybody know that either Compass/Sass support keyframe animation inbuild?
I’m sure they have support, but I use a couple of simple mixins I wrote:
Thanks for sharing Josh!
Can I get the webkitAnimationDuration (javascript) equivalent for mozilla and safari browser support same in javascript.
The order doesn’t matter except when using both duration and delay, they need to be in that order. In the example below 1s = duration, 2s = delay, 3 = iterations.”
This doesn’t work, if you set the number of iterations to infinite.
Instead infinite has to be at the end, hasn’t it?
Thanks for this useful snippets! :)
I have created one demo. Check it out
http://jsbin.com/alOPUko/11/edit
THANKS Admin . This is a very helpful article. Just wondering how you could include audio in the js so it syncs with the play/reset button?
good luck ….Keep it up
Nice resource dear but is there a way to prevent keyframe animations from firing when the browser is re-sized and it crosses breakpoints? How about on page load?
I am trying to mix this code with another code of css but the problem I am facing is that at run time only one code is showing effect where as another one is not showing it.
Creating a reduced test case is the way to go with issues like this.
Can I get the webkitAnimationDuration (javascript) equivalent for mozilla and safari browser support same in javascript.
BTW thanks for such a nice tutorial.
This is exactly what i was looking for..so simple to implement dude..nice work and looks cure too :)
Just experimenting, I found the webkit delay syntax is:
“-webkit-animation-delay: 5s;”
Pretty simple!
http://www.results-2014.com/
Anyone who wanted to put Time Interval between infinite/loop of the animation, please follow this Stackoverflow solution:
http://stackoverflow.com/questions/18812055/css-animation-with-time-interval
Happy CSS3 animation!
Nice Job, This is exactly what i was looking for, CSS3 animations is difficult, because for me the syntax was very difficult, but you have done a awesome work, you just understand others in a simple way. Thanks For Sharing.
Does anyone know of a way to prevent keyframe animations from firing when the browser is resized and it crosses breakpoints? How about on page load?
facing issues here on:
http://www.resultsnews.com/
Is there any way to stop keyframe animations from firing at time of browser re sizing ? I am facing issue on my website http://bit.ly/1j84UFh
made an animation here http://jsfiddle.net/ipsjolly/DDT9b/
But it is not that smooth. it bumps a little when it enters from one frame to other. how can i make it more jelly type like buttons in candy crush.
I am creating an animation of a character who must move his head to the right and left while moving his hands opening and closing them.
It happens that in the CSS I think an animation with two input and both have the fill-mode parameter value with forwards. This will run the first animated properly, but the second is never executed. If I remove the first animation forwards to the second runs properly, but the first animation to end abruptly returns to its starting point.
Can anyone tell me how to fix this.
This is my css code:
[Admin note]: Deleting big code dump – feel free to post a link to a Pen on CodePen.
the site very nice and very helpfull fro beginers
Once again, I am landed to this page,
Hey Chris, do you have any idea how to create some magic mixin which create CSS3 Keyframe animation including CSS3 Browser Vender Prefix?
Once I tried to use some Mixin available over the internet, it product something like following where I want to ignore all other browser related code while it was under @-webkit.
@-webkit-keyframes hover-icon {
0% {
-webkit-transform: scale(1, 1);
-moz-transform: scale(1, 1);
-ms-transform: scale(1, 1);
-o-transform: scale(1, 1);
transform: scale(1, 1);
}
100% {
-webkit-transform: scale(1.2, 1.2);
-moz-transform: scale(1.2, 1.2);
-ms-transform: scale(1.2, 1.2);
-o-transform: scale(1.2, 1.2);
transform: scale(1.2, 1.2);
}
}
Here’s what you’re looking for: http://leaverou.github.io/prefixfree/
Does anyone know of a way to prevent keyframe animations from firing when the browser is resized and it crosses breakpoints? How about on page load?
Thanks Chris! Any time I have a question – you always there. Thanks again!!
Thank you very much for the demo. This solved my animation problems I had in IE.
This is a massively important detail:
Internet explorer does not get to claim the w3 standards' spec.
That needs to be updated.
No seriously- Internet Explorer has been the bane of every web developers' existence for entirely too long for them to get to claim that comment. It should not be confused, even for a second, that Internet Explorer is the reason that any modern css standard exists.
That comment should be
[1]: Firefox 16+, IE 10+.
Hi Chris, you can use -webkit-animation-delay to delay the effects. It will much better if you can add demo as well.
Hey I need to do ripple effect with 4 circles. Could you guys please help me on it using css3. Thanks in advance.
I don’t think it works that way
Thanks so much for this. Works great with HTML5 video, just got to remember that -webkit prefix
Is there a reason why you don’t condense the repetitive declarations into a comma-separated selector? i.e:
It’d be good if we could bundle the various @keyframes like CSS selectors (to save on repetition):
@keyframes A, @-webkit-keyframes A, @-o-keyframes A {
… opacity: 1; … /*no [-*-]transform…*/
}
But apparently it does not work, it isn’t recognized, I tried…
(Just in case someone else has the same idea)
It works fine on all browsers with zoom in and out.
But on safari (all versions) when you zoom in and out and it breaks.
Anybody suggest any fix PLEEEAAASSSSSEEEEE.
Thanx many and many thanx.
forgot to put the demo link here which you have posted up there:
http://jsfiddle.net/simurai/CGmCe/light/
Any FIX for the SAFARI ZOOM IN or OUT
This keyframe slide is an intresting tool but I can only find examples of it in use with images. Is it possible to use this framework for sliding color change across text only? I mean text like in a p or span class sentence where it only affects the text with no background effects.
Seems like Safari 9 has issue with “0% {}” when declaring keyframes. So if we have simple animations that have only 2 keyframes we can use ‘from’ and ‘to’. or we can simply use ‘0’ instead of ‘0%’
Hi Chris. Is it fine to include a number in the keyframe naming declaration? e.g. banner_circle_10, banner_circle_11 or should it be banner_circle_ten, banner_circle_eleven, etc. ?
This doesn’t really explain anything… it just gives some examples without explaining how or why they work, or what the rules are. What is keyframes and when/why would you use it? How?? What??
Anything specific you need to know?
There is place to ask questions…
Thanks for that! Still a very valid and useful article!
Allow me to point out a little error in the properties table:
“duration-count” should be “iteration-count”
I m using text resizing and it doesn’t animate correctly in Safari,
text blinks to a large size before animating. Are there some glitches with Safari regarding animating font-size? No issue with Firefox or Chrome.
Does it matter at all if the @keyframes are declared before or after where they called from?
I’m 99% sure it does not.
Hey!
This is just what I was looking for. It works great in Chrome, but I’m getting nothing in IE11.
I put some text in the div–the text shows, but there is NO background color or frame around it.
Is there something I’m missing in the HTML file to make it work?
Are there ways to declare frames without from/to or percentages? Really annoying to have to calculate the percentages and change them all when you add a frame.
Hi guys I’m using the animation that is from 0deg to 360deg and so the object rotates 360 degrees but I want it rotate as an animation while it stays still not moving around in a circle, any tips?
I’m using transform keyframes animation. However, the section above and this section are parallax, which when the zoom happens is creating a weird space at the bottom. Even with heights set, overflow:hidden, etc. Does this just not work well with multiple parallax sections?
Is there or was at some point any reason to use the prefixes on the “keyframes” key? I can’t find any prefixer that will add the “keyframes” prefixes, including sass.
Can you use this to animate the percentage steps on a graduated background?
I’m trying to make a “gleem” effect that has a thin graduated white highlight run from one side of a LI item to the other like someone’s headlights lights up your room when they pull into the driveway at night.
Hello, may I ask how to stop animation at certain keyframe and keep on next one? if I want to connect several animations one after another – i need to stop the one and keep on the next
Thank very much, amazing article, at last i’ve found best CSS animation tutorial.
If a keyframe includes transform, how should it be prefixed? According to ShouldIPrefix.com, we only need -webkit with animation and we need -webkit and -ms with transform.
I have never witnessed such kind of a tutorial ever before. Have to say the kind of visuals it presents over here is enough to make a guy understand animation coding.
I have some css and js that someone else wrote like ten years ago. I am actually a backend person by this is where I find myself now. I noticed that although there are lots of animated transitions in the html, (mostly fade in and fade out) none of them work. After a little more digging I found there are just as many “no trans” commands in the external style sheet and in the js files. I am trying to understand why he left me such schizophrenic code? If he didn’t want the transitions, why put them in there in the first place? Is this logical? Common? Reasonable? Thanks.