skip to content

easing functions for cyclical animations

A collection of functions and demos
Last updated: Oct 20, 2022

I often want something like an easing function but that moves back and forth between the same number instead of just from 0 to 1.

Sine and cosine functions obviously do that, but those have a specific feel to them and sometimes I want the motion to feel like something different!

Here's a collection of functions to use in cyclical animations. Click each row of the table to see a demo below.

progress 00.10.20.30.40.50.60.70.80.91
inOutSine(p * 2)click to see the animation with this easing00.0950.3450.6550.90510.9050.6550.3450.0950
abs(easeInCubic(p * 2 - 1))click to see the animation with this easing10.5120.2160.0640.00800.0080.0640.2160.5121
easeInQuadCycclick to see the animation with this easing00.040.160.360.6410.960.840.640.360
easeInCubicCycclick to see the animation with this easing00.0080.0640.2160.51210.9920.9360.7840.4880
inOutQuadCycclick to see the animation with this easing00.080.320.680.9210.920.680.320.080
sin(p * PI)click to see the animation with this easing00.3090.5880.8090.95110.9510.8090.5880.3090
abs(cos(p * PI))click to see the animation with this easing10.9510.8090.5880.30900.3090.5880.8090.9511
inOutSine(sin(p * PI))click to see the animation with this easing00.2180.6360.9130.99410.9940.9130.6360.2180
easeInCubic(sin(p * PI))click to see the animation with this easing00.030.2030.530.8610.860.530.2030.030
easeInCubic(cos(p * PI))click to see the animation with this easing10.860.530.2030.030-0.03-0.203-0.53-0.86-1
function easeInOutSine(x) {
return - ( Math.cos( Math.PI * x ) - 1 ) / 2
}

let p = animLoop.progress
let val = easeInOutSine(p * 2)