modo bubbble logo

Expression Modifier

Home >> Rigging & Animation >> Modifiers >> Expression

back next

Linear BlendExpression--
The 'Expression' channel modifier allows users to use various mathematical and logical operators to define an output value based on the inputs. Expressions are especially useful in creating complex animations that dont require any keyframes, making them are easy to adjust and update. This modifier uses the muParser expression engine.

Input A/B/C/D: User defined input variables. Each is a float value, defined by its variable name- A, B, C or D.

Expression: This is the expression that will be executed based on the defined inputs. For example, "A" would pass the value coming in on the inputA channel to the output channel. "A+B" would add the values coming in on the inputA and inputB channels and set the sum to the output channel. You can also use the built in functions. "sin(A)" would output the sin value of inputA to the output. You also have the option of conditionals. "A>B?C:D" would result in the value in inputC being sent to the output if A is greater then B. If not, the value in inputD is sent to the output.

Output: The output value will be the value returned by the user defined expression string.

User Defined Channels: Any user added channel to the expression node can be used in the expression string. For example, If you add a float channel called, "test", you can then use the name "test" in your expression like "sin(test)"


Built-in Function--
The following table gives an overview of the functions supported by the default implementation. It lists the function names, the number of arguments and a brief description.

Name   Meaning
sin   sine function
cos   cosine function
tan   tangens function
asin   arcus sine function
acos   arcus cosine function
atan   arcus tangens function
sinh   hyperbolic sine function
cosh   hyperbolic cosine
tanh   hyperbolic tangens function
asinh   hyperbolic arcus sine function
acosh   hyperbolic arcus tangens function
atanh   hyperbolic arcur tangens function
log2   logarithm to the base 2
log10   logarithm to the base 10
log   logarithm to the base 10
ln   logarithm to base e (2.71828...)
exp   e raised to the power of x
sqrt   square root of a value
sign   sign function -1 if x<0; 1 if x>0
rint   round to nearest integer
abs   absolute value
min   min of all arguments
max   max of all arguments
sum   sum of all arguments
avg   mean value of all arguments
noise   noise value takes 1..3 aguments
floor(x)   maps x the largest previous integer. i.e. 3.5 becomes 3
ceil(x)   maps x to the smallest following integer. i.e. 3.5 becomes 4

Built-in Binary Operators
The following table lists the default binary operators supported by the parser.

Operator   Meaning Priority
=   assignment * -1
&&   logical and 1
||   logical or 2
<=   less or equal 4
>=   greater or equal 4
!=   not equal 4
==   equal 4
>   greater than 4
<   less than 4
+   addition 5
-   subtraction 5
*   multiplication 6
/   division 6
^   raise x to the power of y 7

*The assignment operator is special since it changes one of its arguments and can only by applied to variables.

Other Operators
muParser has built in support for the if/then/else operator. It uses 'lazy' evaluation in order to make sure only the necessary branch of the expression is evaluated.

Operator Meaning Remarks
?: if then else operator C/C++ style syntax


comment balloon Comments (1) RSS Icon

funk August 13, 2014 at 7:00 AM

801 SP2 adds some new features:
Expression Node: Adds 'mod()' and ‘clamp()’ functions to the expression node.


back next