Skip to content

Instantly share code, notes, and snippets.

@kzrl
Created September 23, 2013 13:11
Show Gist options
  • Save kzrl/6670188 to your computer and use it in GitHub Desktop.
Save kzrl/6670188 to your computer and use it in GitHub Desktop.
Dark Side of the Moon cover in a tiny amount of JS Originally from http://jsfiddle.net/qLfYS/
var c=document.getElementById("d");
var c=c.getContext("2d");
var L2=[0,425,338,332,402,225,542,465,262,465,402,225,460,315,800,378];
var cs=["fff","f00","ffa500","ff0","0f0","00f","800080"];
for(var i=2,j=0;i<26;){
c.beginPath();
c.lineWidth=i==2||i>=12?8:2;
var k=Math.floor(i/12)*(i%12-2);
if(k<0)k=10;
var n=i-k,t=k*4,w=k*6;
c.moveTo(L2[n-2]+t,L2[n-1]+w);
c.lineTo(L2[n]+t,L2[n+1]+w);
if(i>12)j++;
c.strokeStyle=cs[j];
c.stroke();
c.closePath();
i+=2;
if(i==12)
i=14
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment