2017-08-02 17:21:45 +08:00
|
|
|
|
namespace UnityEngine.UI.Extensions.Examples
|
2017-06-05 23:01:47 +08:00
|
|
|
|
{
|
2017-08-02 17:21:45 +08:00
|
|
|
|
public class AnimateEffects : MonoBehaviour
|
2017-06-05 23:01:47 +08:00
|
|
|
|
{
|
2017-08-02 17:21:45 +08:00
|
|
|
|
public LetterSpacing letterSpacing;
|
|
|
|
|
float letterSpacingMax = 10, letterSpacingMin = -10, letterSpacingModifier = 0.1f;
|
|
|
|
|
public CurvedText curvedText;
|
|
|
|
|
float curvedTextMax = 0.05f, curvedTextMin = -0.05f, curvedTextModifier = 0.001f;
|
|
|
|
|
public Gradient2 gradient2;
|
|
|
|
|
float gradient2Max = 1, gradient2Min = -1, gradient2Modifier = 0.01f;
|
|
|
|
|
public CylinderText cylinderText;
|
|
|
|
|
private Transform cylinderTextRT;
|
|
|
|
|
Vector3 cylinderRotation = new Vector3(0, 1, 0);
|
|
|
|
|
public SoftMaskScript SAUIM;
|
|
|
|
|
float SAUIMMax = 1, SAUIMMin = 0, SAUIMModifier = 0.01f;
|
|
|
|
|
// Use this for initialization
|
|
|
|
|
void Start()
|
2017-06-05 23:01:47 +08:00
|
|
|
|
{
|
2017-08-02 17:21:45 +08:00
|
|
|
|
cylinderTextRT = cylinderText.GetComponent<Transform>();
|
2017-06-05 23:01:47 +08:00
|
|
|
|
}
|
2017-08-02 17:21:45 +08:00
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
2017-06-05 23:01:47 +08:00
|
|
|
|
{
|
2017-08-02 17:21:45 +08:00
|
|
|
|
letterSpacing.spacing += letterSpacingModifier;
|
|
|
|
|
if (letterSpacing.spacing > letterSpacingMax || letterSpacing.spacing < letterSpacingMin)
|
|
|
|
|
{
|
|
|
|
|
letterSpacingModifier = -letterSpacingModifier;
|
|
|
|
|
}
|
|
|
|
|
curvedText.CurveMultiplier += curvedTextModifier;
|
|
|
|
|
if (curvedText.CurveMultiplier > curvedTextMax || curvedText.CurveMultiplier < curvedTextMin)
|
|
|
|
|
{
|
|
|
|
|
curvedTextModifier = -curvedTextModifier;
|
|
|
|
|
}
|
|
|
|
|
gradient2.Offset += gradient2Modifier;
|
|
|
|
|
if (gradient2.Offset > gradient2Max || gradient2.Offset < gradient2Min)
|
|
|
|
|
{
|
|
|
|
|
gradient2Modifier = -gradient2Modifier;
|
|
|
|
|
}
|
2017-06-05 23:01:47 +08:00
|
|
|
|
|
2017-08-02 17:21:45 +08:00
|
|
|
|
cylinderTextRT.Rotate(cylinderRotation);
|
2017-06-05 23:01:47 +08:00
|
|
|
|
|
2017-08-02 17:21:45 +08:00
|
|
|
|
SAUIM.CutOff += SAUIMModifier;
|
|
|
|
|
if (SAUIM.CutOff > SAUIMMax || SAUIM.CutOff < SAUIMMin)
|
|
|
|
|
{
|
|
|
|
|
SAUIMModifier = -SAUIMModifier;
|
|
|
|
|
}
|
2017-06-05 23:01:47 +08:00
|
|
|
|
|
2017-08-02 17:21:45 +08:00
|
|
|
|
}
|
2017-06-05 23:01:47 +08:00
|
|
|
|
}
|
2017-08-02 17:21:45 +08:00
|
|
|
|
}
|