Class FloatFilters.LerpFilter

java.lang.Object
squidpony.squidgrid.gui.gdx.FloatFilter
squidpony.squidgrid.gui.gdx.FloatFilters.LerpFilter
Enclosing class:
FloatFilters

public static class FloatFilters.LerpFilter
extends FloatFilter
A FloatFilter that linearly interpolates (lerps) any color it is given toward a specified color by a specified amount. Uses SColor.lerpFloatColorsBlended(float, float, float) to mix a requested color with the target color, and this means the alpha of the target color affects the amount of change instead of the resulting alpha.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    float amount  
    float target  
  • Constructor Summary

    Constructors 
    Constructor Description
    LerpFilter​(float target, float amount)
    Builds a LerpFilter with a packed float color and an amount as a float.
    LerpFilter​(com.badlogic.gdx.graphics.Color target, float amount)
    Builds a LerpFilter with a Color (which will be converted to a packed float color) and an amount as a float.
  • Method Summary

    Modifier and Type Method Description
    float alter​(float color)
    Takes a packed float color and produces a potentially-different packed float color that this FloatFilter edited.

    Methods inherited from class squidpony.squidgrid.gui.gdx.FloatFilter

    alter

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • LerpFilter

      public LerpFilter​(com.badlogic.gdx.graphics.Color target, float amount)
      Builds a LerpFilter with a Color (which will be converted to a packed float color) and an amount as a float. The amount is how much the target color will affect input colors, from 0f to 1f. If the target color has an alpha component that is less than 1, then amount is effectively multiplied by that alpha.
      Parameters:
      target - a libGDX color; must not be null
      amount - a float that determines how much target will affect an input color; will be clamped between 0f and 1f
    • LerpFilter

      public LerpFilter​(float target, float amount)
      Builds a LerpFilter with a packed float color and an amount as a float. The amount is how much the target color will affect input colors, from 0f to 1f. If the target color has an alpha component that is less than 1, then amount is effectively multiplied by that alpha.
      Parameters:
      target - a packed float color; must not be null
      amount - a float that determines how much target will affect an input color; will be clamped between 0f and 1f
  • Method Details

    • alter

      public float alter​(float color)
      Takes a packed float color and produces a potentially-different packed float color that this FloatFilter edited.
      Specified by:
      alter in class FloatFilter
      Parameters:
      color - a packed float color, as produced by Color.toFloatBits()
      Returns:
      a packed float color, as produced by Color.toFloatBits()