1.4. Filter Parameters
private static const PARAMETERS:Array = [
{
name: "param1",
label: "param 1",
current: 0.1,
min: 0,
max: 1,
type: "number"
}, {
name: "param2",
label: "param 2",
current: 1,
min: 0,
max: 255,
type: "hex"
}
];
Creating Filter parameters is easy and intuitive – all you have to do, is to create an Array of objects containing properties describing each parameter. They will be dynamically created and displayed in each Filter's Panel.
Each object needs to have a defined name
property which corresponds to the variable of the Filter.
Property label
is optional – when omitted, the name
property will be used (with camelCase converted to spaces).
Each Parameter has to have a current
property set, which is set as default on Filter initialisation.
The type
property describes Parameter's variable type.
##Numerical types:
-
number
,float
– floating point value (rendered as slider) -
int
,uint
– signed or unsigned integer value (rendered as slider) -
hex
– hexadecimal value (rendered as slider) -
boolean
– flag value (rendered as checkbox) -
stepper
– integer value (rendered as numeric stepper) -
knob
– floating point value (rendered as rotary knob)
All numerical types ought contain min
and max
properties, although they will be set to default values of min: 0
, and max: 1.0
if not specified otherwise.
##Other types:
-
rgb
,color
– hexRRGGBB
color value (rendered as color picker/sampler) -
input
,string
– string value (rendered as input textfield)
##Extra types:
-
combo
- list of options (rendered as combo box)
Combo type requires using additional property called items
:
items: [
{
label: "Option 25", value: 25
}, {
label: "Option 50", value: 50
}, {
label: "Option 100", value: 100
}
]
-
button
- action button, triggers a method (rendered as button)
Required property is callback
, which specifies method name as a String
. The method has to be public and it gets called when the button is pressed. label
is optional – button will get its "decamelized" method name.
##Optional properties:
step: 0.1
You can set a snapping step for your value to be rounded. This property only applies to numerical types.
mode: "readonly"
Setting readonly
would prevent updating Filter values on UI change. You can use it to debug values that are set automatically by the Filter code.