Quick Start
Why CoCube
There are many ways to create software, why learn CoCube?
From the start, CoCube was designed to be as intuitive to use as possible without restricting the flexibility you would have from building software in a standard programming language.
CoCube allows you to create fully customizable, reactive 2D components called cubes directly from your browser with real-time feedback when you make changes, even when you are working collaboratively.
These cubes are stored locally, meaning you don't even need to create an account to
open the console and start building.
CoCube's unique reactive node-and-cell system takes many design cues from spreadsheets and modern web frameworks to create an intuitive yet flexible way to build interactive tools.
Every attribute of a cube is defined using a spreadsheet-like cell expression, and these cells are grouped hierarchically in nodes.
This allows everything from appearance to behavior to be defined using reactive expressions that update immediately when their references change.
Combine this with a fully featured event system allowing nodes to react to events like button clicks, keypresses, mouse hovers, and more, and you get a powerful, collaborative visual environment for creating software.
This system is flexible enough that CoCube's entire console and editor is built using CoCube itself!
Learning how to use CoCube effectively takes some effort, but the payoff is a tool that can be used for a variety of tasks.
Cubes are highly flexible and can be composed and linked to build nearly any tool or system you can imagine.
What this guide covers
How cubes (collaborative components) work.
How to create a cube.
How to change layout and appearance.
How to add reactivity.
How to combine cubes.
How collaboration works.
How to publish.
What exactly is a Cube?
Cubes are the collaborative, visual documents/components you create with CoCube. You can think of a cube like a sheet in a spreadsheet. Like a spreadsheet, all data in a cube exists in reactive cells. However, unlike a spreadsheet, a cube is not displayed as a grid. Instead, the cells it contains define how it looks and behaves.
The first step to understanding this is to talk about the building blocks of cubes: nodes and cells.
Nodes
A node is a single shape or letter that appears on the screen.
A node contains a set of named cells. For example, this is a node:
Width | 100 |
---|---|
Height | 100 |
This node has two cells, Width and Height, both set to 100. The node is displayed as a square.
A cube is a tree of nodes.
Cells
A cell is a uniquely named value defined in a node.
You can give any name you want to a cell.
Cells may be defined as values or as expressions. Cells may also reference other cells.
Nodes contain cells which define its attributes - layout, color, size, rotation, reactivity, and more.
Attribute Cells
Some cells are used to define how the node they are contained in looks and behaves.
Color | Color of the node. |
---|---|
Width | Width of the node. |
Height | Height of the node. |
Rotation | Rotation angle of the node. |
RotationAbsolute | If true, do not use parent node rotation. |
Display | Define what the node looks like (shape, letter, etc). |
AlignTo | Set where the node aligns to. |
AlignFrom | Set the point on the node which should act as the center. |
Anchor | Define where the node is aligned. Defaults to parent. |
Animation | Define the animations for the node. |
EventHandler | Define how the node reacts to events. |
Children | Children node definitions. |
Selectable | If true, the node will be selectable by the event system. |
PivotX | Define the pivot point offset in the X direction. |
PivotY | Define the pivot point offset in the Y direction. |
OffsetX | Define the node offset in the X direction. |
OffsetY | Define the node offset in the Y direction. |
ClipMask | If true, the node will act as a clip mask. Children nodes will only render directly behind it. |
Layer | If true, the node and its children will be displayed one layer above the parent. |
How to create a new Cube
Navigate to the console.
Click to create and open a new cube.
You should see a single node rendered as a green square. This is how a node is displayed when no cells are set.
Modify appearance and behavior
Secondary-click on any node to open the editor.
Insert a cell, then click the cell in the node editor to begin modifying it.
Cell references
Cells can reference other cells via a few functions.
Here is a node that uses a reference function to compute its size dynamically:
Width | 50 |
---|---|
Height | Cell(Width) |
Modifying the Width cell would cause the Height of the node to match.
To read a cell in a parent node use something like ParentCell(Width, 1). This function reads the Width cell one level up the node tree.
Reacting to events
Nodes can be configured to react to events via the node editor.
Use the Reactivity panel to add conditions (like mouse clicks) and responses (like setting cells).
You will see the EventHandler cell added to the node after making changes in the Reactivity panel.
Compose Cubes
After creating a Cube, you can then add it as a child to another Cube.
The best way to do this is to use the node editor.
You will see the Children cell added to the node after inserting a child Cube.
Cells are collaborative
Just like with a spreadsheet, changes are shared. If you update a cell either manually or via an event handler, the cell is updated for everyone viewing component.
Publishing a Cube
Once you have something you want to publish just make it public and share the URL.