EveryDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/OmarMtya/engine.js/llms.txt
Use this file to discover all available pages before exploring further.
Figura in Engine.js owns a Transform that describes where it lives on the canvas and how it looks. Position, dimensions, radius, fill color, image texture, and sound effect are all stored here. You do not need to construct a Transform independently — you typically create one inline when instantiating a Figura, and then mutate its properties at runtime to move or restyle the object.
Constructor
Horizontal canvas position in pixels, measured from the left edge of the canvas. For squares and images this is the left edge of the figure; for circles it is the center.
Vertical canvas position in pixels, measured from the top edge of the canvas. For squares and images this is the top edge; for circles it is the center.
Width of the figure in pixels. Used for
'cuadrado' and 'imagen' types. Ignored for circles (use radio instead).Height of the figure in pixels. Used for
'cuadrado' and 'imagen' types. Ignored for circles.Radius of the figure in pixels. Used exclusively for
'circulo' type figures. Ignored for squares and images.A CSS-compatible hex color string (e.g.
'#ff0000') used as the fill color for squares and circles. For image figures this value is stored but the engine renders the imagen.src texture instead.Instance Properties
In addition to the constructor parameters above, aTransform instance exposes two component slots:
An optional
$g.Imagen instance. When set on an 'imagen'-type figure, the engine draws the image texture instead of a solid fill. Set to null to remove the texture.An optional
$g.Sonido instance. When set, the engine plays the attached audio according to the sound’s activacion trigger mode. Set to null to detach the sound.Examples
Creating a transform for a square
Creating a transform for a circle
Modifying properties at runtime
All properties are mutable. After making changes, call$g.Dibujar() to see the result (or rely on the running animation loop to pick them up automatically).