0.1.13 • Published 6 years ago

edge-flow v0.1.13

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Edge Flow

A GPU based particle system React Component for showing data flow

Description

A React visual Graph component that animates particles between nodes and animates changes to the position of the nodes. This is one of the building block visualization components for building animated diagrams. The Graph component is fixed position. A separate component layer on top adds automatic layout using a force based algorithm.

Installation

Assuming you're using webpack or browserify:

npm install edge-flow

Package comes with types built in (it's written using TypeScript).

Live demo at joewood.github.io/edge-flow

Simple Directed Graph Usage

import { EdgeFlowDag, NodeDag, EdgeDag } from "edge-flow"

:: ::

render() {
    return (
        <EdgeFlowDag style={{backgroundColor:"#0f0f0f",height:600,width:600}} run={true}>
            <NodeDag key="1" id="node-1" label="node-1' labelColor="white" >
                <EdgeDag linkTo="node-2" ratePerSecond={30} color="blue" size={2} />
            </NodeDag>
            <NodeDag key="2" id="node-2" label="node-2' labelColor="white">
                <EdgeDag linkTo="node-3" ratePerSecond={30} color="red" shape={0.2}/>
            </NodeDag>
            <NodeDag key="3" id="node-3" label="node-3' labelColor="white">
                <EdgeDag linkTo="node-1" ratePerSecond={30}  color="pink" shape={0.8} size={10} />
            </NodeDag>
        </EdgeFlowDag>
    );
}

Usage

import { EdgeFlow, Node, Edge } from "edge-flow"

:: ::

render() {
    return (
        <EdgeFlow style={{backgroundColor:"#0f0f0f",height:600,width:600}} run={true}>
            <Node key="1" id="node-1" label="node-1' center={{x:30,y:20}} labelColor="white" >
                <Edge linkTo="node-2" ratePerSecond={30} color="blue" size={2} />
            </Node>
            <Node key="2" id="node-2" label="node-2' center={{x:530,y:120}} labelColor="white">
                <Edge linkTo="node-3" ratePerSecond={30} variationMin={-0.01} variationMax={0.05} color="red" shape={0.2}/>
            </Node>
            <Node key="3" id="node-3" label="node-3' center={{x:330,y:520}} labelColor="white">
                <Edge linkTo="node-1" ratePerSecond={30} variationMin={-0.06} variationMax={0.06} color="pink" shape={0.8} size={10} />
            </Node>
        </EdgeFlow>
    );
}

Components and Properties

Animated Directed Acrylic Graph - EdgeFlowDag

For a live demo see here.

PropDatatypeDescription
backgroundColorstringBackground Color of the canvas
height, widthnumberSize of the Graph
runbooleanAnimate Graph

NodeDag

PropDatatypeDescription
idstringUsed to identify the node (for edges)
label?stringLabel attached to the Node
labelColor?stringColor of the label text
symbol?stringString used for a font-icon (e.g. FontAwesome)
symbolColor?stringColor for symbol font-icon
symbolSize?numberSize of font-icon
symbolFont?stringSymbol Font name (e.g. "fontawesome")

EdgeDag

PropDatatypeDescription
linkTostringThe id of the node to link to
ratePerSecondnumberHow many particles animating per second through the edge
variationMin?numberThe minimum width of the Edge for random dispersal (default -0.01)
variationMax?numberThe maximum width of the Edge for random dispersal (default 0.01)
color?stringColor of the particle (or color at starting position)
endingColor?stringColor of the particle at the target position (optional, defaults to starting color)
shape?numberRoundness of particle range 0..1 - 1 being circle, 0 being square
size?numberSize of the particles (range 1..20)
pathColor?stringColor of the edge's path (defaults to lighter shade of canvas background)
pathWidth?numberWidth of the line for the edge's path (default 12)
pathOpacity?numberOpacity of the path for the edge (default is 0.2)
nonrandombooleanDisable random distribution of particles (evenly spaced)

EdgeFlow

Main underlying component providing absolute positioning

PropDatatypeDescription
style:Style...
style.backgroundColorstringBackground Color of the canvas
style.heightnumberSize of the Graph, pixels
style.widthnumberSize of the Graph
runbooleanAnimate Graph

Node

Represents a node on the Graph

PropDatatypeDescription
idstringUsed to identify the node (for edges)
center{x,y}Location of Node (auto-scales)
label?stringLabel attached to the Node
labelColor?stringColor of the label text
symbol?stringString used for a font-icon (e.g. FontAwesome)
symbolColor?stringColor for symbol font-icon
symbolSize?numberSize of font-icon
symbolFont?stringSymbol Font name (e.g. "fontawesome")

Edge

Child component of a Node. Indicates which other Nodes this Node links to.

PropDatatypeDescription
linkTostringThe id of the node to link to
ratePerSecondnumberHow many particles animating per second through the edge
variationMin?numberThe minimum width of the Edge for random dispersal (default -0.01)
variationMax?numberThe maximum width of the Edge for random dispersal (default 0.01)
color?stringColor of the particle (or color at starting position)
endingColor?stringColor of the particle at the target position (optional, defaults to starting color)
shape?numberRoundness of particle range 0..1 - 1 being circle, 0 being square
size?numberSize of the particles (range 1..20)
pathColor?stringColor of the edge's path (defaults to lighter shade of canvas background)
pathWidth?numberWidth of the line for the edge's path (default 12)
pathOpacity?numberOpacity of the path for the edge (default is 0.2)
source?{x,y}Starting point of edge (defaults to the connected node)
target?{x,y}Ending point of edge (defaults to the connected node)
p2?, p3?{x,y}Cubic bezier control points
0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago