/// <summary> /// Adds common hide animation effect. /// </summary> private void AddHideAniFrame <T>(T component, float targetTime) where T : IHasTransform, IHasAlpha { hideAni.AnimateFloat(a => component.Alpha = a) .AddTime(targetTime, 1f, EaseType.QuadEaseOut) .AddTime(targetTime + 0.25f, 0f) .Build(); hideAni.AnimateVector2(scale => component.Scale = scale) .AddTime(targetTime, Vector2.one, EaseType.QuadEaseOut) .AddTime(targetTime + 0.25f, new Vector2(1.25f, 1.25f)) .Build(); }
/// <summary> /// Adds common show animation effect. /// </summary> private void AddShowAniFrame <T>(T component, float targetTime, Vector2 targetPos) where T : IHasTransform, IHasAlpha { showAni.AnimateFloat(a => component.Alpha = a) .AddTime(targetTime, 0f, EaseType.QuadEaseOut) .AddTime(targetTime + 0.25f, 1f) .Build(); showAni.AnimateVector2(pos => component.Position = pos) .AddTime(0f, targetPos) .AddTime(targetTime, targetPos.GetTranslated(0f, -20f), EaseType.QuadEaseOut) .AddTime(targetTime + 0.25f, targetPos) .Build(); }
private void Init() { SpriteName = "glow-in-square-32"; ImageType = Image.Type.Sliced; RotationZ = 45f; AddEffect(new AdditiveShaderEffect()); anime = new Anime(); anime.AnimateFloat((alpha) => this.Alpha = alpha) .AddTime(0f, 0f, EaseType.QuadEaseOut) .AddTime(0.1f, 1f, EaseType.QuadEaseIn) .AddTime(0.25f, 0f) .Build(); anime.AnimateVector2((size) => this.Size = size) .AddTime(0f, new Vector2(PulseStartSize, PulseStartSize), EaseType.CubicEaseOut) .AddTime(0.25f, new Vector2(PulseFullSize, PulseFullSize)) .Build(); anime.AddEvent(anime.Duration, () => Recycler.Return(this)); }