Document Developer - instructions > Scripting > Scripting examples > Repeating an arrow that changes color and rotation

Repeating an arrow that changes color and rotation
You can repeat an arrow inline in a Story frame while it rotates and changes color. The output looks like this:
Click to enlarge
Figure 38
To achieve this you create the following structure in a Story:
Click to enlarge
Figure 39
A Story frame containing this story has the script shown below attached to it, creating a $counter array with 23 values, from 0 to 22. The Repeater has an XPath set on it pointing to the $counter array. This means the arrow repeats 23 times.
Example 30
$count = 23;
$i = 0;
while( num($i) < num( $count ) )
{
	   $counter[$i] = $i;
	   $i++;
}
$i = 0;
 
The script below is set as a before script on the Text area within the repeater containing the arrow. This script uses the StSetProperty() script functions to:
Example 31
$value = num($i) * 11;
stSetProperty("Rotation", $value );
stSetProperty("FillColor", "30:" + $value + ":" + str(255 - num( $value ) ) );
$i++;
 
The substitution inside the arrows displays the rotation in degrees ($value) for each arrow.
OpenText StreamServe 5.6 Updated: 2013-03-01