xxxxxxxxxx
48
var x1, y1; // point 1
var x2, y2; // control point 1
var x3, y3; // point 2
var x4, y4; // control point 2
var a = 0;
function setup() {
createCanvas(windowWidth,windowHeight);
ellipseMode(CENTER);
background(0);
strokeWeight(3);
}
function draw() {
// Simulate fade-out:
x1 = mouseX;//
y1 = height-mouseY;
x2 = width-mouseX;
y2 = map(mouseY, 0 , height,-500, height+500);;
x3 = mouseX;
y3 = height-mouseY;
x4 = width-mouseX;
y4 = map(mouseY, 0 , height,-200, height+200);;
noStroke();
fill(0, 10);
rect(0, 0, width, height);
// Draw bezier shapes:
fill(255, 50);
x2 = 250 + (sin(radians(a)) * 355);
x3 = 250 - (cos(radians(a)) * 355);
noFill();
stroke(255, 155 + sin(radians(a * 2)) * 100, 155 + cos(radians(a * 2)) * 100);
bezier(x1, y1, x2, y2, x3, y3, x4, y4);
x2 = 250 - (sin(radians(a)) * 355);
x3 = 250 + (cos(radians(a)) * 355);
stroke(255, 155 + sin(radians(a * 2)) * 100, 155 + cos(radians(a * 2)) * 100);
bezier(x1, y1, x2, y2, x3, y3, x4, y4);
a += 15; // increase angle (animate)
}