The var keyword declares a state variable, whose value is accessible throughout the rest of the code and may be modified by events. The value of a state variable will persist inbetween animation frames and even script reloads. Its syntax can be one of:

var <type> <name>;
var <type> <name> = <initial value>;

<type> is the type of the variable. If <initial value> is not specified, it will be zero-initialized.


var vec3 cubePosition = vec3(1.25, 0.0, -2.0);