FRI | Advanced Animation: noise(), trigonometric functions
- October 23, 2026
- 9:15–12:00
- Room 2420 (Marsio)
Inspiration
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.
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()
sin(), cos()
Homework
- Finish the homework about classes if you didn’t already. Week 06: Objects & Classes (Fish Class)
- Create a project proposal (present it on Friday, October 30)