Supported mathematical functions in Expressions
As well as addition, subtraction, multiplication and division, Expressions also support a number of standard mathematical functions. These are:
sin(x) - Sine of the angle x, where x is measure in radians
cos(x) - Cosine of the angle x, where x is measure in radians
tan(x) - Tangent of the angle x, where x is measure in radians
asin(x) - Inverse sine of the angle x, where x is measure in radians
acos(x) - Inverse cosine of the angle x, where x is measure in radians
atan(x) - Inverse tangent of the angle x, where x is measure in radians
atan2(y, x) - Angle in radians bewteen the positive x axis and the x/y co-ordinate supplied
exp(x) - Exponent of x
log(x) - Natural logarithm of x
log10(x) - Base 10 logoarithm of x
sqrt(x) - Square root of x
pow(x, y) - Raise x to the power y
abs(x) - Absolute value of x, ie: ignores the sign
floor(x) - Round x down to nearest whole integer
ceil(x) - Round x up to nearest whole integer
max(x, y) - Returns maximum value of x and y
min(x, y) - Returns minimum value of x and y
clamp(x, min, max) - Limits x to within the range min to max
radians(x) - Converts x from degrees to radians
degrees(x) - Converts x from radians to degrees
There are also a number of mathematical constants defined. These are human readable strings that may be used as a shorthand replacement for the numbers that they represent. They are:
pi - The value of PI. Equal to 3.14159265
e - Euler's number. Equal to 2.71828183
Modular Division
% - Operator for getting the remainder of two numbers (E.G. 5 % 2 == 1)
idiv(x,y) - integer division (idiv(5,2) == 2)
Prefixes
limit:: - Limits result to min max range of field
scale:: - Scales 0 - 1 values to lie within min max range.
Special Values
self - keyframed value (expression defaults to this).
self.min - minimum value for this field
self.max - maximum value for this field
Time - track time in seconds
Uptime - time since Disguise started in seconds
Or
"Or" Expressions work on an LTP basis so you are able to keyframe a value, but also have external control of it (self_or_dmx:1.1 for example).
This is useful when you have a Notch effect that you wish to interact while also having the flexibility so that when the timeline jumps to a cue point where it is keyframed, that takes precedence and the dmx value reacts accordingly.
-
step(y,x)resolving to (x >= y) ? 1 : 0 -
lerp(x,y,s)resolving to (x * (1.0 - s)) + (y * s) and an expression variable for checking DMX validity (DMX data has been received within a 10s timeout): -
valid_dmx:<universe>.<channel>(1-based like the old dmx:<universe>.<channel>)Example: Set the following expression on Colour X or Y to have DMX take over control of that field: "
lerp(self, dmx:1.3/255, valid_dmx:1.3)"This essentially gets you LTP relationship to incoming DMX.
-
For HTP, use this expression
max(self, dmx)