Help in P5.js (for fun program)

You can’t reset millis() but you can offset it.

Example:

var off = 0;

function setup() {
  createCanvas(400, 400)
}

function draw() {
  background(220)
  textSize(48)
  textAlign(CENTER, CENTER)
  text(int((millis()-off)/100), width/2, height/2)
}

function mouseClicked()
  {
  off = millis();  
  }

:)

1 Like