Setting Repeats using While

Document created by Chris Sommerstad Employee on Jul 21, 2017
Version 1Show Document
  • View in full screen mode

Repeat using While - Repeat until stopped

The first example of using repeat type "While" demonstrates the basic idea behind repeat While, which is that whatever is repeating will keep repeating so long as the property evaluates to true. A property evaluates to true if it contains the string true or if it is a non-zero numeric value. Anything else is considered false and the repeat will stop. Typically, there would be something inside the repeat that would cause that property to be set to false so that it will stop repeating.

In this case, the composition contains a single clip that consists of a number of slow messages that has a repeat While that repeats based on a custom property in the track whose name is Always True. When the composition plays, it will run until it is stopped.

This property is called Always True because it is initialized to the word true and there is nothing in the composition that changes it.

The composition will run forever unless it is stopped. This technique can have some practical uses, such as preventing the need to use a large number of repeats to achieve long play.

When Stop is pressed the Stop dialog box appears.

Note: The While repeat could also run off a global property, which could then be used to stop the composition. Using this method, the Stop would happen at a natural point via the Global Property Editor and at the end of a clip's play cycle (since While is performed at the beginning of a clip's play) unlike when the Stop button is used and the composition is stopped .

A While repeat can only be used with serial repeats since parallel repeats start all at once (in which context While has no meaning). Since tracks use parallel repeats only at this time, While can only be used with clips and those that repeat serially.

Repeat using While - Increasing Responses

The second example defines a composition that repeats as long as the response times are below a set value. The Increasing response times clip uses a message and a script that detects any Max Response Time above 700ms to set a track property to false and stop play. The composition will repeat so long as the response times stay below a set value. If any response time exceeds the set value, the composition will stop naturally at the end of the current clip play.

The "Increasing response time" clip has been set up to have messages that will gradually increase their response time and an increase of the current repeat index by 10 per play.

The script in the clip is going to look at the response time of the previous message and, if greater than 700s, will set a track property called While control to false.

The clip in the composition has the repeat type of "While".

The While control track property is initialized to true but is set to false as soon as the script detects a response time that exceeds the specified value (700ms).

When the composition is played, it will continue to play until the While control track property is set to false (exceeding 700ms in our example).