Commit 981ed08561e580c3f6f34242a8388c7614bdcb69
physics tweak + edge color
mix irving committed on 12/5/2016, 11:26:30 AMParent: 89e66634f75031b1d9c5ffa2bdc49231d2a629b7
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -3,13 +3,29 @@ | |||
3 | 3 … | const fromJson = require('ngraph.fromjson') | |
4 | 4 … | const Renderer = require('ngraph.pixel') | |
5 | 5 … | const Graph = require('./graph') | |
6 | 6 … | ||
7 … | +const config = { | ||
8 … | + physics: { | ||
9 … | + springLength : 80, | ||
10 … | + springCoeff : 0.00005, | ||
11 … | + gravity: -0.4, | ||
12 … | + theta : 0.4, | ||
13 … | + dragCoeff : 0.04 | ||
14 … | + }, | ||
15 … | + link: () => { | ||
16 … | + return { | ||
17 … | + fromColor: 0x000066, | ||
18 … | + toColor: 0x000066 | ||
19 … | + } | ||
20 … | + } | ||
21 … | +} | ||
22 … | + | ||
7 | 23 … | module.exports = function (sbot, cb) { | |
8 | 24 … | Graph(sbot, (err, data) => { | |
9 | 25 … | if (err) return cb(err) | |
10 | 26 … | const str = JSON.stringify(data) | |
11 | 27 … | const graph = fromJson(str) | |
12 | - const display = Renderer(graph) | ||
28 … | + const display = Renderer(graph, config) | ||
13 | 29 … | cb(null, display) | |
14 | 30 … | }) | |
15 | 31 … | } |
Built with git-ssb-web