A named, ranged lab parameter, auto-registered with Lab. More...
| Import Statement: | import Clayground.Lab |
Declare one per tunable quantity and bind your system to value. ParamPanel builds its sliders from all registered parameters; agents set values via Lab.set(name, value).
A parameter remembers the value it was declared with (defaultValue), so reset() - or Lab.resetParameters() for all of them - puts it back without reloading the lab.
Example usage:
import Clayground.Lab Parameter { id: pGravity; name: "gravity"; value: 9.81; from: 0; to: 30; unit: "m/s²" }
See also Lab and ParamPanel.
defaultValue : real |
The value the parameter was declared with; reset() returns to it.
Left unset, it is taken from value the first time the kernel needs it: when the parameter completes, or earlier when Lab.set() changes it first - a sandbox root's Component.onCompleted runs before its children's, so a scenario it opens there may set a parameter that has not completed yet. Set it explicitly to reset to another value than the declared value.
description : string |
One-line explanation shown as tooltip/annotation.
from : real |
Lower bound of the value range.
name : string |
Unique name used by Lab, ParamPanel and agents.
stepSize : real |
Slider step (0 = continuous).
to : real |
Upper bound of the value range.
unit : string |
Display unit, e.g. "m/s²".
value : real |
Current value; bind your system to this.
void reset() |
Sets value back to defaultValue.
Assigns a plain number, so a value that was bound to an expression stays at that expression's declared result rather than following it.