DAStatics Functions Relevant to DABehavior Objects

Cond Creates a new behavior from the DABoolean and two other behaviors.
ModifiableBehavior Returns an object whose animated behavior can be replaced at run time with another animated behavior.
Sequence Creates a new behavior that is the sum of the two DABehavior objects.
SequenceArray Creates a new behavior that, when started, will play multiple DABehavior objects in the order they appear in the array.
Until Creates a behavior that changes when a given event occurs. Up to and including the time the event occurs, the behavior is the same as a.
UntilEx Creates a DABehavior that changes upon a given event.
UntilNotify Creates a behavior that changes upon the given event to the behavior specified in the DAUntilNotifier Notify method.
UntilNotifyScript Creates a behavior that changes upon the given event to the behavior in the specified script procedure.

Cond

DAStatics Class

Creates a new behavior from the DABoolean and two other behaviors. The value of the new behavior, at any point in time, is one of those two behaviors. Which behavior is chosen depends on the value of the DABoolean.

Syntax

lib.Cond( bool, a, b )

Parameters

bool
DABoolean object that determines which of the two behaviors will become the value of the new behavior.
a
First of the two possible values the new behavior can assume.
b
The second of the two possible values the new behavior can assume.

Return Value

Returns the DABehavior object.

Remarks

The following example is taken from the FrameRate.html sample found in the Samples/Multimedia/Danim/Jscript/Showcase subdirectory.

    lineStyle = m.Cond(m.LeftButtonState, m.DefaultLineStyle, m.EmptyLineStyle);

ModifiableBehavior

DAStatics Class

Returns an object whose animated behavior can be replaced at run time with another animated behavior. This is useful when the states of an animation model cannot be predicted at development time, and when integrating animation models with other events and functions.

Syntax

lib.ModifiableBehavior( initialBehavior )

Parameters

initialBehavior
Behavior that will later be replaced.

Return Value

Returns the DABehavior object.

Remarks

The following example is taken from the VideoWall.html sample found in the Samples/Multimedia/Danim/Jscript/Showcase subdirectory.

  changeFactor = m.ModifiableBehavior( m.DANumber(2) );

See Also

SwitchTo(newBehavior)

Sequence

DAStatics Class

Creates a new behavior that is the sum of the two DABehavior objects. The two behaviors are concatenated according to their order in the parameter list. Once the duration is over, the behavior becomes a snapshot of the second behavior. An exception is when the first behavior is of infinite duration. In this case, the returned behavior is always the infinite behavior.

Syntax

lib.Sequence( a, b )

Parameters

a
First behavior in the sequence.
b
Second behavior in the sequence.

Return Value

Returns the DABehavior object.

Remarks

Notice that, in contrast to Compose2 and Compose3, which first apply the right-hand argument and then the left, Sequence first applies the left-hand argument and then the right.

The following example is taken from the AnimatedGlow.html sample found in the Samples/Multimedia/Danim/Jscript/Exercises subdirectory.

  // Create a time varying number
  glow = m.Sequence(m.Interpolate(0,5,1), m.Interpolate(5,0,1)).RepeatForever();

SequenceArray

DAStatics Class

Creates a new behavior that, when started, will play multiple DABehavior objects in the order they appear in the array. This function is a convenience for nesting sequences.

Note You can only use this function with Microsoft® DirectAnimation® versions later than 6.0; for example, version 6.00.06.xxx or later. Versions with this function are available in Microsoft Internet Explorer 5, Microsoft Windows® 98 Second Edition, and Windows 2000.

Syntax

lib.SequenceArray( bvrs)

Parameters

bvrs
Array (variant) of DABehavior objects that make up a sequence in the order in which they appear in the array.

Return Value

Returns the DABehavior object.

Until

DAStatics Class

Creates a behavior that changes when a given event occurs. Up to and including the time the event occurs, the behavior is the same as a. After the event e occurs, the behavior changes to be the same as b. Because Until takes behaviors and returns a behavior, it can be nested.

Syntax

lib.Until( a, e, b )

Parameters

a
DABehavior object that the behavior represents initially.
e
DAEvent object specifying the event.
b
DABehavior object that the behavior represents after the event.

Return Value

Returns the DABehavior object.

Remarks

The following example is taken from the Collage3D.html sample found in the Samples/Multimedia/Danim/Jscript/Exercises subdirectory.

finalImg.init(m.Until(firstImg, m.LeftButtonDown,
                  m.Until(secondImg, m.LeftButtonDown, finalImg)));

UntilEx

DAStatics Class

Creates a DABehavior that changes upon a given event. Initially, the behavior is the same as a. When event e occurs, the behavior changes to the behavior returned by the event. This means that only DAEvents that return a DABehavior can be used. These events can be constructed with AttachData, Notify, and Snapshot.

Syntax

lib.UntilEx( a, e )

Parameters

a
A DABehavior object that the behavior represents initially.
e
The DAEvent object that triggers the switch and returns the new behavior.

Return Value

Returns the DABehavior object caused by the event e.

Remarks

See the UntilEx.html sample found in the Samples/Multimedia/Danim/Jscript/Templates subdirectory.

UntilNotify

DAStatics Class

Creates a behavior that changes upon the given event. Initially, the behavior is the same as b. When the event occurs the behavior changes to the behavior specified by the DAUntilNotifer Notify method.

lib.UntilNotify( b, event, notifier )

Parameters

b
A DABehavior object that represents the initial behavior.
event
The DAEvent object that specifies the event.
notifier
The DAUntilNotifier object whose Notify method, called when event occurs, returns the new behavior.

Return Value

The new DABehavior object that is returned from the DAUntilNotifier Notify method.

UntilNotifyScript

DAStatics Class

Creates a behavior that changes upon the given event. Initially, the behavior is the same as b. When event occurs the behavior changes to the behavior specified by the script procedure whose name is given in the string in the script parameter.

lib.UntilNotifyScript( b, event, script )

Parameters

b
A DABehavior object that represents the initial behavior.
event
The DAEvent object that specifies the event.
script
A string that specifies the script procedure to use to create the new behavior.

Return Value

The new DABehavior object that is returned from the script procedure.

Remarks

You can see UntilNotifyScript used in DragImg.htm sample found in the Samples/Multimedia/Danim/Jscript/Templates subdirectory and in the DragGeo.html sample found in the Samples/Multimedia/Danim/Jscript/Showcase subdirectory.

The following example is taken from DragImg.htm.

  Position = m.UntilNotifyScript(initPos, GrabEvent, "release_proc");

  function release_proc()  {
    ReleasePos = m.UntilNotifyScript(m.MousePosition, ReleaseEvent, "grab_proc");
    return ReleasePos;
  }
  function grab_proc()  {
    GrabPos = m.UntilNotifyScript(m.Point2(mouseX, mouseY), GrabEvent, "release_proc");
    return GrabPos;
  }

 

Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.