/_.md
Created
December 4, 2013 05:39
Revisions
-
epidemico616 revised this gist
Dec 4, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ [ <a href="http://tributary.io/inlet/7782904">Launch: Tributary inlet</a> ] 7782904 by epidemico616<br> -
epidemico616 created this gist
Dec 4, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ {"description":"Tributary inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01} 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ optionRadius = 29; nodeRadius = 69; ringRadius = nodeRadius + optionRadius + 5; optionRotation = 2; context = [{"name":"first", "action":"test1"},{"name":"second", "action":"test2"},{"name":"third", "action":"test3"},{"name":"fourth", "action":"test4"}]; n = context.length; svg = d3.select("svg"); node = svg.append("g").attr({transform:"translate(400,400)"}) inner = node.append("circle").attr({cx:0,cy:0,r:nodeRadius,fill:"#068"}) ring = node.append("circle").attr({cx:0,cy:0,r:ringRadius,fill:"none",stroke:"black","stroke-width":2}) option = node.selectAll("option") .data(context) .enter() .append("circle") .attr({ cx:function(d,i){return ringRadius*Math.cos(i/n*(Math.PI*optionRotation))}, cy:function(d,i){return ringRadius*Math.sin(i/n*(Math.PI*optionRotation))}, r:optionRadius, fill:"grey" }) .on("mouseover", function(d,i){d3.select(this).transition().attr({r:optionRadius+5})}) .on("mouseout", function(d,i){d3.select(this).transition().attr({r:optionRadius})}) .on("click", function(d,i){alert(d3.select(this.parentNode).datum(d.name))}) itemText = node.selectAll("text") .data(context) .enter() .append("text") .text(function(d,i){return d.name}) .attr({ x:function(d,i){return ringRadius*(Math.cos(i/n*(Math.PI*optionRotation)))}, y:function(d,i){return ringRadius*(Math.sin(i/n*(Math.PI*optionRotation)))+optionRadius/(optionRadius/6)} }) .style("text-anchor", "middle")