Function
Called in process, the functions are usualy used for:
- Animation
- Motion
- Operation on creation
A function is specified by:
- The result format: float (1d), point (2d), vector (3d), string, etc.
- The property affected: attribute, param, motion, etc. See details Function Call
- The variable: frame for temporal function, ratio or curv for curvilinear function. See details Function with variable
Function Call
A function can be called in a process to affect an attribute, a param, a motion, a path, a velocity.
Attribute
The function call is typed into the attribute value.
example: declare a creation
<Layer type="image" creationId="declare(output1.jpg, output1, group1)">
Param
Like the attribute call, some function calls can be typed into the param value.
example: create a texture map from a creation id
<Object create="object" name="sphere">
<Param name="class">sphere</Param>
<Param name="radius">10</Param>
<Param name="pos.x">80</Param>
<Param name="material.class">standardMaterial</Param>
<Param name="material.diffuseMap">map(wood)</Param>
</Object>
Some function calls, especially temporal functions, can be call with the FuncParam node.
example: animate a blend modifier
<Object create="object" name="teapot">
<Param name="class">teapot</Param>
<Param name="radius">10</Param>
<Param name="bend">modifier</Param>
<FuncParam name="bend.bendAngle" type="square" frames="0-100">
<Param name="begin">0</Param>
<Param name="end">30</Param>
</FuncParam>
</Object>
The FuncParam call is defined by:
- The <FuncParam>...</FuncParam> tag
- The name attribute: the name of the param to be affected
- The type attribute: the function identifier
- The Param list: the params used to define the function, according to the type
For a temporal function:
- The frames attribute: the frame sequence. See details Render Frames Temporal Function
For a curvilinear function:
- The curv attribute: the curvilinear abscissa value. See details Curvilinear Function
- The ratio attribute: the curvilinear ratio. See details Curvilinear Function
example: a path function
<Object create="object" name="teapot">
<Param name="class">teapot</Param>
<Param name="radius">10</Param>
<FuncParam name="pos" type="path" ratio="0.5">
<Param name="path">spline1</Param>
</FuncParam>
</Object>
Motion
Some functions are used to define a motion.
example: a rotation motion
<Object create="object" name="teapot">
<Param name="class">teapot</Param>
<Motion name="m1" coord="rot" type="rotate" frames="1-100/11">
<Param name="begin">0;0;0</Param>
<Param name="end">0;0;180</Param>
</Motion>
</Object>
The Motion function is defined by:
- The <Motion>...</Motion> tag
- The name attribute: the motion name
- The coord attribute: the coord of the object to be affected (pos, rot, etc.)
- The type attribute: the motion function type
- The frames attribute: the frame sequence. See details Render Frames
- The Param list: the params used to define the function, according to the type
Path
Some functions are used to define a path.
example: a segment path
<Camera create="target" name="camera">
<Param name="target">0;0;0</Param>
<Param name="fov">60</Param>
<Motion name="m1" coord="pos" frames="1-50/6">
<Path name="p1" type="AtoB">
<Param name="begin">-50;100;0</Param>
<Param name="end">0;100;0</Param>
</Path>
</Motion>
</Camera>
The Path function is defined by:
- The <Path>...</Path> tag
- The name attribute: the path name
- The type attribute: the path function type
- The Param list: the params used to define the function, according to the type
Velocity
Some functions are used to define a velocity.
example: a sinusoidal velocity
<Object create="object" name="teapot">
<Param name="class">teapot</Param>
<Motion coord="rot" type="rotate" frames="1-100/11">
<Param name="begin">0;0;0</Param>
<Param name="end">0;0;180</Param>
<Velocity name="v1" type="sinus" frames="1-100">
<Param name="repeat">2</Param>
<Param name="mirror">true</Param>
</Velocity>
</Motion>
</Object>
The Velocity function is defined by:
- The <Velocity>...</Velocity> tag
- The name attribute: the velocity name
- The type attribute: the velocity function type
- The frames attribute: the frame sequence. Ssee details Render Frames
- The Param list: the params used to define the function, according to the type
Function with variable
The function result can be depended on a variable, like frame for temporal function, ratio or curv for curvilinear function
Temporal Function
The result depends on a frame variable.
In the function call, the frames attribute defines a frame sequence. See details Render Frames Function Call
example I: animate a squash deformer
<Object create="object" name="sphere">
<Param name="class">sphere</Param>
<Param name="radius">2</Param>
<Param name="squash">deformer</Param>
<FuncParam name="squash.factor" type="square" frames="0-100">
<Param name="begin">-0.3</Param>
<Param name="end">1</Param>
<Param name="mirror">true</Param>
<Param name="repeat">2</Param>
</FuncParam>
</Object>
example II: a rotation motion
<Object create="object" name="teapot">
<Param name="class">teapot</Param>
<Motion name="m1" coord="rot" type="rotate" frames="1-100/11">
<Param name="begin">0;0;0</Param>
<Param name="end">0;0;180</Param>
</Motion>
</Object>
See details "Temporal Function"
Curvilinear Function
The result depends on a ratio or a curv variable.
- curv: curvilinear abscissa. Value: 0 to curve total length.
- ratio: curvilinear abscissa ratio. Value: 0 to 1.
a 2d curvilinear function
example: a path function used to position a camera
<Camera name="camera">
<Param name="fov">60.0</Param>
<FuncParam name="pos" type="path" ratio="0.5">
<Param name="path">p1</Param>
</FuncParam>
</Camera>
<Path name="p1">
<Point name="0" in="-111;66;-2" out="-107;38;5">-111;66;-2.</Point>
<Point name="1" in="-98;14;11" out="-67;-20;21">-82;-3;16</Point>
...
...
</Path>
viewport
Temporal & Curvilinear Function
A function can be a combinaison of temporal & curvilinear function.
combinaison:
For example, Motion is a temporal & curvilinear function, composed by a velocity and a path function. See details "Overview"
example: a motion composed by a segment path and a square velocity
<Motion name="m2" coord="pos" frames="51-100">
<Path type="AtoB">
<Param name="begin">0;100;0</Param>
<Param name="end">0;150;0</Param>
</Path>
<Velocity name="v1" type="square" frames="51-100" />
</Motion>