< Zurück | Inhalt | Weiter >

TransparencyInterpolator


The TransparencyInterpolator can be used to linearly interpolate between two transparency values. The TransparencyInterpolator modifies an Appearance’s TransparencyAttributes. The TransparencyAttributes must have the ALLOW_VALUE_WRITE capability set.


//create the TransparencyAttributes

TransparencyAttributes transparency = new TransparencyAttributes();


//set the required capability bit transparency.setCapability(

TransparencyAttributes.ALLOW_VALUE_WRITE );


//set the transparency mode

transparency.setTransparencyMode( TransparencyAttributes.NICEST );


//assign the transparency to an Appearance app.setTransparencyAttributes( transparency );


//create the interpolator and interpolate

//between 0 (opaque) and 0.8.

Interpolator interpolator = new TransparencyInterpolator( alpha, app.getTransparencyAttributes(