Circle Image

Pixaflux

Sprite It Attributes

PixaFlux attributes are named values that are attached to a node. These attributes are added to the user interface, and can be exposed to the node graph as node values to create complex projects.

Attributes are added to an Sprite It program with one set of functions, resolved in the node, and sent to the program to access the values with one function.

Adding attributes

The SpriteIt Lua module has a set of functions that add attributes to the Sprite It node:

Boolean Attributes

spriteIt.booleanAttribute(<name>, <default value true or false>)

Example

spriteIt.booleanAttribute("dark", true)

Number Attributes

spriteIt.numberAttribute(<name>, <default>, <min>, <max>, <step>, <decimals>)

Example

spriteIt.numberAttribute("scale", 1.0, 0.0, 2.0, 0.1, 2)

Point Attribute

spriteIt.pointAttribute(<name>, <default_x>, <default_y>, <min>, <max>, <step>, <decimals>)

Example

spriteIt.pointAttribute("scale", 1.0, 1.0, 0.0, 2.0, 0.1, 2)

Rgbo Attribute

spriteIt.rgboAttribute(<name>, <default red>, <default green>, <default blue>, <default opacity>)

Example

spriteIt.rgboAttribute("foreground", 0.5, 0.5, 0.5, 1.0)

Choice Attribute

spriteIt.choiceAttribute(<name>, <string table>)

Example

spriteIt.choiceAttribute("side", {"left","right"})

String Attributes

spriteIt.stringAttribute(<name>, <default string>)

Example

spriteIt.stringAttribute("pattern", "simple")

Resolving Attributes

Attributes are evaluated and added to the Sprite It program for future access using the resolveAttributeValues funcion:

spriteIt.resolveAttributeValues()

This function needs to be called after the attributes have been added, and before reading them.

Reading Attributes

To read the evaluated attributes in the Lua program the Sprite It module has a getAttributeValue function:

scale = spriteIt.getAttributeValue("scale")

Since Lua can return variables of different types one single function work for all attribute types.