Marks
Mark
objects are handles to their internal representation in Fatum.
They can be created and deleted without affecting the existance of the corresponding visual element.
Using invalid marks will cause crashes. You should check if a Mark
is valid using its isValid()
method.
Every mark has an id, which you can access with the method id()
.
Properties
Position
- X, Y and Z position of the center of the mark. The Z coordinate enables to control which mark is on top of the others because of the orthographic projection.
Size
- Width and heigth of the mark. No depth because of the 2D projection.
Shape
- Shape of the mark. Such as circle, square, diamond or more complex shapes. The mark can turn invisible with the "none" shape
Color
- Red, green, blue and alpha value of the mark.
Rotation
- Rotation of the mark around the Z axis.
Texture
- Texture of the mark.
-
Border size
- Size of the border of the mark in pixels. Defined in screen space, the size remain constant upon zooming. -
Border color
- Color of the border.
Radial clipping
- Angular portion of the shape to render.
Internal clipping
- Inside portion of the shape not to render.
Other methods
Deleting a Mark
The method del()
can be used to remove a mark from fatum.
Be aware that this will only signal it for deletion after the next animation or swap.
A common pattern is to change the Mark's appearance to signify deletion. For instance,
m.del().alpha(0);
fatum.animate();
Will make the mark fade out before being deleted.
Manipulating the buffers
By default, every modification you make to a Mark is made in the back buffer.
It is possible to copy the Mark's state from the back buffer to the front buffer using show()
.
Connecting a Mark
To connect a Mark to another Mark, you can use the fatum addConnect(m1,m2)
method, or the inline connect(m)
method.
var m1 = fatum.addMark();
var m2 = fatum.addMark();
// connect through fatum
fatum.addConnection(m1,m2);
// or connect in an inline fashion
m1.connect(m2);
Cloning a Mark
A Mark can be cloned with its clone()
method.
This will create a new Mark, with the same properties as the original.