Wednesday, March 12, 2008

Shake Tip: Expressions

Here's some info I gleaned from the interweb. In addition there's a DVD by Gnomon Workshop called "Expressions and Scripting with Matt Linder." That guy is a genius.

Any parameter can be an expression. You just type the expression into where the number would go, and you get a little + sign which you can expand to show the text of the expression.

the noise() function is a good one for you here. It takes a parameter, which should be based around the time...

So for something to vary between 0 and 1, put:

noise(time)

To slow it down to half the speed, use:

noise(time / 2)

To make it between 0 and 5:

5 * noise(time / 2)

Or between 5 and 10:

5 + (5 * noise(time / 2))

To find out what functions are available to you, find your shake install folder, and look in the "include" folder in there (if you're on OSX, you may have to do "Expand Package Contents" or whatever it's called)

In that folder, there should be a file called 'nreal.h'. This has the definitions of all of the functions that you can use in Shake. This includes both functions like noise() and also nodes (which are actually just functions that return an image). This'll give you a good idea of what's available for use in expressions.

Also, the Shake manuals "Expressions and Scripting" section is rather helpful and much more complete compared to many other applications out there.

No comments: