1.0.2 • Published 4 years ago
fdwg v1.0.2
Setup
npm i
Test example
npm test
const fdwg = require('fdwg')
fdwg.nodes = [{id: 1, text: '1', mass: 1}, {id: 2, text: '2', mass: 1},]
fdwg.edges = [{source: fdwg.getNode(1), target: fdwg.getNode(2)})]
fdwg.start()
const w = 600
const h = 400
fdwg.updateFast(200, () => {
fdwg.tick()
// clear your screen
fdwg.forScreen(w, h, (nodes, edges) => {
// draw your nodes
edges.forEach(edge => console.log(edge.A.x, edge.A.y, edge.B.x, edge.B.y))
nodes.forEach(node => console.log(node.x, node.y))
})
})