# Int that goes from 1 to 100

**URL:** <https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873>\
**Category:** Beginners\
**Created:** [December 1, 2020, 8:51pm UTC](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873 "2020-12-01T20:51:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![denis](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@denis](https://discourse.processing.org/u/denis)\
**Post date:** [December 1, 2020, 8:51pm UTC](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873/1 "2020-12-01T20:51:11Z")

</div>

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,

Thanks!!

D.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 1, 2020, 8:54pm UTC](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873/2 "2020-12-01T20:54:23Z")

</div>

Hello,

There are many resources (examples, tutorials, references and more…) at the [processing.org](http://processing.org/) website.

What have you done so far?

`:)`

---

<div class="post-metadata">

**Author:** ![denis](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@denis](https://discourse.processing.org/u/denis)\
**Post date:** [December 1, 2020, 8:59pm UTC](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873/3 "2020-12-01T20:59:20Z")

</div>

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 😕 ) 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() {  
> background(bColor);  
> 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!

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 1, 2020, 9:10pm UTC](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873/4 "2020-12-01T21:10:29Z")

</div>

Answering first post:

Consider this:

- [https://processing.org/reference/modulo.html](https://processing.org/reference/modulo.html)
- draw() \< Find in references
- frameCount \< Find in references
- println() \< Find in references

Example:

```auto
void setup()
  {
  }
  
void draw()
  {
  if (frameCount % 60 == 0)
    {
    println(frameCount);
    }
  }

```

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:

- [https://processing.org/reference/mouseDragged\_.html](https://processing.org/reference/mouseDragged_.html)  
And use println() to understand this!

`:)`

---

<div class="post-metadata">

**Author:** ![denis](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@denis](https://discourse.processing.org/u/denis)\
**Post date:** [December 1, 2020, 10:16pm UTC](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873/5 "2020-12-01T22:16:09Z")

</div>

Thanks a lot! I will try it

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 1, 2020, 10:21pm UTC](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873/6 "2020-12-01T22:21:24Z")

</div>

Consider HSB mode and only change the hsb value:

- [https://processing.org/reference/colorMode\_.html](https://processing.org/reference/colorMode_.html) \< Third example
- [https://processing.org/tutorials/color/](https://processing.org/tutorials/color/)

Example in reference:

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

void draw() {
  background(bg);	
}

```

And add your:

```auto
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!

`:)`
