(P5) Easing functions

Based on Robert Penners Easing

See the docs


const duration = 100;
const diam = 10;

function setup() {
  const canvas = createCanvas(100, 100);
  canvas.parent("sketch");
  background(255);
}
function draw() {
  background(255);
  const easing = easeInOutCubic(
    frameCount % duration,
    -10,
    120,
    duration);
  ellipse(easing, height / 2, diam, diam);
}