Documentation Index
Fetch the complete documentation index at: https://mintlify.com/peilingjiang/b5/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Blocks are the fundamental building units in b5. Instead of writing lines of code, you connect blocks together with wires to create interactive graphics and animations.Block Anatomy
Every block in b5 has:- Name: The function or operation the block performs
- Inputs (nodes on bottom): Data that flows into the block
- Outputs (nodes on top): Data that flows out of the block
- Inline Data: Some blocks have input boxes for direct values
Block Categories
Canvas Setup
Blocks for initializing and configuring your canvas.createCanvas- Initialize the drawing canvascanvasSize- Get the current canvas dimensions
Shapes
Blocks for drawing basic geometric shapes.circle- Draw a circlerect- Draw a rectanglelineXY- Draw a line between two points
Colors
Blocks for controlling fill and stroke colors.fill- Set fill colorstroke- Set stroke colorbackground- Set background color- Color pickers for visual color selection
Transformations
Blocks that modify the drawing context.rotate- Rotate the coordinate systemscale- Scale the coordinate systemtranslate- Move the coordinate system
Numbers & Math
Blocks for working with numeric values.number- Static number valuenumberSlider- Interactive number sliderfractionSlider- Slider with fractional valuesadd,subtract,multiply,divide- Math operators
Logic & Control
Blocks for conditional logic and program flow.toggle- Boolean toggle based on conditionrandom- Generate random valuesstopDraw- Stop drawing when condition is metbool- Boolean input parametertrue/false- Boolean constants
Mouse & Keyboard
Blocks for user interaction.mouse- Get mouse positionmouseIsPressed- Check if mouse is pressedmouseClicked- Detect mouse clicks
Timing
Blocks for controlling animation timing.frameRate- Set or get the frame rateframeRateShow- Display current frame rate
Physics (Matter.js)
Blocks for physics simulation using Matter.js.matter_startEngine- Initialize physics enginematter_box- Create a physics boxmatter_ball- Create a physics ballmatter_ground- Create a ground plane
Effect Blocks
Some blocks are effect blocks (shown with colored backgrounds). These blocks affect subsequent blocks through contextual relationships rather than wire connections:fill- Sets fill color for shapes that followstroke- Sets stroke color for shapes that followrotate- Rotates the coordinate system for shapes that followscale- Scales the coordinate system for shapes that follow
Execution Order
Block Sources
Blocks come from different sources:- original: Built-in b5 blocks
- custom: User-defined blocks from the Factory
- library: Blocks from external libraries (like Matter.js, PoseNet)
Adding Blocks
To add a block to your canvas:- Double click on an empty block room in the code canvas
- Search for the block by name, type, or description
- Select the block to add it
Next Steps
Canvas Setup
Learn about canvas initialization blocks
Drawing Shapes
Explore shape drawing blocks
Colors
Work with colors and color pickers
Transformations
Transform your drawings