rcbyr / keen-slider

The HTML touch slider carousel with the most native feeling you will get.

Home Page:https://keen-slider.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example easing function for default animation 'defaultAnimation'

Raf-sns opened this issue · comments

Hello and thank you for this excellent js library!

This is not an issue, I just want to expose here how I adjusted the easing because I have searched a bit, maybe this example could be part of the documentation.
This is how to set the 'defaultAnimation' object:

  • First define an easing function as found here: easings.net (click on a function to preview the function)
    ex. :
var easeOutCubic = (x)=>{
    return 1 - Math. pow(1 - x, 3);
}
  • Then define the object like this:
defaultAnimation: { 
    duration: 1200, // animation duration
    easing: easeInOutBack, // function that you defined before
},

I hope this helps others like me.
regards !