Random Chords

This accumulation of random chords gives an illusion of a spheical ball of threads.
Its based on p5js example for the same.

Code

            
    elem=document.querySelector(".example-container");
    setCanvas(elem);
    
    function draw() {

        // clearCanvas();
        
         // find a random point on a circle
        let angle1 = random(0, 2 * PI);
        let xpos1 = WIDTH/2 + 200 * cos(angle1);
        let ypos1 = HEIGHT/2 + 200 * sin(angle1);
        
        // find another random point on the circle
        let angle2 = random(0, 2 * PI);
        let xpos2 = WIDTH/2 + 200 * cos(angle2);
        let ypos2 = HEIGHT/2 + 200 * sin(angle2);
        
        new line(xpos1,ypos1,xpos2,ypos2,'#fff2');
        requestAnimationFrame(draw);
         
        }
                
    draw();