[ Launch Inlet ]
Gist #2958196 No Previous Gist
-
-
Save hemulin/3924473 to your computer and use it in GitHub Desktop.
just another inlet to tributary
This file contains hidden or 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
{"endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.7,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":600,"height":300,"hide":false}} |
This file contains hidden or 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 w = 900, h = 600; | |
var r = 2, rStep = 0.06, | |
cr = 10, crStep = 1.2, n = 222, | |
step = (9*Math.PI)/n, angle = 0; | |
var circles = new Array(); | |
var newColor = function(d) { | |
return 'rgb(' + Math.floor(255 * Math.random()) + | |
', ' + Math.floor(255 * Math.random()) + | |
', ' + Math.floor(255 * Math.random()) + ')'; | |
} | |
//############################ | |
var visArea = d3.select("svg") | |
.attr("width", w) | |
.attr("height", h); | |
var circle; | |
for (var i = 0; i < n; i++) { | |
circle = createCircle(); | |
circles.push(circle); | |
angle += step; | |
cr += crStep; | |
r += rStep; | |
} | |
function createCircle() { | |
var circle = visArea.append("circle") | |
.attr("r", r) | |
.attr("cx", (w/2)+cr*Math.cos(angle)) | |
.attr("cy", (h/2)+cr*Math.sin(angle)) | |
.style("fill", newColor); | |
return {"r": r, "cr": cr, "a": angle, "element": circle}; | |
} | |
function rotateAll() { | |
for (var i = 0; i < circles.length; i++) { | |
circles[i].a -= 0.01; | |
circles[i].element.transition().duration() | |
.attr("cx", (w/2)+circles[i].cr*Math.cos(circles[i].a)) | |
.attr("cy", (h/2)+circles[i].cr*Math.sin(circles[i].a)); | |
} | |
} | |
//window.rotateAll = rotateAll; | |
//setInterval(window.rotateAll, 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment