Hi,
As I am beginning with Processing, I am trying different things.
One attempt I made is to create a splash shape, like some paint that would drip on the ground
In my program, the width of the drip varies with mouseX, while the splash/gravity with mouseY.
To make a pleasant graphics, I'd like to put some light at the top at the splash, which would require creating a white ellipse at the top of the curve, or better, another curve shape.
In fact, it would consist in drawing a curve shape inside another one while iterating
Concretely, is this possible:
Or
Here is my code, for the moment:
As I am beginning with Processing, I am trying different things.
One attempt I made is to create a splash shape, like some paint that would drip on the ground
In my program, the width of the drip varies with mouseX, while the splash/gravity with mouseY.
To make a pleasant graphics, I'd like to put some light at the top at the splash, which would require creating a white ellipse at the top of the curve, or better, another curve shape.
In fact, it would consist in drawing a curve shape inside another one while iterating
Concretely, is this possible:
- beginShape()
- curveVertex()
- (...)
- ellipse
- (...)
- endShape()
Or
- beginShape()
- curveVertex()
- (...)
- beginShape()
- curveVertex()
- endShape
- (...)
- endShape()
Here is my code, for the moment:
- float rds, r, splash, max = 2;
- float x; float y;
- void setup() {
- size(500, 500);
- noStroke();
- smooth();
- frameRate(4);
- }
- void draw() {
- fill(0);
- rect(0 , 0, width, height);
- drawSplash();
- }
- void drawSplash() {
- rds = map(mouseX, 0, width, 30, 70);
- splash = map(mouseY, 0, height, 1, 6);
- translate(width/2, height/2);
- beginShape();
- for (int i = 0 ; i < 360; i+=5) {
- if (i == 0) {curveVertex(rds*cos(radians(0)), rds*sin(radians(0)));}
- if (i %15 == 0) {
- r = rds * random(0.9, max);
- float w = map(r, rds, max*rds, 1, splash);
- curveVertex(r*cos(radians(i-w)), r*sin(radians(i-w)));
- curveVertex(r*cos(radians(i+w)), r*sin(radians(i+w)));
- fill(23);
- ellipse(r*cos(radians(i)), r*sin(radians(i)), 30, 30);
- } else {
- r = rds;
- curveVertex(r*cos(radians(i)), r*sin(radians(i)));
- }
- fill(255, 0, 0);
- }
- curveVertex(rds*cos(radians(360)), rds*sin(radians(360)));
- endShape();
- }
1