Sine Wave outta Circle

You can see how a sine wave can be generated from a circle.

Code

            
    elem=document.querySelector(".example-container");
    setCanvas(elem);
    t=0;
    t2=0;
    
    function draw(){
        clearCanvas();
        points=[]
        x=90+80*cos(t);
        y=HEIGHT/2+80*sin(t);
        
        new circle(90,HEIGHT/2,80,'#695fe6',0,'#fff',2);
        new line(90,HEIGHT/2,x,y,'#fff',2);
        new circle(x,y,5,'#695fe6',0.6,'#fff',1);
        new line(90,y,x,y,'#695fe6',1);
        new line(90,HEIGHT/2-80,90,HEIGHT/2+80,'#695fe6',1);
        for(i=0;i<WIDTH-90;i++){
            
            points.push([90+i,HEIGHT/2+80*sin(degToRad(i-t2))]);
            
        }

        new polygon(points,'#695fe6',0,'#695fe6',1,false);

        t-=0.01;
        t2+=radToDeg(0.01);
        requestAnimationFrame(draw);
    }
    
    draw();