# Cuadro 1 ines 123456789

**URL:** https://discourse.processing.org/t/cuadro-1-ines-123456789/45195
**Category:** Coding Questions
**Created:** [October 17, 2024, 11:06am UTC](https://discourse.processing.org/t/cuadro-1-ines-123456789/45195 "2024-10-17T11:06:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![averges](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@averges](https://discourse.processing.org/u/averges)
#### Post date: [October 17, 2024, 11:06am UTC](https://discourse.processing.org/t/cuadro-1-ines-123456789/45195/1 "2024-10-17T11:06:50Z")

</div>

```processing
void setup() {
  
  size(600,600) ;
  background (#69C2FC) ;
  
}

void draw() {
  
       fill(#FF7164);
   circle(300,500,700);
   stroke(0);
   
          fill(#FFA064);
   circle(300,500,650);
   stroke(0);
   
             fill(#FCFF64);
   circle(300,500,600);
   stroke(0);
   
    fill(#80FF64);
   circle(300,500,550);
   stroke(0);
   
  fill(#64FBFF);
   circle(300,500,500);
   stroke(0);
   
   fill(#6468FF);
   circle(300,500,450);
   stroke(0);
   
     fill(#B664FF);
   circle(300,500,400);
   stroke(0);
   
    fill(#FC64FF);
   circle(300,500,350);
   stroke(0);
   
       fill(#FF64C9);
   circle(300,500,300);
   stroke(0);
   
   fill(#69C2FC);
   circle(300,500,250);
   stroke(0);
   

   fill (#69FC8C) ;
       stroke(#0F0501);
  rect(0,500,700,500) ;
  
     fill(#AA7C65);
  rect(150, 350, 100, 150);
  fill(#C67272); 
  triangle(150, 350, 250, 350, 200, 300);

 fill (#E3C3A5);
   stroke(#0F0501);
   rect(170,450,20,50);
   
    fill (#F1FF5D);
   stroke(#0F0501);
   rect(210,400,20,20);
   
       fill (#F1FF5D);
   stroke(#0F0501);
   rect(160,400,20,20);
   
   fill(#FFB87E);
   ellipse(350,490,20,40);
   stroke (#FFB87E);
   
      fill(#FFB87E);
   ellipse(350,490,20,40);
   stroke (#FFB87E);
   
     fill(#FFB87E);
   ellipse(350,460,20,20);
   stroke (#FFB87E);
      fill(#FFB87E);
   ellipse(340,450,10,10);
   stroke (#FFB87E);
     fill(#FFB87E);
   ellipse(360,450,10,10);
   stroke (#FFB87E);
   fill(#FFF8A7);
     ellipse(500,50,50,50);
          fill(#FFB87E);
   ellipse(335,500,10,10);
   stroke (#FFB87E);
  
      fill (#6A4C3E);
   stroke(#0F0501);
   rect(400,400,20,100);
   
    fill(#3DDB00);
   circle(360,400,50);
   stroke(#3DDB00);
   
      
    fill(#3DDB00);
   circle(390,430,50);
   stroke(#3DDB00);
   
       fill(#3DDB00);
   circle(405,410,50);
   stroke(#3DDB00);
   
     fill(#3DDB00);
   circle(390,370,50);
   stroke(#3DDB00);
   
    fill(#3DDB00);
   circle(430,370,50);
   stroke(#3DDB00);
  
    fill(#3DDB00);
   circle(430,400,50);
   stroke(#3DDB00);
   
       fill(#3DDB00);
   circle(440,425,50);
   stroke(#3DDB00);
   
        fill(#3DDB00);
   circle(360,400,50);
   stroke(#3DDB00);
   
          fill(#3DDB00);
   circle(460,395,50);
   stroke(0);
   
      stroke(#3DDB00);
     fill(#FF2C15);
   circle(360,400,15);

   
        fill(#FF2C15);
   circle(440,500,15);
   stroke(#3DDB00);
      
           fill(#FF2C15);
   circle(440,370,15);
   stroke(#3DDB00);
   
              fill(#FF2C15);
   circle(440,410,15);
   stroke(#3DDB00);
   
     fill(#FF2C15);
   circle(400,400,15);
   stroke(#030000);
   
   
     fill(#FFFFFF);
   circle(120,55,50);
   stroke(#FFFFFF);
   
    fill(#FFFFFF);
   circle(140,90,50);
   stroke(#FFFFFF);
  
    fill(#FFFFFF);
   circle(100,100,50);
   stroke(#FFFFFF);
   
        fill(#FFFFFF);
   circle(120,55,50);
   stroke(#FFFFFF);
   
       fill(#FFFFFF);
   circle(80,85,50);
   stroke(#FFFFFF);
  
  
  stroke(0);
    float x = random(width);
    float y = random(height / 2);
    line(x, y, x + 10, y - 5);
    line(x + 10, y - 5, x + 20, y);
    
    
}

```

---

<div class="post-metadata">

### Author: ![ProcessingOrg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/processingorg/32/18341_2.png) [@ProcessingOrg](https://discourse.processing.org/u/ProcessingOrg)
#### Post date: [October 17, 2024, 11:09am UTC](https://discourse.processing.org/t/cuadro-1-ines-123456789/45195/2 "2024-10-17T11:09:36Z")

</div>

Hello @averges, welcome! Your post has been edited to format the code for better readability. Please review our [FAQ](https://discourse.processing.org/t/guidelines-asking-questions/2147#is-your-post-formatted-9) for guidance on posting code. Thank you!

![ezgif.com-gif-maker (1)](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/3/4/34521338de6902479873291389bf53a11d12237d.gif)

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [October 17, 2024, 8:25pm UTC](https://discourse.processing.org/t/cuadro-1-ines-123456789/45195/3 "2024-10-17T20:25:36Z")

</div>

Your code that creates a nice graphic image but it is not clear what your question is 🤔

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [October 25, 2024, 2:40pm UTC](https://discourse.processing.org/t/cuadro-1-ines-123456789/45195/4 "2024-10-25T14:40:53Z")

</div>

Nice image !!!

I am not sure what your question is.

**Using functions**  
First, it’s useful to split the long draw() function into _different functions_ that we call from draw().  
So you can see where is tree() and dog() in your code and so on.  
Some even say, that one function should not be longer than one screen page. So you can see it at once without scrolling.

_Tipp_: In draw() you can right-click on dog() and jump to its definition (to the dog() function below). Nice.

**Stroke command**

please understand that here

```auto
    fill(#FF7164);
    circle(300, 500, 700);
    stroke(0);

```

The order is a bit off.  
The stroke command would not effect the circle command, because the stroke command is _after_ the circle command.

_Before_ drawing the circle we need to set how we draw it, so we use fill and stroke before circle command:

```auto
    fill(#FF7164);
    stroke(0);
    circle(300, 500, 700);

```

That looks better.

That occurs a lot in your code; please be aware that the stroke command affects the _next_ circle/rect not the _previous_ one.

**Stroke and fill**  
Once stroke and fill are set for a circle and the next circle has the same stroke and fill again, you don’t have to repeat this.

So here

```auto
   fill(#FC64FF);
   circle(300,500,350);
   stroke(0);
   
   fill(#FC64FF); // same color again 
   circle(300,500,300);
   stroke(0);

```

just say

```auto
   fill(#FC64FF); // define color once 
   stroke(0);

   circle(300,500,350); // use the same color twice or more times 
   circle(300,500,300);

```

**The birds**  
draw() runs on and on in a loop automatically.  
That’s why you get so many birds.  
I stopped draw() from doing loops by saing noLoop().  
Instead, I made a for-loop for the birds only.  
(draw() stops now, so it’s not interactive, you can’t do animations now. There are other solutions for that).

**Use comments**  
Comments // can be useful.

Warm regards,

Chrisir

* * *

**Code**

```auto
void setup() {
  size(600, 600);
  background(#69C2FC);

  noLoop(); // !!!!!!!!!!!!!!!!!!!!!!!
}

void draw() {
  background (#69C2FC); // !!!!!!!!!!!!!!!!!!!!!!!

  rainbow();
  house();
  sun();
  grassArea();
  dog();
  tree();
  apples();
  cloud();

  birds();
}

//----------------------------------------------------------------------

void rainbow() {
  fill(#FF7164);
  stroke(0);

  circle(300, 500, 700);

  fill(#FFA064);
  circle(300, 500, 650);

  fill(#FCFF64);
  circle(300, 500, 600);

  fill(#80FF64);
  circle(300, 500, 550);

  fill(#64FBFF);
  circle(300, 500, 500);

  fill(#6468FF);
  circle(300, 500, 450);

  fill(#B664FF);
  circle(300, 500, 400);

  fill(#FC64FF);
  circle(300, 500, 350);

  fill(#FF64C9);
  circle(300, 500, 300);

  fill(#69C2FC);
  circle(300, 500, 250);
}

void house() {
  //
  fill(#AA7C65);
  rect(150, 350, 100, 150);

  fill(#C67272);
  triangle(150, 350, 250, 350, 200, 300);

  fill (#E3C3A5);
  stroke(#0F0501);
  rect(170, 450, 20, 50);

  fill (#F1FF5D);
  stroke(#0F0501);
  rect(210, 400, 20, 20);

  fill (#F1FF5D);
  stroke(#0F0501);
  rect(160, 400, 20, 20);
}

void dog() {
  // Dog
  fill(#FFB87E);
  stroke (#FFB87E);

  ellipse(350, 490, 20, 40);
  ellipse(350, 490, 20, 40);
  ellipse(350, 460, 20, 20);
  ellipse(340, 450, 10, 10);
  ellipse(360, 450, 10, 10);
  ellipse(335, 500, 10, 10);
}

void tree() {
  // stem tree
  fill (#6A4C3E);
  stroke(#0F0501);
  rect(400, 400, 20, 100); // stem tree

  // green tree parts
  fill(#3DDB00);
  stroke(#3DDB00);

  circle(360, 400, 50);
  circle(390, 430, 50);
  circle(405, 410, 50);
  circle(390, 370, 50);
  circle(430, 370, 50);
  circle(430, 400, 50);
  circle(440, 425, 50);
  circle(360, 400, 50);
  circle(460, 395, 50);
}

void apples() {
  stroke(#3DDB00);
  fill(#FF2C15);

  circle(360, 400, 15);
  circle(440, 500, 15);
  circle(440, 370, 15);
  circle(440, 410, 15);
  circle(400, 400, 15);
}

void cloud() {
  fill(#FFFFFF);
  stroke(#FFFFFF);

  circle(120, 55, 50);
  circle(140, 90, 50);
  circle(100, 100, 50);
  circle(120, 55, 50);
  circle(80, 85, 50);
}

void sun() {
  stroke (#FFB87E);
  fill(#FFF8A7);
  ellipse(500, 50, 50, 50);
}

void grassArea() {
  fill (#69FC8C);
  stroke(#0F0501);
  rect(0, 500, 700, 500);
}

void birds() {
  // birds

  int max=int(random(22, 100));

  for (int i=0; i<max; i++) {
    stroke(0);
    float x = random(width);
    float y = random(height / 2);
    line(x, y, x + 10, y - 5);
    line(x + 10, y - 5, x + 20, y);
  }
}
//

```
