Create a simple slider Rule
Compose a simple Rule, using a slider that controls the trunk height of an existing tree model.
Read time 2 minutesLast updated 2 hours ago
This procedure builds a single slider that adjusts the trunk height of an existing tree model, working up through the following sections.
Create a slider
-
From the menu, select Window > Rules.
-
In the script editor of the Rules window, compose the following statement:HeightValue = rule("Height", 45.0, 20.0, 80.0)
-
Click anywhere outside the Rules window.
The UI section of the Rule window displays a slider named Height. The slider allows you to change the value of a variable named between and and the default value is .
HeightValue208045Make the slider control the trunk height
-
Select the Trunk generator of the tree.
-
In the Property Bar, select the Spine tab.
-
Under Spine > Length, right-click on the Absolute property and select Copy edit line for script.
-
Under the first statement you composed in the Rule editor, paste the copied information:HeightValue = rule("Height", 45.0, 20.0, 80.0)set_property_value("=Trunk", "Spine:Length:Absolute", VALUE)
-
Update theparameter of the
VALUEfunction to match the Rule's variable name (set_property_value):HeightValueHeightValue = rule("Height", 45.0, 20.0, 80.0)set_property_value("=Trunk", "Spine:Length:Absolute", HeightValue) -
Click anywhere outside the Rules window.
When you adjust the slider, the trunk of the tree gets longer or shorter.