This simple easing function takes an arbitrary power as a second argument, allowing for exponential easing to any power
const easeInOut = (t, p = 5) =>
t <= 0.5
? Math.pow(t * 2, p) / 2
: 1 - Math.pow(2 - t * 2, p) / 2
Rather than separate declarations for cubicInOut
, quartInOut
and quintInOut
easing functions, this method allows for easing to any power by passing a second argument p
. t
is assumed to be normalised between 0 and 1. Values of p
below 1 result in inverse easing, where the object enters at full speed, slows down and then accelerates out.
Get occasional updates about new fonts, designs and other interesting things.