For Next Loops give you the ability to execute a statement over and over again, until a defined condition
is reached.
A for loop has this format:
for ( initialization; condition; change of condition )
{
statement;
statement;
...
}
A for loop evaluates the termination condition before executing each statement . The condition compares
variable, attribute, or constant values.
Example for string variables and For Next Loops.
for ( i = 1; i <= 100; i = i + 1 )
{
$object = "Block_copy_" + i;
if ( frame + 1 == i )
{
$object.Visibility = 0;
}
else
{
$object.Visibility = 1;
}
};
Each time the loop executes again it will be executed for the next Cube_copy_ object. It starts with Cube_copy_1
if i = 1. If i = 2 it will be executed for Cube_copy_2 and so on until Cube_copy_100 is reached and than stop.
Since i also changes in the number of the frame for the visibility switch the expression will switch off the visibility
of the different cubes also on different frames, resulting in a flowing behavior in the visibility switching of the objects.
get project 100_cubes.prj |