private void Init() { glowSprite = CreateChild <UguiSprite>("glow"); { glowSprite.Size = new Vector2(BaseSize + GlowSizeOffset, BaseSize + GlowSizeOffset); glowSprite.SpriteName = "glow-square-32"; glowSprite.ImageType = Image.Type.Sliced; glowSprite.Color = ColorPreset.SecondaryFocus; glowSprite.RotationZ = 45f; glowSprite.IsRaycastTarget = false; } fillSprite = CreateChild <UguiSprite>("fill"); { fillSprite.Anchor = AnchorType.Fill; fillSprite.Offset = Offset.Zero; fillSprite.Color = ColorPreset.SecondaryFocus; fillSprite.RotationZ = 45f; fillSprite.IsRaycastTarget = false; fillSprite.AddEffect(new AdditiveShaderEffect()); } showAni = new Anime(); showAni.AnimateFloat((alpha) => glowSprite.Alpha = alpha) .AddTime(0f, 0f) .AddTime(0.05f, 0f, EaseType.QuadEaseOut) .AddTime(0.15f, 1f) .Build(); showAni.AnimateFloat((alpha) => fillSprite.Alpha = alpha) .AddTime(0f, 0.85f, EaseType.QuadEaseOut) .AddTime(0.15f, 0.25f) .Build(); showAni.AnimateVector2((size) => fillSprite.Size = size) .AddTime(0f, new Vector2(BaseSize + ShowShrinkSize, BaseSize + ShowShrinkSize), EaseType.CubicEaseOut) .AddTime(0.15f, new Vector2(BaseSize, BaseSize)) .Build(); showAni.AddEvent(showAni.Duration, () => repeatAni.PlayFromStart()); hideAni = new Anime(); hideAni.AddEvent(0f, () => repeatAni.Pause()); hideAni.AnimateFloat((alpha) => glowSprite.Alpha = alpha) .AddTime(0f, () => glowSprite.Alpha) .AddTime(0.25f, 0f) .Build(); hideAni.AnimateFloat((alpha) => fillSprite.Alpha = alpha) .AddTime(0f, () => fillSprite.Alpha) .AddTime(0.25f, 0f) .Build(); hideAni.AddEvent(hideAni.Duration, () => Recycler.Return(this)); repeatAni = new Anime() { WrapMode = WrapModeType.Loop, }; repeatAni.AnimateFloat((alpha) => fillSprite.Alpha = alpha) .AddTime(0f, 0.25f, EaseType.QuadEaseOut) .AddTime(0.4f, 0.75f, EaseType.QuadEaseIn) .AddTime(0.8f, 0.25f) .Build(); }
private void Init() { SpriteName = "glow-128"; IsRaycastTarget = false; Alpha = 0f; AddEffect(new AdditiveShaderEffect()); effectAni = new Anime() { StopMode = StopModeType.None }; effectAni.AnimateVector2(s => this.Size = s) .AddTime(0f, Vector2.zero, EaseType.CubicEaseOut) .AddTime(0.25f, () => new Vector2(targetWidth, 8000)) .Build(); effectAni.AnimateFloat(a => this.Alpha = a) .AddTime(0f, 1f, EaseType.QuadEaseIn) .AddTime(0.25f, 0f) .Build(); effectAni.AddEvent(effectAni.Duration, () => Recycler.Return(this)); }