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

# Sample Function Definitions

The following sample functions are found in the functions file that is installed with Smoke.

- This function creates a sine curve for a given channel that oscillates between 0 and 100. The sin100 function takes one argument, named $arg1, that it uses in conjunction with the predefined sin function. The return value for sin100 is the sine of $arg1 times 50, plus 50.

  sin100($arg1) : sin($arg1)*50 + 50;

- This function creates a sine curve based on the specified frequency and amplitude. The sinfreqamp function takes three arguments, named $pos, $freq and $amp.

  sinfreqamp($pos,$freq,$amp) : sin($pos*$freq)*$amp;

- This function provides an approximation of the speed, or more precisely, the derivative (rate of change), of a given channel. The speed function takes one argument, named $channelName.

  speed($channelName) :eval($channelName,frame+0.1) -

  eval($channelName,frame-0.1))/0.2;

NoteFor information on the other example functions in the functions file, see Slip Functions and Rounding Functions.