Int that goes from 1 to 100

Hello everyone,

Im trying to make an int that goes from the number 1 to 100, increasing one by one and then to reset and start again.

I hope someone can help,




There are many resources (examples, tutorials, references and more…) at the website.

What have you done so far?


Hey glv, thanks for answering!

and yes, i checked some things but didnt find this specific thing.

So far (i know is not correct but i just dont know how to do it :confused: ) i have:

int azul [1,100];
int verde [1,100];
int rojo [1,100];
color bColor = color(azul , verde, rojo);

void setup() {
size(400, 400);

void draw() {
if(pmouseX != mouseX) {
bColor = color();

Im looking for when i move the mouse, the background change the color but not random, more like the color map or something like that.

Thanks again!

Answering first post:

Consider this:


void setup()
void draw()
  if (frameCount % 60 == 0)

You could also increment an int variable in the draw() loop
Use println() to watch the progress of the counter.

Above is just one way of doing it!

Answering second post try this:


1 Like

Thanks a lot! I will try it

Consider HSB mode and only change the hsb value:

Example in reference:

void setup() {
  size(100, 100);
  colorMode(HSB, 360, 100, 100);
  bg = color(180, 50, 50);

void draw() {

And add your:

if(pmouseX != mouseX) 
 h = ? ; // You can do this!
// an if statement here to reset h 
bg = color(h, s, b);  // h = 0 to 360 and set s= 100, b = 100;

mouseDragged() is very much like what you did! with pmouseX. :)

Have fun!