DirectAnimation Animated Header --ArrayBvr Class DirectAnimation Animated Header --ArrayBvr Class* Microsoft DirectAnimation SDK
*Contents  *Index  *Topic Contents
*Previous Topic: AppTriggeredEvent Class
*Next Topic: Bbox2Bvr Class

ArrayBvr Class


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

     public static ArrayBvr newUninitBvr(ArrayBvr arr);
}

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);

...

ArrayBvr Methods

bullet1.giflength

bullet1.gifnth

bullet1.gifnewUninitBvr


length

ArrayBvr Class

Finds the length of an array behavior.

public NumberBvr length( );

Return Values

Returns a NumberBvr object that is the length of an array behavior.


nth

ArrayBvr Class

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.

public Behavior nth(
  NumberBvr a
  );

Parameters
a
The NumberBvr object used as an index into the array behavior. This parameter can also be of type double.
Return Values

Returns the Behavior object.


newUninitBvr

ArrayBvr Class

Makes it possible to refer to an array behavior before that behavior has been defined. With this method, a behavior can be created and used in the definition of other behaviors, while its contents are defined at some later point. (This definition is accomplished with the init method, which is available on all behaviors.)

public static ArrayBvr newUninitBvr(
  ArrayBvr arr
  );

Parameters
arr
Used to establish what type the array holds.
Return Values

Returns the ArrayBvr object.

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page