jagenjo / litegraph.js

A graph node engine and editor written in Javascript similar to PD or UDK Blueprints, comes with its own editor in HTML5 Canvas2D. The engine can run client side or server side using Node. It allows to export graphs as JSONs to be included in applications independently.
MIT License
5.33k stars 602 forks source link

Can we render link in different colors by its value? #452

Closed monoglo closed 2 months ago

monoglo commented 3 months ago

In fact, at first I just want event triggered link's flow points animation on every link that has 'true' value, to visualize data's flow. But I haven't found that setting parameter.

So I think it's an another good idea that display link color by its value. Simplily, just boolean value, green to true, gray to false. Then we can customize a map of value to color.

monoglo commented 2 months ago

OK, I get it, just add below code:

if (link && link.data) {
    this.renderLink(
        ctx,
        start_node_slotpos,
        end_node_slotpos,
        link,
        true,
        true,
        "green",
        start_dir,
        end_dir
    );
    continue;
}