Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/audiokit/flow
Generic node graph editor
https://github.com/audiokit/flow
node signal-flow swiftui
Last synced: about 17 hours ago
JSON representation
Generic node graph editor
- Host: GitHub
- URL: https://github.com/audiokit/flow
- Owner: AudioKit
- License: mit
- Created: 2022-08-30T17:30:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-24T05:28:36.000Z (8 months ago)
- Last Synced: 2024-12-22T22:06:54.013Z (about 17 hours ago)
- Topics: node, signal-flow, swiftui
- Language: Swift
- Homepage: https://www.audiokit.io/Flow/
- Size: 1.09 MB
- Stars: 315
- Watchers: 11
- Forks: 17
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flow
[![Tests](https://github.com/AudioKit/Flow/actions/workflows/tests.yml/badge.svg)](https://github.com/AudioKit/Flow/actions/workflows/tests.yml)
Generic node graph editor. Generate a `Patch` from your own data model. Update
your data model when the `Patch` changes.![flow-demo](https://user-images.githubusercontent.com/13122/204678924-64a37ef5-522e-4da5-9c79-c2c6f9f745a6.gif)
```swift
func simplePatch() -> Patch {
let generator = Node(name: "generator", outputs: ["out"])
let processor = Node(name: "processor", inputs: ["in"], outputs: ["out"])
let mixer = Node(name: "mixer", inputs: ["in1", "in2"], outputs: ["out"])
let output = Node(name: "output", inputs: ["in"])let nodes = [generator, processor, generator, processor, mixer, output]
let wires = Set([Wire(from: OutputID(0, 0), to: InputID(1, 0)),
Wire(from: OutputID(1, 0), to: InputID(4, 0)),
Wire(from: OutputID(2, 0), to: InputID(3, 0)),
Wire(from: OutputID(3, 0), to: InputID(4, 1)),
Wire(from: OutputID(4, 0), to: InputID(5, 0))])var patch = Patch(nodes: nodes, wires: wires)
patch.recursiveLayout(nodeIndex: 5, at: CGPoint(x: 800, y: 50))
return patch
}struct ContentView: View {
@State var patch = simplePatch()
@State var selection = Set()var body: some View {
NodeEditor(patch: $patch, selection: $selection)
.onNodeMoved { index, location in
print("Node at index \(index) moved to \(location)")
}
.onWireAdded { wire in
print("Added wire: \(wire)")
}
.onWireRemoved { wire in
print("Removed wire: \(wire)")
}
}
}
```## Documentation
The API Reference can be found on [the AudioKit Website](https://www.audiokit.io/Flow).
Package contains a demo project and a playground to help you get started quickly.