xxxxxxxxxx
40
var x1, y1; //x2, y1;
var px=0;
function setup() {
createCanvas(400, 400);
x1 = 200; //starting positions dont matter
y1 = 100;
x2 = 200;
y2 = 200;
frameRate()
}
function draw() {
//background(220);
px = random (0.1, 5);
strokeWeight(px);
//point(200, 200);
line(200, 200, x1, y1);
line(200, 200, x2, y2);
//automatically run with frameCount
/*x1 = 200 + 100 * cos(frameCount/30);
y1 = 200 + 100 * sin(frameCount/30);
x2 = 200 + 80 * cos(frameCount/100);
y2 = 200 + 80 * sin(frameCount/100);*/
// control by mouse
x1 = 200 + 100 * cos(map(mouseX, 0, 700, 0, 30 * PI));
y1 = 200 + 100 * sin(map(mouseX, 0, 900, 0, 30 * PI));
//x2 = 200 + 80 * cos(map(mouseX, 0, 400, 0, 0.5 * PI));
//y2 = 200 + 80 * sin(map(mouseX, 0, 400, 0, 0.5 * PI));
}