Package net.dermetfan.gdx
Class CharSequenceInterpolator
java.lang.Object
net.dermetfan.gdx.CharSequenceInterpolator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatcharsPerSecondFor(float duration, int length) static floatduration(int length, float charsPerSecond) floatcom.badlogic.gdx.math.InterpolationfloatgetTime()interpolate(CharSequence seq) static CharSequenceinterpolate(CharSequence seq, float time, float charsPerSecond, int beginIndex, int endIndex, com.badlogic.gdx.math.Interpolation interpolation) static CharSequenceinterpolate(CharSequence seq, float time, float charsPerSecond, com.badlogic.gdx.math.Interpolation interpolation) static floatlinear(float time, float charsPerSecond, int length) voidsetCharsPerSecond(float charsPerSecond) voidsetInterpolation(com.badlogic.gdx.math.Interpolation interpolation) voidsetTime(float time) voidupdate(float delta) increasestimeby the given deltaupdateAndInterpolate(CharSequence seq, float delta)
-
Constructor Details
-
CharSequenceInterpolator
public CharSequenceInterpolator(float charsPerSecond) - Parameters:
charsPerSecond- thecharsPerSecond
-
-
Method Details
-
duration
public static float duration(int length, float charsPerSecond) - Returns:
- the duration it takes to fully interpolate a
CharSequenceof the givenlengthwith the givencharsPerSecond
-
charsPerSecondFor
public static float charsPerSecondFor(float duration, int length) - Parameters:
duration- the desired duration of the interpolation using the returned chars per secondlength- the length of theCharSequence- Returns:
- the chars per second needed to get the desired duration when interpolating
-
linear
public static float linear(float time, float charsPerSecond, int length) - Parameters:
time- thetimecharsPerSecond- thecharsPerSecondlength- the length of theCharSequence- Returns:
- the result of linear interpolation / percent of the
durationat the giventime
-
interpolate
public static CharSequence interpolate(CharSequence seq, float time, float charsPerSecond, com.badlogic.gdx.math.Interpolation interpolation) - See Also:
-
interpolate
public static CharSequence interpolate(CharSequence seq, float time, float charsPerSecond, int beginIndex, int endIndex, com.badlogic.gdx.math.Interpolation interpolation) - Parameters:
seq- theCharSequenceto interpolatetime- thetimecharsPerSecond- thecharsPerSecondbeginIndex- the index at which the returnedCharSequenceshould startendIndex- the index at which the returnedCharSequenceshould end if the givenInterpolationapplied1interpolation- theInterpolationto use- Returns:
- a
subsequencerepresenting the givenseqfrombeginIndextoendIndexwith itslengthinterpolated using the giveninterpolation
-
update
public void update(float delta) increasestimeby the given delta -
interpolate
- See Also:
-
updateAndInterpolate
-
getInterpolation
public com.badlogic.gdx.math.Interpolation getInterpolation()- Returns:
- the
interpolation
-
setInterpolation
public void setInterpolation(com.badlogic.gdx.math.Interpolation interpolation) - Parameters:
interpolation- theinterpolationto set
-
getCharsPerSecond
public float getCharsPerSecond()- Returns:
- the
charsPerSecond
-
setCharsPerSecond
public void setCharsPerSecond(float charsPerSecond) - Parameters:
charsPerSecond- thecharsPerSecondto set
-
getTime
public float getTime()- Returns:
- the
time
-
setTime
public void setTime(float time) - Parameters:
time- thetimeto set
-