Class JoltEffect

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

public class JoltEffect extends Effect
Randomly selects and shakes individual characters in the text, changing their color while shaking.
Parameters: shakeDistance;shakeSpeed;duration;likelihood;baseColor;joltColor
The shakeDistance affects how far a shaking glyph should move from its original position; defaults to 1.0 . The shakeSpeed affects how fast a shaking glyph should move; defaults to 1.0 . The duration affects how long the effect will continue for, in seconds; defaults to positive infinity. The likelihood affects how often a glyph is selected to be shaken; defaults to 0.05 . The baseColor can be a named color or hex color, but if not a color this will only shake glyphs, not color them while shaking. Defaults to _ (not a color). The joltColor can be a named color or hex color, and will be used as the color for shaking glyphs as long as baseColor has an actual color value (not _). Defaults to #FFFF88FF (light yellow).
Example usage: {JOLT=1;0.8;_;0.25;dddddd;fff0cc}This text will shake more slowly, and select glyphs to shake much more frequently; it will start light gray and become pale yellow when shaking. The effect won't ever end.{ENDJOLT} {JOLT=1;1;_;0.05;DARKEST RED;RED}This text will default to very dark red but will make individual characters pop out in shaking bright red text. The effect won't ever end.{ENDJOLT}
  • 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