Serkan K.
Serkan K.

Reputation: 69

How do I do a lot of ellipses with the while-loop and change the color grey from the middle to the outside a little brighter?

How do I do a lot of ellipses with the while-loop and change the color grey from the middle to the outside a little brighter?

I've tried a bit:

size(200,200);
background(255);
float width-ellipse = 20;
float height-ellipse = 20;
while(w < 200)){
    stroke(0);
    fill(125);
    ellipse(100,100,w,h);
    w = w + 20;
    w++;
    h = h + 20;
    h++;
}

Upvotes: 1

Views: 430

Answers (1)

piningu
piningu

Reputation: 26

There probably is a better way to do this. However, this may work for you. Draw a darker smaller ellipse centered in the middle of the previous ellipse then repeat. Take a look here: https://forum.processing.org/one/topic/circle-gradient.html

Also, your while loop has 2 closing "))" parenthesis. Try the following:

void draw() {
    background(50);
    noStroke();
    for (int p = 0; p < 500; p+=100) {
        for (int i = 1; i < 100; i++) {
            fill(float(150 - i));
            ellipse(200, 100+p, 400-i*2, 120-(i*1.2));
        }
    }
}

Upvotes: 1

Related Questions