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/4291239 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.5105810498514362,"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 lineData=[], a=0, data=[], i, num=26, r, step= (360 / num) / 180 *Math.PI ; | |
var svg = d3.select("svg"); | |
function compute(){ | |
for( i = 0; i < num; i++ ){ | |
data[i]=Math.ceil(Math.random()*50); | |
r = 200+data[i]; | |
a += step; | |
lineData[i]= {"x": Math.sin(a)*r, "y": Math.cos(a)*r} ; | |
} | |
} | |
for( i = 0; i < num; i++ ){ | |
data[i]=Math.ceil(Math.random()*5); | |
lineData[i]= {"x": 0, "y": 0} ; | |
} | |
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 lineFunction = d3.svg.line() | |
.x(function(d) { return d.x; }) | |
.y(function(d) { return d.y; }) | |
.interpolate("basis-closed"); | |
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)) | |
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