This demo tries to emulate a pulsar star. It shines and fades within a period of 2 seconds, approx., and changes its direction when it touches any side (a classic).
W=window;a=document.getElementById("c");a.width=W.innerWidth;H=W.innerHeight;a.height=H;c=a.getContext("2d");q=[];Q=[];P=0;T=30;T1=T+1;S=H/T;for(k=0;k<T;k++){for(j=0;j<T;j++){q.push([j*S,k*S]);Q.push([j*S,k*S]);}}M=Math;function sd(o){var v;for(k=T;k<(Q.length-T);k++){U=Q[k];v=[U[0],U[1]];d=[v[0]-o[0],v[1]-o[1]];s=(d[0]*d[0])+(d[1]*d[1]);sq=Math.sqrt((d[0]*d[0])+(d[1]*d[1]));e=3000/sq|0;C=(e*6*P)|0;(k%T==0||((k-(T-1))%T)==0)?q[k][2]=C:q[k]=[U[0]-(d[0]/e)|0,U[1]-(d[1]/e)|0,C];}}function dr(){N=[0,0,0];for(k=0;k<(q.length-(T1));k++){A=q[k];B=q[k+1];F=A[2];if(A[0]-B[0]>10)continue;C="rgb("+(N[0]+F)+","+(N[1]+F)+","+(N[2]+F)+")";c.strokeStyle=C;c.fillStyle=C;c.beginPath();c.moveTo(q[k+T][0],q[k+T][1]);c.lineTo(A[0],A[1]);c.lineTo(B[0],B[1]);c.lineTo(q[k+T1][0],q[k+T1][1]);c.stroke();c.fill();}}x=H/3;y=H/2;v=(M.random(5)+1)|0;w=-1.0;z=1;function cy(){x>H-S?v=-1.0:x<S?v=(M.random(5)+1)|0:0;y>H-S?w=-1.0:y<S?w=(M.random(5)+1)|0:0;x=x+v;y=y+w;P>1?z=-0.05:0;P<0?z=0.05:0;P+=z;sd([x,y]);dr();}setInterval(cy,40);
Vz13aW5kb3c7YT1kb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiYyIpO2Eud2lkdGg9Vy5pbm5lcldpZHRoO0g9Vy5pbm5lckhlaWdodDthLmhlaWdodD1IO2M9YS5nZXRDb250ZXh0KCIyZCIpO3E9W107UT1bXTtQPTA7VD0zMDtUMT1UKzE7Uz1IL1Q7Zm9yKGs9MDtrP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