動態圖形可視化庫:fourd.js

d3fw 9年前發布 | 18K 次閱讀 fourd.js JavaScript開發工具包

fourd.js 是一個用在瀏覽器上的動態圖形可視化庫。稍微調整一下,你就可以用它做出一些幾何圖形集合,此庫已經在 Chrome、Firefox、IE11 上測試運行,有傳言說,通過切換 CanvasRenderer,此庫甚至可以在樹莓派上運行。

示例代碼:

var fourd = new FourD(); // instantiation
fourd.init('#selector', {width: 600, height: 350}); // initialization
var vertex_options = {
  width: 5, // pixels
  height: 5,
  depth: 5,
  color: 0x000000 // hex color
};
// or:
var vertex_options = {
  width: 5,
  height: 5,
  depth: 5,
  texture: 'path_to,png'
}
// or:
// leave out vertex options altogether.
// default values will be used.
var vertex1 = fourd.graph.add_vertex(vertex_options); // add a vertex
var vertex2 = fourd.graph.add_vertex(vertex_options); // add another vertex
var edge_options = {}; // currently not defined, but this is how you would pass them.
var edge = fourd.graph.add_edge(vertex1, vertex2, edge_options);
fourd.graph.remove_edge(edge); // this is why you keep those variables
fourd.graph.remove_vertex(vertex1);
fourd.graph.remove_vertex(vertex2);

項目主頁:http://www.baiduhome.net/lib/view/home/1430224694084

 本文由用戶 d3fw 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!