Created
August 4, 2012 02:54
-
-
Save roundrobin/3253727 to your computer and use it in GitHub Desktop.
just another inlet to tributary
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
tributary.init = function(g) { | |
var data = d3.range(0,232); | |
var enterSelection = g.selectAll('.elemets') | |
.data(data) | |
.enter() | |
.append('rect') | |
.attr("width",function(d,i){ | |
return d; | |
}) | |
.attr("height",function(d,i){ | |
return d; | |
}) | |
.attr("x",function(d,i){ | |
return Math.sin(d)*1994.32; | |
}) | |
.attr("y", function(d,i){ | |
return Math.sin(d)*(211); | |
}) | |
.attr("fill","#ff00ff"); | |
}; | |
tributary.run = function(g,t) { | |
var delta = Math.floor(t * 100); | |
if(delta % 11 == 0 ){ | |
console.log(delta,Math.random()*10) | |
d3.selectAll('rect') | |
.attr("x",function(d,i){ | |
return Math.random()*31; | |
}) | |
} | |
if(delta % 110 == 0 ){ | |
d3.selectAll('rect') | |
.transition() | |
.duration(2000) | |
.attr('fill','#'+Math.floor(Math.random()*16777215).toString(16)) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment