[ Launch: Tributary inlet ] 491544ef5167da729ecd by DaveWelling
-
-
Save DaveWelling/491544ef5167da729ecd to your computer and use it in GitHub Desktop.
Tributary 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":"Tributary inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"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,"ajax-caching":true,"thumbnail":"http://i.imgur.com/mdHPW1O.png"} |
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 vis = d3.select('svg'); | |
var width = 443, | |
height = 500; | |
var links = [{source: 0, target: 1}]; | |
var nodes = [{},{}]; | |
vis.append("rect") | |
.attr({ | |
width: 20, | |
x: 100, | |
y: 100, | |
height: 20, | |
fill: '#000' | |
}).classed('coolGuy', true); | |
vis.append("rect") | |
.attr({ | |
width: 20, | |
height: 20, | |
x: 100, | |
y: 100, | |
fill: '#000' | |
}).classed('coolGuy', true); | |
var coolGuys = vis.selectAll('.coolGuy'); | |
var nodes = coolGuys; | |
var force = d3.layout.force() | |
.nodes(nodes) | |
.links(links) | |
.size([width, height]) | |
.start(); | |
var link = vis.selectAll("line") | |
.data(links) | |
.enter().append("line").attr({ | |
stroke: '#fff'}); | |
//var node = vis.selectAll("circle") | |
// .data(nodes) | |
// .enter().append("circle") | |
// .attr("r", 5); | |
force.on("tick", function() { | |
link.attr("x1", function(d) { return d.source.x; }) | |
.attr("y1", function(d) { return d.source.y; }) | |
.attr("x2", function(d) { return d.target.x; }) | |
.attr("y2", function(d) { return d.target.y; }); | |
coolGuys.attr("x", function(d) { return d.x; }) | |
.attr("y", function(d) { return d.y; }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment