fullscreen
grape.pdegrape_loops_2_9_14.pderadialgradient.pde
void Grape( float px, float py){
stroke(51,118,7);
h = random (50, 70);
w = random (50, 70);
float x = px;
float y = py;
fill (79, 229, 35);
radial( x, y, w/2, color(200, 255, 200), color(50, 150, 50));
//ellipse ( x, y, w, h);
}
void setup (){
background (85, 112, 206);
size ( 1000, 400);
fill (206, 175, 35);
rect (0, 300, 850, 50 );
fill(157, 125,19);
rect(0, 350, 850, 25);
rect(790, 375, 20, 50);
rect(815, 375, 15, 50);
rowAcross();
noFill();
stroke(90,98,2);
strokeWeight(4);
arc(150,175,150,300,PI*3/2,2*PI);
}
float w = 10;
float h = 50;
//row across should draw one less grape each time it runs
void rowAcross(){
for(int j=1; j<11.5; j++){
//j counts from 1 to 12
for(int i = 15; i> 1 ; i--){
//i counts from 12 to 1
Grape(h*j + 50, 400 - w*(i*1.5/(j)));
}
}
}
//grape x position
//(w*i)/(j*.7)
void radial(float x, float y, float radius, color c1, color c2){
float deltaR = (red(c2)-red(c1))/radius;
float deltaG = (green(c2)-green(c1))/radius;
float deltaB = (blue(c2)-blue(c1))/radius;
float r = red(c1);
float g = green(c1);
float b = blue(c1);
for (float i=0; i<360; i+=.125){
for (int j=0; j<radius; j++){
color c = color(r+deltaR*j, g+deltaG*j, b+deltaB*j);
set(int(x+cos(radians(i))*j), int(y+sin(radians(i))*j), c);
}
}
}