Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created August 4, 2012 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roundrobin/3253825 to your computer and use it in GitHub Desktop.
Save roundrobin/3253825 to your computer and use it in GitHub Desktop.
just another inlet to tributary
tributary.init = function(g) {
var data = d3.range(0,232);
var enterSelection = g.append('g')
.attr('class','groupi')
var gg = enterSelection.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","#0F3D57")
.attr("stroke","#000000")
.attr("stroke-width",5);
};
tributary.run = function(g,t) {
var delta = Math.floor(t * 100);
if(delta % 100 == 0 ){
g.selectAll('rect')
.transition()
.duration(2000)
.attr("x",function(d,i){
return Math.random()*116;
})
.attr("y",function(d,i){
return Math.random()*71;
})
}
if(delta % 210 == 0 ){
g.selectAll('rect')
.transition()
.ease('elastic(2, 10)')
.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