Flow

Creating a Flow

A Flow is a set of Nodes, Connectors and Groups, it can also contain SubFlowNodes.


FlowConnect.createFlow
let flow = flowConnect.createFlow({ name: "Basic Example" });
let flow = flowConnect.createFlow({
  name: "Detailed Example",
  rules: {
    r: ["r", "image"],
    g: ["g", "image"],
    b: ["b", "image"]
    image: ['image']
  },
  ruleColors: {
    r: Color.create('#ff0000'),
    g: Color.create('#00ff00'),
    b: Color.create('#0000ff'),
    image: Color.create('#0ffff0')
  }
});

Creating Rules


Rules specified for a Flow acts as constraints when connecting terminals of diferent nodes together.

If you need to create a Flow that restricts terminals with dataType 'A' to be only connected to other terminals of dataType 'C' or 'D', then the rule for such a constraint will be:
{
  A: ["C", "D"];
}

If two dataTypes can be connected bi-directionally, then you need to specify rules for them explicitly, for e.g. If terminals with dataType 'C' can also be connected to 'A', then the rule becomes:
{
  A: ['C', 'D'],
  C: ['A']
}

Some dataTypes are in-built and every Flow have these rules by default:
{
  'string': ['string', 'any'],
  'number': ['number', 'audioparam', 'any'],
  'boolean': ['boolean', 'any'],
  'array': ['array', 'any'],
  'file': ['file', 'any'],
  'event': ['event', 'any'],
  'vector': ['vector', 'any'],
  'array-buffer': ['array-buffer', 'any'],
  'audio': ['audio', 'audioparam'],
  'audioparam': ['audioparam'],
  'audio-buffer': ['audio-buffer', 'any'],
  'any': ['any']
}