12.2 The Alpha class (Freelance web design) java.lang.Object | +–javax.media.j3d.Alpha A

12.2 The Alpha class java.lang.Object | +–javax.media.j3d.Alpha A good understanding of the Alphaclass is key to using all the Interpolatorbehaviors. The Alpha class defines a function that converts the current time (in milliseconds) to a value between 0 and 1 (alpha value). The alpha value can then be used by the Interpolatorto produce the desired interpolation between specified end states. For example, a PositionInterpolatormight be used to move an object between position (0,0,0) and (0,0,5) in 10 seconds. To achieve the desired result, an Alphaobject must be created that returns 0 at 0 seconds and 1 at 10 seconds. The PositionInterpolatorcan then use the Alphaobject to create the desired z coordinate (table 12.1). Table 12.1 Coordinate calculation using Alpha Time (seconds) Alpha Z Coordinate 0 0 0 * 5 = 0 5 0.5 0.5 * 5 = 2.5 10 1 1 * 5 = 5 The Alphaclass uses a parameterized function to convert time values to alpha values between 0 and 1. Figure 12.1 illustrates the basic shape of the functions that can be created using the Alphaclass. Nine parameters can be used to create a customized Alphafunction are listed there. Figure 12.1 The phases of the Alpha class: triggerTime (1), phase delay (2), increasing alpha (3), increasing alpha ramp (4), at one (5), decreasing alpha (6), decreasing alpha ramp (7), at zero (8), and loopCount (9) The increasing alpha phase (3) is composed of three potential sections, as is the decreasing alpha phase (6). The values of increasing alpha ramp (4) and decreasing alpha ramp (7) define symmetrical acceleration and deceleration of the Alpha value at the beginning and end of the phase. These quadratic sections help to smooth the transition from 0 to 1 (increasing alpha) or 1 to 0 (decreasing alpha). Note that the Alpha value varies linearly between the quadratic sections. The loopCountparameter (9) allows Alphafunctions to be repeated (a fixed number of times or infinitely) by joining Alphafunctions end to end. 196
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Leave a Reply