Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS3 transition ease vs. ease-in-out [duplicate]

What’s the difference between CSS3 transitions’ ease-in, ease-out, etc.?

like image 648
Imran Qadir Baksh - Baloch Avatar asked Mar 09 '12 05:03

Imran Qadir Baksh - Baloch


People also ask

Is ease and ease in out same?

Ease-In: Causes the animation to start more quickly than linear ones, and it also has deceleration at the end. Ease Out: This is the opposite of Ease-In. Animation starts slow and ends fast. Ease In Out: Slow start, fast middle, and slow end.

What is the difference between ease and ease out CSS?

ease-in will start the animation slowly, and finish at full speed. ease-out will start the animation at full speed, then finish slowly. ease-in-out will start slowly, be fastest at the middle of the animation, then finish slowly. ease is like ease-in-out , except it starts slightly faster than it ends.

What is transition ease in out?

ease-in - specifies a transition effect with a slow start. ease-out - specifies a transition effect with a slow end. ease-in-out - specifies a transition effect with a slow start and end. cubic-bezier(n,n,n,n) - lets you define your own values in a cubic-bezier function.

Is transition all slower?

Yes, using transition: all could cause major drawbacks in performance. There can be a lot of cases where the browser would look if it needs to make a transition, even if user won't see it, like the color changes, dimension changes etc.


1 Answers

CSS3's transitions and animations support easing, formally called a "timing function". The common ones are ease-in, ease-out, ease-in-out, ease, and linear, or you can specify your own using cubic-bezier().

  • ease-in will start the animation slowly, and finish at full speed.
  • ease-out will start the animation at full speed, then finish slowly.
  • ease-in-out will start slowly, be fastest at the middle of the animation, then finish slowly.
  • ease is like ease-in-out, except it starts slightly faster than it ends.
  • linear uses no easing.
  • Finally, here's a great description of the cubic-bezier syntax, but it's usually not necessary unless you want some very precise effects.

Basically, easing out is to slow to a halt, easing in is to slowly accelerate, and linear is to do neither. You can find more detailed resources at the documentation for timing-function on MDN.

And if you do want the aforementioned precise effects, the amazing Lea Verou’s cubic-bezier.com is there for you! It’s also useful for comparing the different timing functions graphically.

Another, the steps() timing function, acts like linear, but only performs a finite number of steps between the transition’s beginning and its end. steps() has been most useful to me in CSS3 animations, rather than in transitions; a good example is in loading indicators with dots. Traditionally, one uses a series of static images (say eight dots, two changing colour each frame) to produce the illusion of motion. With a steps(8) animation and a rotate transform, you’re using motion to produce the illusion of separate frames! How fun.

like image 103
Ry- Avatar answered Sep 21 '22 15:09

Ry-