Class Glider
java.lang.Object
com.github.yellowstonegames.smooth.Glider
- Direct Known Subclasses:
AngleGlider, CoordGlider, FloatGlider, IntColorGlider, SequenceGlider, VectorGlider
A general-purpose group of smoothly-changing values, either float or int, using any rules for the
smooth-movement interpolations (specifiable by
FloatSmoother and IntSmoother functions).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA named variable that can change either (or both) a float and/or an int value between start and end values. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatfinal com.github.tommyettinger.ds.HolderSet<Glider.Changer, String> protected Runnableprotected com.github.tommyettinger.digital.Interpolations.Interpolator -
Constructor Summary
ConstructorsConstructorDescriptionGlider()Glider(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Glider.Changer changer) Glider(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Glider.Changer... changers) Glider(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Runnable completeRunner, Glider.Changer changer) Glider(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Runnable completeRunner, Glider.Changer... changers) Glider(Glider.Changer changer) Glider(Glider.Changer... changers) -
Method Summary
Modifier and TypeMethodDescriptionaddChanger(Glider.Changer changer) addChangers(Glider.Changer... changers) addChangers(Collection<Glider.Changer> changers) booleanfloatfloatgetEndFloat(String name) Looks up theend floatvalue for the Changer with the givenname.intLooks up theend intvalue for the Changer with the givenname.floatGets the current float value for the Changer with the givennameby interpolating between its start and end float values.intGets the current int value for the Changer with the givennameby interpolating between its start and end int values.com.github.tommyettinger.digital.Interpolations.InterpolatorfloatgetStartFloat(String name) Looks up thestart floatvalue for the Changer with the givenname.intgetStartInt(String name) Looks up thestart intvalue for the Changer with the givenname.inthashCode()Adds all Changers inotherto this Glider, and potentially changes therunnerso that it performs other's runner, if non-null, after this Glider's runner (or just run's other's if this has none).voidremoveChanger(String name) voidvoidsetChange(float change) voidsetCompleteRunner(Runnable completeRunner) voidsetEndFloat(String name, float end) voidvoidsetInterpolation(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation) voidsetStartFloat(String name, float start) voidsetStartInt(String name, int start)
-
Field Details
-
changers
-
change
protected float change -
interpolation
protected com.github.tommyettinger.digital.Interpolations.Interpolator interpolation -
completeRunner
-
-
Constructor Details
-
Glider
public Glider() -
Glider
-
Glider
-
Glider
public Glider(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Glider.Changer changer) -
Glider
public Glider(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Glider.Changer... changers) -
Glider
public Glider(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Runnable completeRunner, Glider.Changer changer) -
Glider
public Glider(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Runnable completeRunner, Glider.Changer... changers) -
Glider
-
-
Method Details
-
addChanger
-
addChangers
-
addChangers
-
removeChanger
-
merge
Adds all Changers inotherto this Glider, and potentially changes therunnerso that it performs other's runner, if non-null, after this Glider's runner (or just run's other's if this has none).- Parameters:
other- another Glider to merge into this one; will not be changed, but this may share references- Returns:
- this, after modifications, for chaining
-
getFloat
Gets the current float value for the Changer with the givennameby interpolating between its start and end float values. Theinterpolationwill be applied tochangebefore it is passed to the Changer'sGlider.Changer.interpolatorF. If this cannot locate a Changer by the given name, this returnsFloat.NaN.- Parameters:
name- the name of the Changer to look up- Returns:
- the current float value of the located Changer, or
Float.NaNif lookup fails
-
getInt
Gets the current int value for the Changer with the givennameby interpolating between its start and end int values. Theinterpolationwill be applied tochangebefore it is passed to the Changer'sGlider.Changer.interpolatorI. If this cannot locate a Changer by the given name, this returnsInteger.MIN_VALUE.- Parameters:
name- the name of the Changer to look up- Returns:
- the current int value of the located Changer, or
Integer.MIN_VALUEif lookup fails
-
getChange
public float getChange() -
setChange
public void setChange(float change) -
getStartFloat
Looks up thestart floatvalue for the Changer with the givenname. If this cannot locate a Changer by the given name, this returnsFloat.NaN.- Parameters:
name- the name of the Changer to look up- Returns:
- the start float value of the located Changer, or
Float.NaNif lookup fails
-
setStartFloat
Sets thestart floatvalue for the Changer with the givennametostart. If this cannot locate a Changer by the given name, this does nothing. Otherwise, sets the Changer's start float value and also setschangeto 0.- Parameters:
name- the name of the Changer to look upstart- value to use for the located Changer's start float
-
getEndFloat
-
setEndFloat
Sets theend floatvalue for the Changer with the givennametoend. If this cannot locate a Changer by the given name, this does nothing. Otherwise, sets the Changer's end float value and also setschangeto 0.- Parameters:
name- the name of the Changer to look upend- value to use for the located Changer's end float
-
getStartInt
Looks up thestart intvalue for the Changer with the givenname. If this cannot locate a Changer by the given name, this returnsInteger.MIN_VALUE.- Parameters:
name- the name of the Changer to look up- Returns:
- the start int value of the located Changer, or
Integer.MIN_VALUEif lookup fails
-
setStartInt
Sets thestart intvalue for the Changer with the givennametostart. If this cannot locate a Changer by the given name, this does nothing. Otherwise, sets the Changer's start int value and also setschangeto 0.- Parameters:
name- the name of the Changer to look upstart- value to use for the located Changer's start int
-
getEndInt
Looks up theend intvalue for the Changer with the givenname. If this cannot locate a Changer by the given name, this returnsInteger.MIN_VALUE.- Parameters:
name- the name of the Changer to look up- Returns:
- the end int value of the located Changer, or
Integer.MIN_VALUEif lookup fails
-
setEndInt
Sets theend intvalue for the Changer with the givennametoend. If this cannot locate a Changer by the given name, this does nothing. Otherwise, sets the Changer's end int value and also setschangeto 0.- Parameters:
name- the name of the Changer to look upend- value to use for the located Changer's end int
-
getInterpolation
public com.github.tommyettinger.digital.Interpolations.Interpolator getInterpolation() -
setInterpolation
public void setInterpolation(com.github.tommyettinger.digital.Interpolations.Interpolator interpolation) -
getCompleteRunner
-
setCompleteRunner
-
onComplete
public void onComplete() -
resetToCurrent
public void resetToCurrent() -
equals
-
hashCode
-