# Calculation for variables in D. Shiffman book "Learning Processing"

I’m trying to get a better understanding on how Dan Shiffman drew his raindrop shape via the variables below AND the starting y position.

Any help is most appreciated!

Text in bold placed next to the 3 areas in question.

``````class Drop{
float x, y;
float speed;
color c;
float r;

Drop(){
r = 8;
x = random(width);
y = -r*4;
``````

for y above, does this mean -8*4 is: y = -32?

``````    speed = random(1, 5);
c = color(50, 100, 150);
}

void move(){
y += speed;
}
``````

In the move() function, with the y set at -32 that becomes -32 += speed?
I think my interpretation of y must be wrong?
```

``````void display(){
fill(c);
noStroke();
for (int i = 2; i < r; i++){
ellipse(x, y+i*4, i*2, i*2);
}
}
``````

**And finally, in ellipse, for y position and w, h: **
**1/ how do you get the raindrop shape if both w and h are the same variable **
2/ i’m not fully understanding the y position calculation

1 Like

try to change 2 and 4 in the ellipse and 4 at the constructor with something bigger, you will start to understand how it works. plus, give it some alpha to the circle

you wouldnt want the drop instantly shown on the screen, so you should start to draw the drop at minus y axis

3 Likes

Thank you @humayung! That was helpful changing the alpha and numbers in ellipse to better visualize.
And I understand the y position now! 1 Like