mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 15:24:09 +00:00
Updated link
This commit is contained in:
39
README.md
39
README.md
@@ -4,26 +4,43 @@ A library in Javascript to create graphs in the browser similar to [PureData](ht
|
||||
|
||||
It can be integrated easily in any existing web applications and graphs can be run without the need of the editor.
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install litegraph.js
|
||||
```
|
||||
|
||||
## Creating a Graph ##
|
||||
|
||||
You can create graphs from the editor (and store them in JSON) or directly from code:
|
||||
|
||||
```javascript
|
||||
## First project ##
|
||||
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="/litegraph.js"></script>
|
||||
</head>
|
||||
<body style='width:100%; height:100%'>
|
||||
<canvas id='mycanvas' width='1024' height='720' style='border: 1px solid'></canvas>
|
||||
<script>
|
||||
var graph = new LGraph();
|
||||
var node = LiteGraph.createNode("basic/const");
|
||||
var node2 = LiteGraph.createNode("basic/watch");
|
||||
graph.add( node );
|
||||
graph.add( node2 );
|
||||
node.connect(0, node2, 0); //connect node slot 0 to node2 slot 0
|
||||
|
||||
graph.runStep(1); //execute one cycle
|
||||
var canvas = new LGraphCanvas("#mycanvas", graph);
|
||||
|
||||
var node_const = LiteGraph.createNode("basic/const");
|
||||
node_const.pos = [200,200];
|
||||
graph.add(node_const);
|
||||
node_const.setValue(4.5);
|
||||
|
||||
var node_watch = LiteGraph.createNode("basic/watch");
|
||||
node_watch.pos = [700,200];
|
||||
graph.add(node_watch);
|
||||
|
||||
node_const.connect(0, node_watch, 0 );
|
||||
|
||||
graph.start()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## How to code a new Node type
|
||||
|
||||
@@ -4,7 +4,7 @@ A library in Javascript to create graphs in the browser similar to [PureData](ht
|
||||
|
||||
It can be integrated easily in any existing web applications and graphs can be run without the need of the editor.
|
||||
|
||||

|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user