Sequence

Return to Introduction  Previous page  Next page

A sequence is a class that represents a series of keyframes for an object, created using the createSequence method.

 

Methods

 

createKeyframe(time, propString)

Creates a keyframe at the given time (in seconds).  The propString is a string with one or more tags representing which keyframes to set (the same format as in the XML source).  The only additional setting is 'tweenin' which can be 'jump', 'linear', 'stepped' or 'quad' depending on the tweening required.  An example is given below.

removeAllKeyframes()

Removes all keyframes from the sequence.

 

Properties

 

duration

Gets or sets a floating point value representing the length of the sequence in seconds.

 

Examples

 

function onclick()

{

       var seq=object.createSequence("test1", 1); // create a new sequence called "test1" that's 1 second long.

       seq.createKeyframe(0, "<prop id='pos' type='vector' tweenin='stepped' x='0' y='0' z='0'/>"); // add a position keyframe at 0s.

       seq.createKeyframe(1, "<prop id='pos' type='vector' tweenin='stepped' x='10' y='0' z='0'/>"); // add a position keyframe at 1s.

       object.sequence="test1"; // activate the sequence.

}

 

Remarks

 

You can keyframe any object property you like, even your own script variables.  All properties are the same as if you type object. in the script editor for an object.  So object.pos is just prop id='pos' and object.script.myVar becomes prop id='script.myVar' etc.

 

See Also

 

Script Reference



Copyright ©2004 Worldweaver Ltd. DX Studio Home