FRI | Advanced Animation: noise(), trigonometric functions

FRI | Advanced Animation: noise(), trigonometric functions


  • October 24, 2025
  • 9:15–12:00
  • Room 2420 (Marsio)

Advanced techniques for animating with code #

setInterval() #

setInterval() is a convenient JavaSript method for timing things, but it’s not often the best when you want to keep things accurate and connected to specific frames or timings in your p5.js project. It can very easily drift or get out of sync with your project that runs at a specific frame rate.

% remainder #

See the tutorial on the remainder operator

millis() #

This technique is very commonly needed with Arduino so you will find this very useful in Physical Computing.

millis()

let lastTime = 0;
let interval = 1000; // 1 second
function setup(){
  createCanvas(400,400);
}
function draw() {
  if (millis() - lastTime > interval) {
    console.log("tick");
    lastTime = millis();
  }
}

noise() #

See the tutorial on noise()

sin(), cos() #

See the tutorial on noise()