# ベジエ曲線で水玉を描く

```/**
* Drops
*
* @author aa_debdeb
* @date 2015/11/10
*/

Drop[][] drops;

void setup(){
size(500, 500);
smooth();
drops = new Drop[10][10];
for(int x = 0; x < 10; x++){
for(int y = 0; y < 10; y++){
drops[x][y] = new Drop((x + 1) * 45.5, (y + 1) * 45.5);
}
}
background(255, 250, 250);
}

void draw(){
noStroke();
fill(255, 250, 250, 50);
rect(-1, -1, width, height);
for(int x = 0; x < 10; x++){
for(int y = 0; y < 10; y++){
drops[x][y].update();
drops[x][y].display();
}
}
}

class Drop{

PVector center;
PVector tip;
PVector tipNoise;
PVector control1;
PVector control1Noise;
PVector control2;
PVector control2Noise;

Drop(float x, float y){
center = new PVector(x, y);
tipNoise = new PVector(random(100), random(100));
control1Noise = new PVector(random(100), random(100));
control2Noise = new PVector(random(100), random(100));
update();
}

void update(){
tip = new PVector(map(noise(mouseX * 0.003 + tipNoise.x), 0, 1, -20, 20),
map(noise(mouseY * 0.003 + tipNoise.y), 0, 1, -20, 20));
control1 = new PVector(map(noise(mouseX * 0.003 + control1Noise.x), 0, 1, -75, 75),
map(noise(mouseY * 0.003 + control1Noise.y), 0, 1, -75, 75));
control2 = new PVector(map(noise(mouseX * 0.003 + control2Noise.x), 0, 1, -75, 75),
map(noise(mouseY * 0.003 + control2Noise.y), 0, 1, -75, 75));
}

void display(){
pushMatrix();
translate(center.x, center.y);
stroke(238, 130,238);
strokeWeight(1);
fill(53,111, 214);
bezier(tip.x, tip.y,
control1.x, control1.y,
control2.x, control2.y,
tip.x, tip.y);
popMatrix();
}

}

```