param

<param> tags are used to make a model parametric, providing parameters to control and customize various aspects of this model.

The basic form is:

<param name="..." type="..." value="..."></param>

It defines a parameter by the given name of the given type, which defaults to the given value.

Here are some examples of defining parameters:

<!-- 'headRadius' parameter, which is a number, default value is 15 -->
<param name="headRadius" type="number" value="15"></param>

<!-- 'height' parameter, which is a number, default value is 5 -->
<param name="height" type="number" value="5"></param>

<!-- 'label' parameter, which is a string, default value is "hello" -->
<param name="label" type="string" value="hello"></param>

Once defined, parameters can be used within a {{ ... }} expression, in a way similar to a number of popular HTML template engines such as Mustache, Handlebars, and Nunjunks.

Here are some examples of using parameters:

<!-- a cylinder whose radius is controlled by the 'headRadius' parameter -->
<cylinder radius="{{headRadius}}"/>

<!-- a Javascript expression can be written inside {{  }} -->
<cylinder radius="{{headRadius/2 + 2}}"/>

<!-- can be used to compose a transform expression -->
<cylinder t="size xy {{headRadius}} z {{height}}"/>

Below is a live example putting these together: