Package squidpony.squidgrid.gui.gdx
Class FloatFilters.MultiLerpFilter
java.lang.Object
squidpony.squidgrid.gui.gdx.FloatFilter
squidpony.squidgrid.gui.gdx.FloatFilters.MultiLerpFilter
- Enclosing class:
- FloatFilters
public static class FloatFilters.MultiLerpFilter extends FloatFilter
A FloatFilter that linearly interpolates (lerps) any color it is given toward the most-similar of a group of
given colors. Uses
SColor.lerpFloatColorsBlended(float, float, float)
to mix a requested color with the
chosen target color, and this means the alpha of the target color affects the amount of change instead of the
resulting alpha. Changing the alpha of the colors this is given can be done easily with
SColor.translucentColor(float, float)
, and this allows you to specify varying amounts to mix by.-
Field Summary
-
Constructor Summary
Constructors Constructor Description MultiLerpFilter(float amount, float... targets)
Builds a MultiLerpFilter with an array of packed float colors and an amount as a float.MultiLerpFilter(float amount, com.badlogic.gdx.graphics.Color[] targets)
Builds a MultiLerpFilter with an array of Color objects (which will be converted to an array of packed float colors) 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
-
MultiLerpFilter
Builds a MultiLerpFilter with an array of Color objects (which will be converted to an array of packed float colors) and an amount as a float. The amount is how much the target colors will affect input colors, from 0f to 1f. If a target color has an alpha component that is less than 1, then amount is effectively multiplied by that alpha. If you want to edit the alpha without duplicating Color objects, you can useSColor.translucentColor(Color, float)
to make a float array to pass toMultiLerpFilter(float, float...)
.- Parameters:
amount
- a float that determines how much target will affect an input color; will be clamped between 0f and 1ftargets
- an array of libGDX Color objects; must not be null or empty
-
MultiLerpFilter
Builds a MultiLerpFilter with an array of packed float colors 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:
amount
- a float that determines how much target will affect an input color; will be clamped between 0f and 1ftargets
- an array or vararg of packed float colors; must not be null or empty
-
-
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()
-