Director Tutorials

 

Wait for the end of a Shockwave 3D Animation

The following outlines how to script a wait for the end of a shockwave 3D animation. You can download the demo file - waitForEndOf3Danim.zip.

The code used in a frame behavior in frame 5 is:

property model1, model2

on beginSprite me
  model1 = member("models").model("Box01")
  model2 = member("models").model("Cylinder01")

end

on exitFrame me
  if model1.keyframePlayer.currentTime = 0 AND model2.keyframePlayer.currentTime = 0 then

    go "completeAnim"
  else
    go the frame
  end if
end

Keyframe animation is applied to model1 (the box) and model2 (the cylinder). When the animation first starts playing, the 'currentTime' property is 0. When the animation is finished, 'currentTime' property goes back to 0. I have the behavior in frame 5. So, when we first arrive at frame 5, there have been 4 frames of animation playing, and the 'currentTime' property is not at 0 (the start). The behavior tells Director to loop in the frame until 'currentTime' property for both models goes back to 0, which we take to mean that the animation has finished playing.