Class FadeEffect

java.lang.Object
com.github.tommyettinger.textra.Effect
com.github.tommyettinger.textra.effects.FadeEffect

public class FadeEffect extends Effect
Fades the text's color from between colors or alphas. Doesn't repeat itself. This can either fade between two different colors, or two different alpha levels for the default color. The alpha levels can be useful to make text go from invisible (alpha 0.0) to visible (alpha 1.0) instead of changing color.
Parameters: color1;color2;duration
The color1 can be a named color or hex color, but if it isn't valid as one of those, it will be parsed as a float and treated as an alpha transparency value instead of a color, between 0.0 and 1.0. The color2 can be a named color or hex color, but if it isn't valid as one of those, it will be parsed as a float and treated as an alpha transparency value instead of a color, between 0.0 and 1.0. The duration is how many seconds the fade should take to go from color1 to color2; defaults to 1.0 .
Example usage: {FADE=RED;LIGHT BLUE;2.0}This text will fade from red to light blue over 2 seconds.{ENDFADE} {FADE=0.0;1.0;0.5}This text will go from invisible to the default color in half a second.{ENDFADE}
  • Constructor Details

  • Method Details

    • onApply

      protected void onApply(long glyph, int localIndex, int globalIndex, float delta)
      Description copied from class: Effect
      Called when this effect should be applied to the given glyph.
      Specified by:
      onApply in class Effect