bendc/anchor-scroll — pull request #6 by jeromecordiez (2014-09-18 12:06:28+00:00)
Title: Configure animation options using the class name

This would let users specify the animation's duration and easing method using variants of the class name.
A link classed "scroll" would scroll to the relevant anchor in 900ms using the default easeInOutCubic.
A link classed "scroll-1500" would scroll in 1500ms, etc.
A link classed "scroll-1200-bounce" would scroll in 1200ms, using a function named "bounce" as the easing function, just define it somewhere, eg:

var bounce = function (t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
}

Not sure about this last option. Should the easing functions be pre-defined, should we use the standard names or shortcuts for convenience, does it make sense to let anyone create custom easing functions, etc... Anyway,this was just a quick idea.