3D Lingo Dictionary > O-S > play() |  |

play()

Syntax

    member(whichCastmember).model(whichModel).bonesPlayer.play()
    member(whichCastmember).model(whichModel).keyframePlayer.play()
    member(whichCastmember).model(whichModel).bonesPlayer.play(motionName {, looped, startTime, endTime, scale, offset})
    member(whichCastmember).model(whichModel).keyframePlayer.play(motionName {, looped, startTime, endTime, scale, offset})

Description

3D `#keyframePlayer` and `#bonesPlayer` command; initiates or unpauses the execution of a motion.

When a model's motion has been initiated or resumed by using this command, the model's `bonesPlayer.playing` property will be set to `TRUE`.

Use `play()` with no parameters to resume the execution of a motion that has been paused with the `pause()` command.

When `play()` is called and only the `motionName` parameter is specified, the motion will be executed by the model once from beginning to end at the speed set by the modifier's `playRate` property.

The optional parameters of the `play` command are as follows:

`looped` specifies whether the motion plays once (`FALSE`) or continuously (`TRUE`).

`startTime` is measured in milliseconds from the beginning of the motion. When `looped` is `TRUE`, the first iteration of the loop begins at `offset` and ends at `endTime` with all subsequent repetitions of the motion beginning at `startTime` and end at `endTime`.

`endTime` is measured in milliseconds from the beginning of the motion. When `looped` is `FALSE`, the motion begins at `offset` and ends at `endTime`. When `looped` is `TRUE`, the first iteration of the loop begins at `offset` and ends at `endTime` with all subsequent repetitions beginning at `startTime` and end at `endTime`. Set `endTime` to -1 if you want the motion to play to the end.

`playRate` is multiplied by the model's #`keyframePlayer` or #`bonesPlayer` modifier's `playRate` property to determine the actual speed of the motion's playback.

`offset` is measured in milliseconds from the beginning of the motion. When `looped` is `FALSE`, the motion begins at `offset` and ends at `endTime`. When `looped` is `TRUE`, the first iteration of the loop begins at `offset` and ends at `endTime` with all subsequent repetitions beginning at `startTime` and end at `cropEnd`. You can alternately specify the `offset` parameter with a value of `#synchronized` in order to start the motion at the same relative position in its duration as the currently playing animation is through its own duration.

Using the `play()` command to initiate a motion inserts the motion at the beginning of the modifier's playlist. If this interrupts playback of another motion, the interrupted motion remains in the playlist in the next position after the newly initiated motion. When the newly initiated motion ends (if it is non-looping) or if the `playNext()` command is issued, the interrupted motion will resume playback at the point where it was interrupted.

Example

This command causes the model named Walker to begin playback of the motion named Fall. After playing this motion, the model will resume playback of any previously playing motion.

    sprite(1).member.model("Walker").bonesPlayer.play("Fall", 0, 0, -1, 1, 0)

This command causes the model named Walker to begin playback of the motion named Kick. If Walker is currently executing a motion, it is interrupted by Kick and a section of Kick will play in a continuous loop. The first iteration of the loop will begin 2000 milliseconds from the motion's beginning. All subsequent iterations of the loop will begin 1000 milliseconds from Kick's beginning and will end 5000 milliseconds from Kick's beginning. The rate of playback will be three times the `playRate` property of the model's `bonesPlayer` modifier.

    sprite(1).member.model("Walker").bonesPlayer.play("Kick", 1, 1000, 5000, 3, 2000)

See also

`queue()`, `playNext()`, `playRate`, `playlist`, `pause()`, `removeLast()`, `playing`