Beispiel #1
0
        protected override bool OnHover(InputState state)
        {
            icon.ClearTransformations();

            ResizeTo(size_extended, transform_time, EasingTypes.OutElastic);

            int duration = 0; //(int)(Game.Audio.BeatLength / 2);

            if (duration == 0)
            {
                duration = pulse_length;
            }

            double offset    = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
            double startTime = Time.Current + offset;

            // basic pulse
            icon.Transforms.Add(new TransformScale
            {
                StartValue = new Vector2(1.1f),
                EndValue   = Vector2.One,
                StartTime  = startTime,
                EndTime    = startTime + duration,
                Easing     = EasingTypes.Out,
                LoopCount  = -1,
                LoopDelay  = duration
            });

            return(true);
        }
Beispiel #2
0
        protected override bool OnHover(InputState state)
        {
            if (State != ButtonState.Expanded)
            {
                return(true);
            }

            //if (OsuGame.Instance.IsActive)
            //    Game.Audio.PlaySamplePositional($@"menu-{internalName}-hover", @"menuclick");

            box.ScaleTo(new Vector2(1.5f, 1), 500, EasingTypes.OutElastic);

            int duration = 0; //(int)(Game.Audio.BeatLength / 2);

            if (duration == 0)
            {
                duration = 250;
            }

            icon.ClearTransformations();

            icon.ScaleTo(1, 500, EasingTypes.OutElasticHalf);

            double offset    = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
            double startTime = Time.Current + offset;

            icon.RotateTo(10, offset, EasingTypes.InOutSine);
            icon.ScaleTo(new Vector2(1, 0.9f), offset, EasingTypes.Out);

            icon.Transforms.Add(new TransformRotation
            {
                StartValue = -10,
                EndValue   = 10,
                StartTime  = startTime,
                EndTime    = startTime + duration * 2,
                Easing     = EasingTypes.InOutSine,
                LoopCount  = -1,
                LoopDelay  = duration * 2
            });

            icon.Transforms.Add(new TransformPosition
            {
                StartValue = Vector2.Zero,
                EndValue   = new Vector2(0, -10),
                StartTime  = startTime,
                EndTime    = startTime + duration,
                Easing     = EasingTypes.Out,
                LoopCount  = -1,
                LoopDelay  = duration
            });

            icon.Transforms.Add(new TransformScale
            {
                StartValue = new Vector2(1, 0.9f),
                EndValue   = Vector2.One,
                StartTime  = startTime,
                EndTime    = startTime + duration,
                Easing     = EasingTypes.Out,
                LoopCount  = -1,
                LoopDelay  = duration
            });

            icon.Transforms.Add(new TransformPosition
            {
                StartValue = new Vector2(0, -10),
                EndValue   = Vector2.Zero,
                StartTime  = startTime + duration,
                EndTime    = startTime + duration * 2,
                Easing     = EasingTypes.In,
                LoopCount  = -1,
                LoopDelay  = duration
            });

            icon.Transforms.Add(new TransformScale
            {
                StartValue = Vector2.One,
                EndValue   = new Vector2(1, 0.9f),
                StartTime  = startTime + duration,
                EndTime    = startTime + duration * 2,
                Easing     = EasingTypes.In,
                LoopCount  = -1,
                LoopDelay  = duration
            });

            icon.Transforms.Add(new TransformRotation
            {
                StartValue = 10,
                EndValue   = -10,
                StartTime  = startTime + duration * 2,
                EndTime    = startTime + duration * 4,
                Easing     = EasingTypes.InOutSine,
                LoopCount  = -1,
                LoopDelay  = duration * 2
            });

            return(true);
        }