module: attribute
Attributes allow you to change parameters of your pattern while the pattern is running from the web interface, this helps create more dynamic and customizable patterns
class: RangeAttr
For when you want a range of values
from attribute import RangeAttr
RangeAttr(name: str, value: float, min: float, max: float, step: float)
Name is the displayable name for the attribute, value is a default starting value, min & max are self explanitory and step is the resolution for the range
Attributes should only be instantiated within the run function, once
1
2
3
4
...
def run():
speed = RangeAttr("Speed", 5, 1, 10, 1)
...
get() -> float
Get the current value of the attribute
1
2
3
4
5
...
def run():
speed = RangeAttr("Speed", 5, 1, 10, 1)
print(speed.get())
...
set(value: float)
set the value of the range, this would be rarely used in a pattern
class: ColorAttr
for when you want a dynamic color
from attribute import ColorAttr
RangeAttr(name: str, value: Color)
Name is the displayable name for the attribute, value is a default starting value
Attributes should only be instantiated within the run function, once
1
2
3
4
...
def run():
first_color = ColorAttr("First Color", Colors.red())
...
get() -> Color
Get the current value of the attribute
1
2
3
4
5
...
def run():
speed = ColorAttr("Speed", 5, 1, 10, 1)
print(speed.get())
...
set(value: Color)
Set the value of the color, this would be rarely used in a pattern