playing with curves and minimalist shapes and colors
var points = 600;
function setup() {
createCanvas(600, 400);
frameRate(30);
}
function draw() {
background(250);
push();
translate(width/2, 0);
drawCurve();
pop();
}
function drawCurve(){
//http://mathworld.wolfram.com/Bicorn.html
var g = map(mouseX, 0, width, 0, width/2);
var y;
var a = map(sq(mouseY), 0, height, 0, 1);
beginShape();
for (var i = 0; i < points; i++) {
var t = map(i, 0, points, 0, radians(360))
x = g * sin(t);
y = (a * cos(t) * cos(t) * (5 + cos(t))) / (5 + sin(t) * sin(t));
fill(255);
ellipse(x,y,mouseY, mouseY);
fill(255,0,0);
triangle(x,y,x/300,mouseY,x/2,mouseY*2);
}
endShape(CLOSE);
}