Blocks
Blocks are the primary functional units in b5 - they represent operations, values, and effects. Each block performs a specific task, from storing numbers to drawing shapes.
Block Types
b5 supports several different kinds of blocks, each with unique behavior:Normal Blocks
Normal Blocks
Standard functional blocks with input and output nodes. Examples include mathematical operations (
add, subtract), drawing functions (circle, rectangle), and utility functions.These blocks can have:- 0 or more input nodes (top)
- 0 or more output nodes (bottom)
- A descriptive name in the center
Input Blocks
Input Blocks
Blocks that allow direct user input of values. Common types include:
number- Direct number inputstr- String/text input
Slider Blocks
Slider Blocks
Interactive blocks with visual controls:
numberSlider- Drag to select a number within a rangefractionSlider- Similar to number slider with fraction display
Color Picker Blocks
Color Picker Blocks
Visual color selection blocks:
fillPicker- Set fill colorstrokePicker- Set stroke color
Inline Blocks
Inline Blocks
Compact blocks that display their operation inline (like
+, -, *, /). These blocks:- Have at most 2 inputs and 1 output
- Show the operation symbol directly
- Take up minimal space
Comment Blocks
Comment Blocks
Special blocks for documentation that don’t execute any code. Use them to:
- Explain what your code does
- Add notes for yourself or others
- Structure your visual code with headings
Nodes
Nodes are the connection points on blocks where data flows in and out. They come in two types:Input Nodes
Input nodes appear at the top of blocks and receive data from other blocks’ output nodes.
- Accept incoming data via wires
- Can only connect to one output node at a time
- Show a label describing what input they expect
- Display type information through color when connected
Output Nodes
Output nodes appear at the bottom of blocks and send data to other blocks’ input nodes.
- Send data to other blocks
- Can connect to multiple input nodes simultaneously
- Show a label describing what data they output
- Provide type information for connected wires
Node Positioning
The number of nodes determines a block’s visual width. The rendering system automatically adjusts block size based onMath.max(inputNodesCount, outputNodesCount) to accommodate all nodes properly.
Wires
Wires are the visual connections between nodes that represent data flow. They connect output nodes to input nodes, creating the data flow graph.Creating Wires
To create a wire connection:- Click and hold on any node (input or output)
- Drag your cursor to the target node
- Release on the destination node
Wire Rules
Wires must follow these connection rules:- Cannot connect a node to itself
- Cannot connect two input nodes or two output nodes
- Cannot connect to a block on the same line or above (inputs)
- Cannot connect to a block on the same line or below (outputs)
- Input nodes can only have one incoming wire
- Output nodes can have multiple outgoing wires
Deleting Wires
- Click on a wire to select it (it will be highlighted)
- Press Backspace to delete the connection
Wire Type Display
Wires visually indicate the data type flowing through them using colors. The wire’s appearance changes based on the output node’s type, helping you track data types at a glance.Block Search
To add blocks to your canvas:Search for Blocks
Type to search by:
- Block name (e.g., “circle”)
- Block type (e.g., “math”)
- Block description
Embedded Documentation
Every block, node, and input box has embedded documentation. Simply hover your cursor over any element to see:
- What the block does
- What each node expects or outputs
- Valid input ranges and types