Created
October 22, 2014 07:17
-
-
Save robertcasanova/5298256e650e76107d10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var paper = Raphael(0, 0, 400, 400); | |
var r = 100; | |
var steps = 120; | |
var totLed = 48; | |
// Sets the fill attribute of the circle to red (#f00) | |
var circles = []; | |
// Sets the stroke attribute of the circle to white | |
var alpha = 0; | |
var offsetX = 200; | |
var offsetY = 200; | |
for(var i = 0; i < 5700; i++) { | |
if(i!=0 && i%totLed == 0) { | |
alpha = (alpha+1)%steps; | |
} | |
var x = 4 * (totLed - (i%totLed)) * Math.cos(2*Math.PI/steps * alpha); | |
var y = 4 * (totLed - (i%totLed)) * Math.sin(2*Math.PI/steps * alpha); | |
var circle = paper.circle(x + offsetX,y + offsetY,2); | |
circle.attr("fill", "#000"); | |
circle.attr("stroke", "transparent"); | |
circle.hover(function(e,a){ | |
this.attr("fill","#0f2"); | |
//e.toElement.attr("fill","#000"); | |
}); | |
circles.push(circle); | |
} | |
function printBuffer() { | |
console.log(circles.map(function(item){ | |
return (item.attr("fill") == "#000") ? 0 : 1; | |
})); | |
} | |
window.printBuffer = printBuffer; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button onClick="printBuffer()" style="position:absolute; bottom:0;">Press</button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment