Package com.github.tommyettinger.textra
Class Effect
java.lang.Object
com.github.tommyettinger.textra.Effect
- Direct Known Subclasses:
AttentionEffect,BlinkEffect,CannonEffect,CarouselEffect,CrowdEffect,EaseEffect,EmergeEffect,FadeEffect,GradientEffect,HangEffect,HeartbeatEffect,HighlightEffect,InstantEffect,JoltEffect,JumpEffect,LinkEffect,MeetEffect,OceanEffect,RainbowEffect,RotateEffect,ScaleEffect,ShakeEffect,ShrinkEffect,SickEffect,SlamEffect,SlideEffect,SlipEffect,SpinEffect,SpiralEffect,SputterEffect,SquashEffect,StylistEffect,ThinkingEffect,TriggerEffect,WaveEffect,WindEffect,ZipperEffect
Abstract text effect.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA functional interface that is meant to be used with the 2-parameter constructor available for all Effects here, using a method reference such asWaveEffect::new. -
Field Summary
FieldsModifier and TypeFieldDescriptionfloatintintprotected final TypingLabelA unique identifier to be used by the start token for this Effect.protected float -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidapply(long glyph, int glyphIndex, float delta) Applies the effect to the given glyph.assignTokenName(String name) protected floatCalculates the fadeout of this effect, if any.protected floatcalculateProgress(float modifier) Calculates a linear progress dividing the total time by the given modifier.protected floatcalculateProgress(float modifier, float offset) Calculates a linear progress dividing the total time by the given modifier.protected floatcalculateProgress(float modifier, float offset, boolean pingpong) Calculates a linear progress dividing the total time by the given modifier.booleanReturns whether this effect is finished and should be removed.protected abstract voidonApply(long glyph, int localIndex, int globalIndex, float delta) Called when this effect should be applied to the given glyph.protected booleanparamAsBoolean(String str) Returns a boolean value parsed from the given String, or the default value if the string couldn't be parsed.protected intparamAsColor(String str) Parses a color from the given string.protected floatparamAsFloat(String str, float defaultValue) Returns a float value parsed from the given String, or the default value if the string couldn't be parsed.voidupdate(float delta)
-
Field Details
-
label
-
indexStart
public int indexStart -
indexEnd
public int indexEnd -
duration
public float duration -
totalTime
protected float totalTime -
name
A unique identifier to be used by the start token for this Effect. This is expected to be assigned byTypingConfig.registerEffect(String, EffectBuilder), not manually.
-
-
Constructor Details
-
Effect
-
-
Method Details
-
assignTokenName
-
update
public void update(float delta) -
apply
public final void apply(long glyph, int glyphIndex, float delta) Applies the effect to the given glyph. -
onApply
protected abstract void onApply(long glyph, int localIndex, int globalIndex, float delta) Called when this effect should be applied to the given glyph. -
isFinished
public boolean isFinished()Returns whether this effect is finished and should be removed. Note that effects are infinite by default. -
calculateFadeout
protected float calculateFadeout()Calculates the fadeout of this effect, if any. Only considers the second half of the duration. -
calculateProgress
protected float calculateProgress(float modifier) Calculates a linear progress dividing the total time by the given modifier. Returns a value between 0 and 1 that loops in a ping-pong mode. -
calculateProgress
protected float calculateProgress(float modifier, float offset) Calculates a linear progress dividing the total time by the given modifier. Returns a value between 0 and 1 that loops in a ping-pong mode. -
calculateProgress
protected float calculateProgress(float modifier, float offset, boolean pingpong) Calculates a linear progress dividing the total time by the given modifier. Returns a value between 0 and 1. -
paramAsFloat
Returns a float value parsed from the given String, or the default value if the string couldn't be parsed. -
paramAsBoolean
Returns a boolean value parsed from the given String, or the default value if the string couldn't be parsed. -
paramAsColor
Parses a color from the given string. Returns 256 if the color couldn't be parsed.
-