Class DefColorFadeController

java.lang.Object
com.ardor3d.util.stat.graph.DefColorFadeController
All Implemented Interfaces:
SpatialController<Spatial>

public class DefColorFadeController extends Object implements SpatialController<Spatial>

A controller that changes over time the alpha value of the default color of a given Geometry. When coupled with an appropriate BlendState, this can be used to fade in and out unlit objects.

An example of an appropriate BlendState to use with this class:

 BlendState blend = new BlendState();
 blend.setBlendEnabled(true);
 blend.setSourceFunction(SourceFunction.SourceAlpha);
 blend.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha);
 
  • Constructor Details

    • DefColorFadeController

      public DefColorFadeController(Mesh target, float targetAlpha, double rate)
      Sets up a new instance of the controller. The
      Parameters:
      target - the object whose default color we want to change the alpha on.
      targetAlpha - the alpha value we want to end up at.
      rate - the amount, per second, to change the alpha. This value will be have its sign flipped if it is not the appropriate direction given the current default color's alpha.
  • Method Details

    • update

      public void update(double time, Spatial caller)
      Specified by:
      update in interface SpatialController<Spatial>
      Parameters:
      time - The time in seconds between the last call to update and the current one
      caller - The spatial currently executing this controller.