Public variables make it possible to parameterize a code snippet or Fectar Snippet and make it reusable by parameterizing the input. This makes it easier for other users to use a Snippet without having to modify the code.
A given variable:
const myVariable
can be parameterized by adding jsdoc style comment to the variable:
/**
* @type{string}
* @exposedAs{My Variable}
* @tooltip{A clear description}
* @default{a default value}
*/
const myVariable
If done correctly, this makes the variable publicly available in the property pane of the code spot:
The following fields are required to make the variable to be recognized as a public variable:
- type - stating the type of the variable
- exposedAs - stating the name of the variable in the property pane
The following optional fields are available to modify the appearance:
- tooltip - the tooltip field adds a little tooltip to the control
- default - a control can be initialized using the default field
- min - min is used by certain types to state the minimum value
- max - max is used by certain types to state the maximum value
- options - is a list of available options, used by the "choice" and "choice[]" types to list the available options
Supported Types
The following variable types are supported:
- string
- number
- range
- boolean
- color
- choice
- Spot
- Text3D
- VideoBasedSpot
- choice[]
- Spot[]
- Text3D[]
- VideoBasedSpot[]
- Vector2
- Vector3