# Functions

Xfrog software offers many parameters that can make use of equations or functions. Even if you are not really a fan of math, you should keep the use of functions in your mind, because they can be real time savers.

Below you will find a list with descriptions and examples of the different functions. Especially functions like rnd (random), i (iteration), t and f (time and frame) are extremly helpful.

The horizontal axis always shows the input values, that you specify with sliders. The vertical axis shows the result.

An example: please take a look at the sin function. If you enter a value of zero, the result is zero. If you enter a value of pi/2 (1.57), then the output will be 1. If you use -pi as start value (first slider) and pi as end value, then the result will be a wavelike curve.

Please also have a look at these workshops:

Xfrog for Maya: Abstract animation Workshop

Xfrog for C4D: Waves, Iteration and more Workshop

Xfrog for Windows: Function Workshop

### id

id leaves the input values untouched, values of sliders are directly used.

### sine

The sine function is a trigonometric function, the results are limited between -1 and 1.

With start value -pi (-3.142) and end value pi (3.142) you produce one cycle of a wave.

If you double the input range (from -6.284 to 6.284), then you will get two waves.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows: Example one | Example two

### cos

Similar to the Sine function, only the phase is different.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### tan

Tangent belongs (like cos and sin) to the trigonometric functions. Depending on the input range, you will get repeated jumps. The closer the input approaches, the higher the output will be. Actually, you would get a infinite high number exactly at pi/2 !. If you then move a little bit on, the output drops to a very small value and starts growing again.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows: Example one | Example two

### asin

Arc sine is the inverse function of sine.

Input values range from -1 to 1

Output from -pi/2 to pi/2.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### acos

Arc cosine is the inverse function of cosine.

Input values range from -1 to 1

Output from 0 to pi.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### atan

Arc tangent is the inverse function of tangent.

Input values range from -infinite to infinite

Output from -pi/2 to pi/2.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### sinh

This function is called Sine hyperbolic.

Input values range from -infinite to infinite

Output from -infinite to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### cosh

This function is called Cosine hyperbolic, it is capable of describing the path of a rope hanging between two points

Input values range from -infinite to infinite

Output from 1 to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### tanh

This function is called Tangent hyperbolic.

Input values range from -infinite to infinite

Output from -1 to 1.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### exp

A function based on Eulers number, often used to describe growth processes.

Input values range from -infinite to infinite

Output from 0 to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### exp2

A function based on Eulers number.In this case its exp multiplied by itself.

Download examples:

Xfrog for Windows

### log

Logarithm is the inverse function of exponantial.

Input values range from 0 to infinite

Output from -infinite to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### sqr

Square of a number. A number multiplied with itself (x*x).

Input values range from -infinite to infinite

Output from 0 to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### sqrt

Square root is (simplified!) the inverse function of square.

Input values range from 0 to infinite

Output from 0 to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### ceil

Ceiling, returns the smallest integer greater or equal than x.

Input values range from -infinite to infinite

Output from -infinite to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### floor

Floor works similar to ceiling, it just returns the greates integer smaller or equal than x.

Input values range from -infinite to infinite

Output from -infinite to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### rndabs

x is multiplied with a random value between 0 and 1: (x*abs(rnd(1)))

Input values range from -infinite to infinite

Output from -infinite to infinite.

Download examples:

Xfrog for Windows

### rnd

Produces a random value.

Input values range from -infinite to infinite

Output from -infinite to infinite.

Download examples:

Xfrog for Windows

### abs

Returns the absolut value of x (always positive).

Input values range from -infinite to infinite

Output from 0 to infinite.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### phi

x is multiplied with the value of golden section: x*1.618034.

Input values range from -infinite to infinite

Output from -infinite to infinite.

Download examples:

Xfrog for Windows

### clamp

This function can be used to clamp values.

Input values range from -infinite to infinite

Output from -infinite to infinite.

Download examples:

Xfrog for Windows

### smooth

The input value is smootly clamped between 0 and 1.

Input values range from -infinite to infinite

Output from 0 to 1.

Download examples:

### pi

x is multiplied with the value of pi: x*3.1415.

Input values range from -infinite to infinite

Output from -infinite to infinite.

Download examples:

### iter / i

This function is independent from slider inputs. Instead it returns the so called iteration number.

Example: a horn component with iter function in rotation settings, parent is a tree component. The horn is multiplied by the tree. The first horn get´s iteration number zero, the second horn gets iteration number one, the third horn get´s iteration number two and so on. If the tree produces 20 child objects, then the last horn will get iteration number 19.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### ftime / t

This function is time dependent. It returns values between zero (start of animation) and one (end of animation).

Press play when testing example file.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### frame / f

This function is time dependent. The value returned by frame is equivalent to the actual frame.

Press play when testing example file.

Download examples:

Xfrog for Maya

Xfrog for C4D

Xfrog for Windows

### u

This function returns a gradient value between 0 and 1. Example: In earlier versions you had to use sin(x) and use the control curve to create a sin curve. This works fine, but the control curve is “wasted” for a simple task. Now you could use sin(u) and still have the control curve for finetuning. You could control the strength of the sin curve (sin(u)*x) or the frequency (sin(u*x)).

Download examples:

Xfrog for Maya

Xfrog for C4D

### noise

This function returns pseudo random values between 0 and 1. Pseudo random because the same number inside noise always will return the same output. That´s important for rendering via network.

Example: By combining noise and i (iteration), you can create a tree that “produces” different looking branches. Use the Curvature Spline inside the child branch object, then use something like noise(i) inside one of the Rotation parameters. Because every branch get´s a different iteration number, the output of noise for every branch will be different.

Download examples:

Xfrog for Maya

Xfrog for C4D

### rad

This function can be used to convert from degrees to radians angles. Example: If you enter 180, you will get 3.1415 as result .