What is the difference between cubic-bezier function and linear in css?

Tell us what’s happening:
I think both are Same

animation-timing-function: linear;

animation-timing-function: cubic-bezier(0,0,.58,.58)

animation-timing-function: cubic-bezier(0,0,.78,.78)

The three following examples are same.

…so why I will use cubic bezier function or curve…
I noticed when I changed the value of p2 then it doesn’t change at all
And in the lessons I can’t understand what is the x and y values? I can’t get it…
Though I somehow passed the challenge but I wanted to learn this properly…

Your code so far


<style>
.balls{
  border-radius: 50%;
  position: fixed;
  width: 50px;
  height: 50px;
  margin-top: 50px;
  animation-name: bounce;
  animation-duration: 2s;
  animation-iteration-count: infinite;
}
#red {
  background: red;
  left: 27%;
  animation-timing-function: linear;
}
#blue {
  background: blue;
  left: 56%;
  animation-timing-function: ease-out;
  animation-timing-function: cubic-bezier(0,0,.58,.58)
}
@keyframes bounce {
  0% {
    top: 0px;
  }
  100% {
    top: 249px;
  }
}
</style>
<div class="balls" id= "red"></div>
<div class="balls" id= "blue"></div>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Use a Bezier Curve to Move a Graphic

Link to the challenge:

This is one of the search for more information type questions. Perhaps this will help;
https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function

You can Google for more information.

1 Like

@Roma Thanks :slight_smile:
I have been stuck with this thing a lot of time… your link gives me the proper details of it… now I know them; :upside_down_face:

1 Like