Gist #4296632
Gist #4296602
Gist #4296526
Gist #4296508
Gist #4296441
Gist #4296428
Gist #4296369
Gist #4296340
Gist #4296122
Gist #4295946
Gist #4295610
Gist #4295580
Gist #4295545
Gist #4295449
Gist #4295421
Gist #4295349
Gist #4295278
Gist #4295261
Gist #4295176
Gist #4295065
Gist #4295050
Gist #4295040
Gist #4295033
Gist #4295031
Gist #4294970
Gist #4291239
Gist #4291189
Gist #4291133
Gist #4291114
Gist #4291056
Gist #4291036
Gist #4291030
Gist #4291012
Gist #4290942
Gist #4290897
Gist #4290814
Gist #4290791
Gist #4290726
Gist #4290721
Gist #4290667
Gist #4290622
Gist #4290523
Gist #4290508
Gist #4290483
Gist #4290448
Gist #4290411
Gist #4290343
Gist #4290285
Gist #3200444
-
-
Save anonymous/4296701 to your computer and use it in GitHub Desktop.
Another Inlet
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
{"description":"Another Inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":false,"vim":true,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.5776140168844033,"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,"hidepanel":false} |
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 dataset=[], lineData=[], a=0, data=[], i, num=26, r, step= (360 / num) / 180 *Math.PI ; | |
var svg = d3.select("svg"); | |
// generates 26 fake numbers in an array | |
var fakearray = function(){ | |
var tmp=[]; | |
for( i = 0; i < num; i++ )tmp[i]=Math.ceil(Math.random()*50); | |
return tmp; | |
} | |
// creates a stack of fake objects to work with | |
for(var e = 0; e < 99; e++ ){ | |
var tmp = { "color":"#000333","stuff":{"num":2,"values":fakearray(),"moarvalues":fakearray()}}; | |
dataset.push(tmp); | |
} | |
//console.log(dataset); | |
var xxx = d3.scale.linear() | |
.range([0, 273]); | |
var s=[]; | |
function pick(){ | |
for( var f = 0; f < 3; f++){ | |
var index=Math.round(Math.random()*dataset.length-1); | |
s[f]= dataset[ index ] ; | |
} | |
} | |
pick(); | |
console.log(s); | |
var yo= function(d){ | |
var m=[]; | |
console.log(d); | |
var tmp = fakearray(); | |
for( i = 0; i < num; i++ ){ | |
r = 87+tmp[i]; | |
a += step; | |
m[i]= {"x": Math.sin(a)*r, "y": Math.cos(a)*r} ; | |
} | |
return m; | |
} | |
var lineFunction = d3.svg.line() | |
.x(function(d) { return d.x; }) | |
.y(function(d) { return d.y; }) | |
.interpolate("basis-closed"); | |
var t=svg.selectAll("g").data(s).enter().append("g") | |
.attr({"transform":function(d,i){ return "translate("+xxx(i)+",100)"},"x":function(d,i){return i*200},"y":0}); | |
t.selectAll("g").data(s,function(m,i){return m.stuff;}).enter() | |
.append("path") | |
.attr({"d": lineFunction(yo()),"fill": "#4EBDF5", "opacity": 0.9 }); | |
//t.append("path") | |
//.attr({"d": lineFunction(yo()),"fill": "#4EBDF5", "opacity": 0.9 }); | |
//t.append("path") | |
//.attr({"d": lineFunction(yo()),"fill": "#F54EDA", "opacity": 0.9 }); | |
t.selectAll("path").attr("transform", "translate(100,200)"); | |
t.selectAll("g").data(function(d){ return d.stuff.values;}).enter().append("rect") | |
.attr( { "fill":"#3D9DF7","x":function(d,i){return i*8}, "width":3, "height": function(d){return d;} } ); | |
t.selectAll("g").data(function(d){ return d.stuff.moarvalues;}).enter().append("rect") | |
.attr( { "fill":"#F73DD9","x":function(d,i){return i*8+4}, "width":3, "height": function(d){return d;} } ); | |
// .attr({"d": lineFunction(lineData),"fill": "#4EBDF5", "opacity": 0.9 }) | |
// .attr("transform", "translate(500,500)"); | |
//svg.selectAll("rect").data(data).enter().append("rect") | |
//.attr({"fill":"#3D9DF7","x":13,"height":3,"y":function(d,i){return i*4+223;},"width":function(d){return d*12;}}); | |
//var aa=svg.append("path") | |
//.attr({"d": lineFunction(lineData),"fill": "#4EBDF5", "opacity": 0.9 }) | |
//.attr("transform", "translate(500,500)"); | |
//var bb=svg.append("path") | |
//.attr({"d": lineFunction(lineData),"fill": "#FCF208","opacity":0.76}) | |
//.attr("transform", "translate(500,500)"); | |
setInterval(function() { | |
// compute(); | |
// aa.transition().ease("bounce").duration(1000).delay(271).attr("d", lineFunction(lineData)) | |
//compute(); | |
//bb.transition().ease("elastic").duration(1000).attr("d", lineFunction(lineData)) | |
// data=fakearray(); | |
//svg.selectAll("rect").data(data) | |
//.transition() | |
//.duration(500) | |
//.attr({"fill":"#3D9DF7","x":13,"height":3,"y":function(d,i){return i*4+223;},"width":function(d){return d;}}); | |
}, 3000); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment