12.2.2 Summary An Alphaclass is very simple it converts (Web site translator)
12.2.2 Summary An Alphaclass is very simple it converts a time value in milliseconds to a value between 0 and 1. The built-in Alphaclass defines all the parameters for an Alphafunction to implement a common class of onset, peak, offset activation functions. A custom Alphafunction, such as FileAlpha, is a very powerful mechanism to feed application-specific data into one of the Interpolator-derived classes. An application might define an Alphaclass that samples data straight from a communications port, or reads precomputed data from a file. The output from the custom Alphaclass can then be used to parameterize a wide variety of Interpolators. Alphaclasses are used in conjunction with Interpolators, but they do not do anything visible themselves. Their prime purpose in Java 3D is to provide input to the Interpolatorclasses. Interpolatorsare the subjects of section 12.3, so read on. 12.3 Example of Interpolator usage java.lang.Object | +–javax.media.j3d.SceneGraphObject | +–javax.media.j3d.Node | +–javax.media.j3d.Leaf | +–javax.media.j3d.Behavior | +–javax.media.j3d.Interpolator The Java 3D Interpolatorswere explored using the InterpolatorTestand the SplineInterpolatorTestexamples. The InterpolatorTestexample demonstrates using the following Interpolators: SwitchValueInterpolator The SwitchValueInterpolatoris used to cycle through the children of a Switch Nodebased on the output from an Alphaobject. The SwitchValueInterpolatormaps the output from the Alphainto a current visible child Nodeusing the following algorithm: float f = alpha.value(); int i = firstSwitchIndex + (int)(f * (float)(childCount - 1) + 0.5F); target.setWhichChild(i); Note that the Switch Nodepassed to the SwitchInterpolatormust have the Switch.ALLOW_SWITCH_WRITEcapability. //create the Switch Node Switch switchNode = new Switch(); //set the WRITE capability switchNode.setCapability( Switch.ALLOW_SWITCH_WRITE ); //add children to switchNode here 199
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.