Style Management
Base Style

Base Style

In Montagix SDK, the BaseStyle serves as the foundational building block for all style-related manipulations. It encapsulates the fundamental style properties and behaviors, which can be inherited and expanded upon by other style classes.

What is Base Style?

The BaseStyle is essentially a collection of style properties that can be applied to different nodes within the scene graph. While individual nodes like images or clips may have specific style properties, the BaseStyle provides shared attributes that are common across different node types.

Core Features

Universality

Since it's designed to serve as a foundational style, BaseStyle can be applied universally to any node in the Scene Graph. Whether you're working with images, video clips, or text, the BaseStyle ensures consistency.

Extensibility

Developers can easily extend the BaseStyle to create specialized styles. This means you can start with the foundational properties and add or modify functionalities as required.

Modularity

The BaseStyle ensures that style-related properties are kept modular and separate from the node's core functionalities. This encourages a clean and organized approach to media composition.

Benefits of Using Base Style

  • Consistency: Ensure that all nodes, regardless of their type, can have a shared set of style properties.

  • Customization: While the BaseStyle offers a set of default properties, developers have the freedom to customize and expand upon these as needed.

  • Efficiency: By decoupling style from functionality, developers can make style changes without affecting the underlying node operations.


Note: While the BaseStyle provides a foundational set of style properties, remember that specific nodes might offer additional style properties tailored to their functionalities.


API

Properties

Property NameTypeDescription
opacitynumberControls the opacity of the sprite, a value between 0 (fully transparent) and 1 (fully opaque).
rotationnumberControls the rotation of the sprite, in radians.
xnumberControls the x-coordinate position of the sprite.
ynumberControls the y-coordinate position of the sprite.
zIndexnumberControls the z-index of the sprite, determining its stacking order.

Methods

Function NameDescription
constructor()Constructs a BaseStyle instance with default style properties.
update(sprite: PIXI.Sprite)Updates a PIXI sprite with the current style properties.
toStyleObject()Converts the style properties to a CSS style object.
serialize()Serializes the style properties into a JSON-friendly format.
static deserialize(data: any)Deserializes data into a BaseStyle instance.