Animating with the Channel Editor > Expressions > Defining Your Own Functions >
Defining a Function

A function is composed of a function name, with the list of arguments, and the expression that forms its definition. You start a function by its name, followed by an opening parenthesis, the arguments for the function separated by commas, and finally a closing parenthesis. The following rules apply for function and argument names:

- The first character of a function name must be a letter, and subsequent characters can only contain letters or numbers. For example, sin100 is a valid function name, although 100sin is not.
- The first character of an argument must be a dollar sign ( $ ), the second character must be a letter, and subsequent characters can only contain letters or numbers. For example, $arg1 is a valid argument name, although $1 and arg3 are not.
- Function names and arguments are case sensitive, meaning that lowercase and uppercase make a difference.

The function name and its definition are separated by a colon ( : ). The definition itself can be any valid expression, except that channel names are not accepted since user-defined expressions are not related to any particular setup. In the definition, the arguments can appear, complete with the dollar sign preceding it. Finally, the definition must end with a semicolon (;) and it can span several lines.

NoteErrors in the functions file will be reported when it is first read. This file is read every time that an unknown function is used in an expression.