User Guide

CHAPTER 10
328
Creating Expressions
Nothing seed_random(n) {n is a number} This expression takes the existing seed and
increments it by the argument. Use it when you don’t like the results you get from random
or gauss_random. For example, “seed_random(3); random(10,20)”.
Number noise(val) {val is a number or an array [2 or 3]} This returns a number between
0 and 1. Noise is not actually random, but is used when you want a seemingly random
number with some correlation between nearby samples. It is based on Perlin Noise (see a
computer graphics reference book for more information). For example, “add(position,
[noise(position)*50])”.
Interpolation methods
Number or Array linear(t, val1, val2) {t is a number, and val1 and val2 are numbers or
arrays} The resulting value linearly interpolates from val1 to val2 as t ranges from 0 to 1.
When t is l <= 0, the result is val1, and when t is >= 1, it is val2.
Number or Array linear(t, tmin, tmax, val1, val2) {t, tmin, and tmax are numbers, and
val1 and val2 are numbers or arrays} When t <= tmin, the output is val1. When t >= tmax,
the output is val2. While tmin < t < tmax, the resulting output is a linear combination of
val1 and val2.
Number or Array ease(t, val1, val2) {t is a number, and val1 and val2 are numbers or
arrays} Similar to linear, except that the interpolation eases in and out so that the velocity
is 0 at the start and end points. This method results in a very smooth animation.
Number or Array ease(t, tmin, tmax, val1, val2) {t, tmin, and tmax are numbers, and val1
and val2 are numbers or arrays} Similar to linear, except that the interpolation eases in and
out so that the velocity is 0 at the start and end points. This method results in a very
smooth animation.
Number or Array ease_in(t, val1, val2) {t is a number, and val1 and val2 are numbers or
arrays} Similar to ease, except that the tangent is 0 only on the val1 side and is linear on
the val2 side.
Number or Array ease_in(t, tmin, tmax, val1, val2) {t, tmin, and tmax are numbers, and
val1 and val2 are numbers or arrays} Similar to ease, except that the tangent is 0 only on
the tmin side and is linear on the tmax side.
Number or Array ease_out(t, val1, val2) {t is a number, and val1 and val2 are numbers or
arrays} Similar to ease, except that the tangent is 0 only on the val2 side and is linear on the
val1 side.
UG.book Page 328 Wednesday, February 21, 2001 12:05 PM