Index Topic Contents | |||
Previous Topic: DABbox3 Class Next Topic: DABoolean Class |
DABehavior Class
All behaviors are potentially time-varying and/or reactive values such as colors, numbers and images. They can be used to construct animated objects. All behavior subclasses inherit the functions of this class.
Because all behaviors (animated objects) are potentially time-varying and/or reactive, their values can change as a function of time or as the result of user input. Time-varying behaviors are created by combining time-based default behaviors (such as LocalTime) with other behaviors. Reactive behaviors are created using the Until and UntilEx functions and by specifying input events, such as mouse clicks. Complex behaviors can be built by combining existing behaviors. The value of a complex behavior always depends on the values of the behaviors that comprise it.
When a behavior runs, its time-varying and reactive qualities are active. This means the user can experience any changes that occur in the behavior as time passes or events occur.
DABehavior Functions
DABehavior Class
DurationAnimCreates an animation fragment by associating a local "stop time" with a behavior. The result is a new behavior that is the same as the original behavior for the length of the duration. Once the duration is over, the behavior is a snapshot of the behavior's state when the duration ended.
DurationAnim(
length
)Parameters
- length
- The DANumber object representing the length of time, in seconds, that the duration lasts. This must be an animated number.
Return Values
Returns the DABehavior object.
DABehavior Class
DurationSame as DurationAnim except that length is a non-animated number (a double).
Duration(
length
)DABehavior Class
GetClassNameReturns the name of an object's class.
behaviorObj.GetClassName( )
Return Values
Returns a String.
DABehavior Class
HookAllows a running behavior to be sampled.
behaviorObj.Hook(
notifier
)Parameters
- notifier
- The object that controls the sampling of the DABehavior.
Return Values
Returns a DABehavior object.
DABehavior Class
InitInitializes an uninitialized object. Here is an example of how to create an uninitialized DAPoint2 object in VBScript:
Set myPt = CreateObject("DirectAnimation.DAPoint2")And here is how to create an uninitialized object in JScript:
myPt = new ActiveXObject("DirectAnimation.DAPoint2");To initialize the object in VBScript, use:
myPt.Init(...)The only difference in JScript is that it needs a semicolon at the end of the line. For example, consider the following JScript code:
myPt.Init(m.Unitl(position, resetEvent,resetPosition);The Init function can also be used on uninitialized arrays (UninitializedArray) and uninitialized DATuples (UninitializedTuple).
behaviorObj.Init(
behavior
)DABehavior Class
IsReadyDetermines if all the imports for the behavior have been downloaded. Only works when the behavior is, itself, an import. Otherwise returns E_NOTIMPL.
behaviorObj.IsReady(
bBlock
)Parameters
- bBlock
- A boolean which, if FALSE, indicates that IsReady should return immediately and, if TRUE, indicates that it should block until the behavior is ready.
Return Values
Returns a boolean which, if TRUE, means all the imports have been downloaded.
DABehavior Class
RepeatCreates a behavior that repeats itself the number of times specified by repetitions.
behaviorObj.Repeat(
repetitions
)Parameters
- repetitions
- The number of times the behavior will repeat.
Return Values
Returns the DABehavior object.
DABehavior Class
RepeatForeverCreates a behavior that repeats infinitely.
behaviorObj.RepeatForever( )
Return Values
Returns the DABehavior object.
DABehavior Class
RunOnceUsed when applications must reference a running behavior once it starts running, but don't require the application to explicitly start that behavior.
behaviorObj.RunOnce( )
DABehavior Class
SubstituteTimeCreates a new behavior from an existing DABehavior and a DANumber. In the new behavior, the animated number replaces all occurrences of LocalTime in the original behavior. (This includes behaviors where LocalTime is implicit, such as imported movies. The function can be used even if LocalTime isn't explicitly in the code.) This allows behaviors to be, for example, time-scaled to run faster or slower, time-shifted to start at a different time, or frozen at a particular point in time.
behaviorObj.SubstituteTime(
a
)Parameters
- a
- The DANumber object that replaces LocalTime.
Return Values
Returns the DABehavior object.
DABehavior Subroutines
DABehavior Class
SwitchToReplaces one behavior with another. The inital behavior is set with the ModifiableBehavior function in the DAStatics class.
behaviorObj.SwitchTo(
newBehavior
)Parameters
- newBehavior
- The DABehavior object that will replace the initial behavior.
Relevant Functions from the DAStatics Class
The following functions are defined in the DAStatics class and are most relevant to objects of type DABehavior.
lib.ModifiableBehavior(initialBehavior)
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.