Working with html/css and p5.js

@Indieminor frameCount is a special keyword that returns the number of frames drawn by the draw function, it can be used to create a timer, especially if you set a framerate.

for example if you say

var seconds;

function setup() {
// do setuppy things here
seconds = 0;
frameRate(30);

then you can do

function draw() {
// do all kinds of stuff
seconds = frameCount / 30. ;

to get how many seconds have passed since you started the sketch.
( or loaded he page i just made the distinction in case of a noLoop() loop() scenario. )

1 Like