Package squidpony.squidgrid.gui.gdx
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
-
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.
-
Field Details
-
Constructor Details
-
LerpFilter
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 nullamount
- a float that determines how much target will affect an input color; will be clamped between 0f and 1f
-
LerpFilter
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 nullamount
- a float that determines how much target will affect an input color; will be clamped between 0f and 1f
-
-
Method Details
-
alter
Takes a packed float color and produces a potentially-different packed float color that this FloatFilter edited.- Specified by:
alter
in classFloatFilter
- Parameters:
color
- a packed float color, as produced byColor.toFloatBits()
- Returns:
- a packed float color, as produced by
Color.toFloatBits()
-