Thanks a lot, GoToLoop! The last days I've tried to create a heart which is surrounded by some ellipse and triangles. That's the result:
float x = 400;
float y = 0;
float r = 200;
float speed = 0;
float gravity = 0.1;
float b ;
float c;
float d;
float e;
float k = 0;
float angle;
void setup() {
size(800, 950);
smooth();
}
void draw() {
background(0);
k++;
angle += 1.2;
b = x + cos (angle) * random(r, r * 1.5);
c = y + sin (angle) * random(r, r * 1.5);
if (speed < -0.95) {
fill(0, 255, 0); // Große, halbtransparente Kreise // grün
ellipse(b, c, 2, 2);
k = 2;
k = 0;
}
if (speed > - 0.95) {
fill(33, 34, 255); // Große, halbtransparente Kreise
ellipse(b, c, 2, 2);
}
angle += 2.3;
b = x + cos (angle) * -random(r * 2.0);
c = y + sin (angle) * -random(r * 2.0);
if (speed < -0.95) {
fill(0, 255, 0); // Große, halbtransparente Kreise
ellipse(b+100, c+100, 40, 40);
}
if (speed > - 0.95) {
fill(33, 34, 255); // Große, halbtransparente Kreise
ellipse(b, c, 50, 50);
}
angle += 0.8;
b = x + cos (angle) * random(r, r * 2.0); //Entfernung von Kreis
c = y + sin (angle) * random(r, r *2.0);
if (speed < -0.95) {
fill(0, 255, 0); // Große, halbtransparente Kreise
ellipse(b, c, 5, 5);
}
if (speed > - 0.95) {
fill(33, 34, 123); // Große, halbtransparente Kreise
ellipse(b, c, 15, 15);
}
angle += 3.5;
b = x + cos (angle) * -random(r * 2.5);
c = y + sin (angle) * -random(r * 2.5);
if (speed < -0.95) {
fill(0, 255, 0, 123); // Große, halbtransparente Kreise
ellipse(b+20, c+20, 25, 25);
k = 2;
k = 0;
}
if (speed > - 0.95) {
fill(33, 34, 255); // Große, halbtransparente Kreise
ellipse(b+20, c+20, 25, 25);
}
d = x + cos (angle) * random(r, r * 1.5);
e = y + sin (angle) * random(r, r * 1.5);
if (speed < -0.95) {
fill(0, 255, 0); // Große, halbtransparente Kreise
triangle(d+30, e+75, d+58, e+20, d+86, e+75);
}
if (speed > - 0.95) {
fill(33, 34, 255); // Große, halbtransparente Kreise
triangle(d+30, e+75, d+58, e+20, d+86, e+75);
}
smooth();
fill(133, 13, 40);
noStroke () ;
beginShape();
vertex(x+r+50, y+r+15);
bezierVertex(x+r+50, y+r-5, x+r+90, y+r+5, x+r+50, y+r+40);
vertex(x+r+50, y+r+15);
bezierVertex(x+r+50, y+r-5, x+r+10, y+r+5, x+r+50, y+r+40);
endShape();
r++ ;
if (r > 220)
r = 200;
y = y + speed;
speed = speed + gravity;
if (y > height) {
speed = speed * -0.95;
}
}
Do you see the problem? The heart is far away from being in the middle of all those balls and triangles...how can I change it? I know, there must be something changed in the code of the bezierVertex...but don't know what. It would be great, if you could help me :)