The loop command allows you to repeat button actions a set number of times. Everything should work with the loop command except user inputs - which are dealt with before all other button actions. The command and parameters are;
- start=<starting number>
- end=<end number>
- step=<loop counter increment>
A special loop counter variable is created ( $@ ) which you can use in your commands.
The following commands were used for a wave effect. There are five boxes (color sources) at the bottom of the screen (Box1 ... Box5). The boxes are side by side, filling the width of the screen.
Create a loop for the 5 boxes
Move boxes upwards
delay=[$@ * 100]
Move boxes back down
To create the wave effect, each box has a slightly longer delay before it starts to move - using the loop couter variable $@ multiplied by 100 (millisecs). Note that the animation queue is enabled for each object so that any animation performed on it is finished before another begins. Also note the brackets around the change to the y position : indicating that the change is relative to its current position.
Since the animation queues are enabled, we can simply animate the box back to its original position - this animation will trigger when the previous animation is complete.