xxxxxxxxxx
let vec;
let t;
let num;
function preload(){
spotlight = loadImage("https://i.imgur.com/41kA2S5.png");
}
function setup() {
createCanvas(400, 400);
noLoop();
noFill();
vec = { x: 1, y: 1 };
num = 500;
t = 7;
strokeWeight(2);
stroke(150,100)
}
function draw() {
background(100,100,200);
let x = 200;
let y = 200;
for (let i = 0; i < num; i++) {
let next_x = x + vec.x * 10+150*random(-1,1);
let next_y = y + vec.y * 10+150*random(-1,1);
stroke(200);
noFill();
bezier(
x,
y,
x + t * vec.x,
y + t * vec.y,
next_x - t * vec.x,
next_y - t * vec.y,
next_x,
next_y
);
fill(0)
circle(x,y,2)
x = next_x;
y = next_y;
if(dist(x,y,200,200)>130){
x = 200;
y = 200;
}
}
blendMode(OVERLAY);
// fill(250);
// circle(200,200,300);
image(spotlight,0,0);
}