DirectX Media for Animation Java Reference Previous
Previous
Classes
Classes
Index
Index
Next
Next

ArrayBvr Class

Methods

public class ArrayBvr extends Behavior {
     // Methods
     public int length();
     public Behavior nth(NumberBvr a);

}

Selects an object based on a time-varying index. The following example constructs an ArrayBvr out of a Java array and uses the nth method with a time-varying parameter to cycle through the list of colors:

...ColorBvr[] arr = {red, green, blue, yellow, green, cyan, magenta};
ArrayBvr arrBvr = new ArrayBvr(arr);

//Build an indexer to repeatedly go from 0 to (length - 1)
//at a rate of 1 unit per second
NumberBvr indexer = mod(localTime, toBvr(arr.length - 1));

//Use indexer to index into the ArrayBvr
ColorBvr cyclingCol = (ColorBvr)arrBvr.nth(indexer);

...


Methods


length

public int length();

Finds the length of an array behavior.

Return Value:

Returns an integer number that is the length of an array behavior.


nth

public Behavior nth(NumberBvr a);

Selects a Behavior object based on the time-varying value of a NumberBvr. It uses the greatest integer value less than the number's value to determine the index. An array's index begins at 0 and any attempt to index beyond its length results in a runtime error.

Return Value:

Returns the Behavior object.

ParameterDescription
a The NumberBvr object used as an index into the array behavior.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.