/*d="M300,544.7 c37.6-0.3,103.7-20,0-328.3 C300,216.3,157.6,545.8,300,544.7z"/> */ float endX = random(298, 302); float endY = random(100); float steps = 100; float x1, x2, x3, x4, x5, x6, x7; float y1, y2, y3, y4, y5, y6, y7; void setup() { size(600, 600); colorMode(HSB, 360, 100, 100, 100); } void init() { x1 = 300; x2 = 337.6; x3 = 403.7; x4 = 300; x5 = 300; x6 = 157.6; x7 = 300; y1 = 544.7; y2 = 544.4; y3 = 524.7; y4 = 216.4; y5 = 216.3; y6 = 545.8; y7 = 544.7; } void draw() { init(); background(0, 0, 0); endX = random(298, 302); endY = random(100); stroke(60, 0, 71); strokeWeight(5); line(300, height, 300, height - 100); noStroke(); fill(60, 14,95); rect(200, 560, 200, 100); for (int i = 0; i < steps; i++) { float s = map(i, 0, steps, 0, 100); fill(20 + (s/3), 100, 87 + (s/10)); beginShape(); vertex(x1, y1); bezierVertex(x2, y2, x3, y3, x4, y4); bezierVertex(x5, y5, x6, y6, x7, y7); endShape(); y1 = adjustY(y1); y2 = adjustY(y2); y3 = adjustY(y3); y4 = adjustY(y4); y5 = adjustY(y5); y6 = adjustY(y6); y7 = adjustY(y7); x1 = adjustX(x1); x2 = adjustX(x2); x3 = adjustX(x3); x4 = adjustX(x4); x5 = adjustX(x5); x6 = adjustX(x6); x7 = adjustX(x7); } //delay(50); } float adjustX(float x) { float xStep = abs(endX - x) / steps; if (x < endX) { return x + xStep; } else if (x > endX) { return x - xStep; } else { return x; } } float adjustY(float y) { float yStep = abs(endY - y) / steps; if (y < endY) { return y + yStep; } else if (y > endY) { return y - yStep; } else { return y; } }