provided by: 
Originally published at Internet.comJava Programming Notes # 1546 * Preface * General * Viewing tip * Figures * Listings * Supplementary material * General background information * Preview * Discussion and sample code * Run the program * Summary * What's next? * Download * Resources * Complete program listing * Copyright * About the author -----------------------------------
Preface
General
Fourth in a series of lessons
This is the fourth lesson in a series of lessons designed to start with Java 3D basics and work up to the general complexity of the program that I explained in the earlier lesson titled "Understanding Lighting in the Java 3D API" (see Resources).
The first lesson in this series was titled "Back to Basics in the Java 3D API" (see Resources). The previous lesson was titled "Simple Animation with the Java 3D API" This lesson is titled "Understanding the Alpha Time-Base Class in Java 3D" My current plan is for future lessons to deal with user and object interaction as well as advanced animation and textures.
What you will learn
Understanding the Alpha class is critical to understanding Java 3D animation. The constructors for the Alpha class can require up to ten parameters. Understanding the purpose of those parameters and the behavior imparted by those parameters is far from trivial. In this lesson, I will teach you about the detailed behavior of objects instantiated from the Alpha class, with particular emphasis on understanding the behavior imparted by each of the ten parameters. In many cases, I will provide practical suggestions as to an animation scenario in which a particular parameter value might be appropriate.
Compiling and running Java 3D programs
In order to compile and run programs using the Java 3D API, you will need to download and install the Java 3D API software. As of the date of this writing, version 1.5.0 is available for download.
In addition, you will need to download and install either Microsoft DirectX or OpenGL. All of the sample programs in this series of tutorials were developed and tested using Microsoft DirectX. They were not tested using OpenGL.
Viewing tip
I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the figures and listings while you are reading about them.
Figures
* Figure 1. Bouvier's recipe for animation in Java 3D. * Figure 2. Parameter names and default values for Alpha constructor. * Figure 3. Time functions produced by six different Alpha objects.
Listings
* Listing 1. Beginning of the program named Java3D007. * Listing 2. Three additional instance variables. * Listing 3. The main method. * Listing 4. Beginning of the constructor. * Listing 5. Time to quit sampling. * Listing 6. The else clause. * Listing 7. End of anonymous inner class definition. * Listing 8. Instantiate the first Alpha object. * Listing 9. A delayed saw tooth time function. * Listing 10. Even more delay. * Listing 11. Going from 1.0 to 0.0 * Listing 12. A mode for moving objects with significant mass. * Listing 13. Combining the mode values with a bitwise OR. * Listing 14. The end of the constructor. * Listing 15. Source code for the program named Java3D007.
Supplementary material
I recommend that you also study the other lessons in my extensive collection of online Java tutorials. You will find a consolidated index at www.DickBaldwin.com.
General background information
Dennis Bouvier (see Resources) gives us the recipe shown in Figure 1 for creating animation in Java 3D through the use an Interpolator object. This lesson will concentrate on developing an understanding of step 2 in Figure 1 dealing with objects of the Alpha class.
Figure 1. Bouvier's recipe for animation in Java 3D. 1. Create a target TransformGroup * Set the ALLOW_TRANSFORM_WRITE capability 2. Create an Alpha object * Specify the time parameters for the alpha 3. Create the interpolator object * Have it reference the Alpha and TransformGroup objects * Customize the behavior parameters 4. Specify a scheduling region * Set the scheduling region for the behavior 5. Make the behavior a child of the TransformGroup
As you can see from Figure 1, being able to create the Alpha object is critical to the creation of the overall animation.
Constructors
The Alpha class has four overloaded constructors. The most complex of those four constructors requires ten parameters. The only differences among the constructors are that some of the constructors use default values for some of the ten required parameters. This results in three of the four constructors having fewer parameters. Regardless of which constructor you elect to use, you need to understand the behavior imparted by the values provided by all ten parameters even if some of those parameters take on default values.
The parameter names and default values
Although this is not likely to mean much to you at this point, Figure 2 shows the names of all ten parameters along with their default values. These names are based on the Sun documentation for the Alpha class.
Figure 2. Parameter names and default values for Alpha constructor. loopCount : -1 mode : INCREASING_ENABLE triggerTime : 0 phaseDelayDuration :
Author: Richard G. Baldwin
Read article at Internet.com site