public class TypingTextAnimation extends BaseTextAnimation
TextAnimation that reveals the text as if it were being typed| Modifier and Type | Field and Description |
|---|---|
static float |
DEFAULT_CHARACTERS_PER_SECOND |
finished| Constructor and Description |
|---|
TypingTextAnimation()
Constructor.
|
TypingTextAnimation(float charactersPerSecond)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
float |
getCharactersPerSecond() |
int |
getCurrentCharacterIndex()
Returns the current index of the animation
|
void |
onResize(GameFontCache cache,
java.lang.String text,
float renderWidth,
int hAlign)
Handles label resizing
|
void |
render(GameFontCache cache,
Graphics g,
int renderX,
int renderY)
Renders the animation
|
protected void |
resetState() |
void |
skip()
Sets the
TextAnimation to be skipped |
void |
update(GameFontCache cache,
java.lang.String text,
float renderWidth,
int hAlign,
float delta)
Update the animation
|
addTextAnimationListener, isFinished, removeTextAnimationListener, reset, setFinishedpublic static final float DEFAULT_CHARACTERS_PER_SECOND
public TypingTextAnimation()
DEFAULT_CHARACTERS_PER_SECOND characters revealed per second.public TypingTextAnimation(float charactersPerSecond)
charactersPerSecond - The amount of characters to reveal per secondpublic void update(GameFontCache cache, java.lang.String text, float renderWidth, int hAlign, float delta)
TextAnimationcache - The GameFontCache to use to render the texttext - The target text to displayrenderWidth - The text render widthhAlign - The horizontal alignment of the textdelta - The time since the last frame (in seconds)public void render(GameFontCache cache, Graphics g, int renderX, int renderY)
TextAnimationcache - The GameFontCache to use to render the textg - The Graphics contextrenderX - The render X coordinaterenderY - The render Y coordinatepublic void skip()
TextAnimationTextAnimation to be skippedpublic void onResize(GameFontCache cache, java.lang.String text, float renderWidth, int hAlign)
TextAnimationpublic float getCharactersPerSecond()
protected void resetState()
resetState in class BaseTextAnimationpublic int getCurrentCharacterIndex()