xxxxxxxxxx
83
let x, y;
let mX, mY;
let x2, y2;
let mX2, mY2;
let easing = 0.2;
let k;
let t = 1;
let i = 0;
let spd;
let sz = 200;
let v;
function setup() {
createCanvas(windowWidth, windowHeight);
background(0, 0, 0);
mX = mouseX - 50;
mY = mouseY - 50;
// mX2 = width/2 - 50
// mY2 = height/2 - 50
}
function mousePressed() {
t = 0;
}
function draw() {
background(0);
t = t + 1;
spd = min(map(t, 0, 120, 1, 12), 12);
sz = min(map(t, 0, 120, 0, 200), 200);
// fill(255);
// noStroke();
// ellipse(mouseX,mouseY,(sz*2)-15);
// x2 = width/2 - random(200,220)*sin((t+3)/6);
// y2 = height/2 - random(200,220)*cos((t+3)/6);
// mX2 = mX2 + (x2 - mX2) * easing;
// mY2 = mY2 + (y2 - mY2) * easing;
for (i = -spd; i < spd * spd; i++) {
x = mouseX - random(sz, sz + 20) * sin((t + i) / spd);
y = mouseY - random(sz, sz + 20) * cos((t + i) / spd);
mX = mX + (x - mX) * easing;
mY = mY + (y - mY) * easing;
strokeWeight(18);
strokeCap(ROUND);
stroke(255,239,213);
beginShape();
vertex(mX, mY);
vertex(mouseX,mouseY);
endShape(CLOSE);
// line(mouseX, mouseY, mX, mY)
strokeWeight(2);
stroke(255, 140, 0, 255);
line(x, y, mX, mY);
beginShape();
}
//line(x2, y2, mX2, mY2);
// stroke(255);
// point(x, y);
}
// var s;
// function keyPressed(){
// saveCanvas (s,'myNetwork.jpg');
// }