Class EffectsBase
Base class for TextAnimator effects' categories
Please do not inherit from this class directly, but do from AppearanceBase or BehaviorBase
Namespace: Febucci.UI.Core
Assembly: Febucci.TextAnimator.Runtime.dll
Syntax
public abstract class EffectsBase
Fields
uniformIntensity
Intensity used to uniform effects that behave differently based on screen or font sizes.
Declaration
public float uniformIntensity
Field Value
Type | Description |
---|---|
Single |
Remarks
Multiply this by your effect values only if they behave differently with different screen resolutions, font sizes or similar. (e.g. adding or subtracting vectors)
Properties
effectTag
Effect's tag without symbols, eg. "shake"
Declaration
public string effectTag { get; }
Property Value
Type | Description |
---|---|
String |
Methods
ApplyEffect(ref CharacterData, Int32)
Called once for each letter, per each frame.
Use this to apply the effect to a letter/character, by modifying its CharacterData values.
Declaration
public abstract void ApplyEffect(ref CharacterData data, int charIndex)
Parameters
Type | Name | Description |
---|---|---|
CharacterData | data | Letters' values like position and colors. It might have been already modified by previous effects. |
Int32 | charIndex | Letter index/position in the text. |
ApplyModifierTo(ref Single, String)
Applies the modifier by performing a multiplication to the given value.
Declaration
protected void ApplyModifierTo(ref float value, string modifierValue)
Parameters
Type | Name | Description |
---|---|---|
Single | value | The effect's value you want to modify |
String | modifierValue | The modifier value. eg. "0.5" |
Examples
string modifier = "0.5";
float amplitude = 1;
ApplyModifierTo(ref amplitude, modifier);
//amplitude becomes 0.5
Calculate()
Called once per frame, before applying the effect to letters. Example: You could use this to calculate the effect variables that are indiependant from specific letters
Declaration
public virtual void Calculate()
Initialize(Int32)
Invoked upon effect creation
Declaration
public virtual void Initialize(int charactersCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | charactersCount |
SetModifier(String, String)
Invoked when there is a modifier in your rich text tag, eg. <shake a=3>
Declaration
public abstract void SetModifier(string modifierName, string modifierValue)
Parameters
Type | Name | Description |
---|---|---|
String | modifierName | modifier name. eg. in <shake a=3> this string is "a" |
String | modifierValue | modifier value. eg. in <shake a=3> this string is "3" |
Remarks
You can also use the following helper methods:
Examples
float amplitude = 2;
//[...]
public override void SetModifier(string modifierName, string modifierValue){
switch(modifierName){
//changes the 'amplitude' variable based on the modifier written in the tag
//eg. when you write a tag like <shake a=3>
case "a": ApplyModifierTo(ref amplitude, modifierValue); return;
}
}