Datasheet

Chapter 1: Understanding Flash3D
31
Here s how the code is put together:
The code starts by bringing in a number of imports that set up the animation framework.
The code uses an ‘ if statement
if(__motion_Ball_16 == null) to determine if animation is
running or not. If it isn t, it imports all the necessary parameters needed to get the animation
going. The name Ball comes from the name of the movie clip in your Flash Library.
The
addPropertyArray method is then executed as many times as needed to bring all the data
created in the motion editor.
For example, in the bouncing ball example there were ten frames of animation, and comparatively, in
each
addPropertyArray there are ten values. As shown below for the y argument there are ten values
corresponding to the position of your ball in the animation:
__motion_Ball_16.addPropertyArray(“y”, [0,7.38399,37.4766,112.504,269.275,333.95,22
1.075,47.6064,8.68268,0]);
Finally, to apply this animation to another object you need to uncomment the final line of code:
// __animFactory_Ball_16.addTarget( < instance name goes here > , 0);
Create a movie clip, put it on your Flash stage, and give it an instance name.
Then place that instance name in the < instance name goes here > spot in the code above.
You can now apply this custom animation to as many objects as you want using only ActionScripting.
The motion editor allows you to work with a large number of properties.
The following properties can be included in your animation using the motion editor:
Basic Motion (X, Y, Z, Rotation X, Rotation Y, Rotation Z)
Transformation (Skew X, Skew Y, Scale X, Scale Y)
Color Effect (Alpha, Brightness, Tint, Advanced)
Filters (Drop Shadow, Blur, Glow, Bevel, Gradient Glow, Gradient Bevel, Adjust Color)
Eases (Simple, Start and Stop, Bounce, Spring, Sine, Sawtooth, Square, Random, Damped, and
Custom)
Adding these properties is easy in the Flash 10 motion editor, very much like using curve editors found
in sound and graphic programs.
Collada Files
Handling animation and bringing 3D models into Papervision3D is an important topic. It s also one of
great frustrations to the Papervision3D user community. There s nothing worse than spending a month
creating an incredible 3D model and not being able to get it to run in Papervision3D. Presently,
Papervision3D brings 3D objects into its program using primitives or Collada files.
c01.indd 31c01.indd 31 12/14/09 3:03:34 PM12/14/09 3:03:34 PM