Пример #1
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            // Stops not working in current PanCake version

            //Color color1 = PancakeView.BackgroundGradientStops.First().Color;
            //Color color2 = PancakeView.BackgroundGradientStops.Last().Color;
            Color color1            = PancakeView.BackgroundGradientStartColor;
            Color color2            = PancakeView.BackgroundGradientEndColor;
            uint  animationDuration = 1000;

            while (true)
            {
                //await PancakeView.ColorTo(color1, color2, c => PancakeView.BackgroundGradientStops.First().Color = c, 5000, Easing.Linear);
                //await PancakeView.ColorTo(color2, color1, c => PancakeView.BackgroundGradientStops.Last().Color = c, 5000, Easing.Linear);
                //await PancakeView.ColorTo(color1, color2, c => PancakeView.BackgroundGradientStops.First().Color = c, 5000, Easing.Linear);
                //await PancakeView.ColorTo(color2, color1, c => PancakeView.BackgroundGradientStops.Last().Color = c, 5000, Easing.Linear);

                await PancakeView.ColorTo(color1, color2, c => PancakeView.BackgroundGradientStartColor = c, animationDuration, Easing.Linear);

                await PancakeView.ColorTo(color2, color1, c => PancakeView.BackgroundGradientEndColor = c, animationDuration, Easing.Linear);

                await PancakeView.ColorTo(color2, color1, c => PancakeView.BackgroundGradientStartColor = c, animationDuration, Easing.Linear);

                await PancakeView.ColorTo(color1, color2, c => PancakeView.BackgroundGradientEndColor = c, animationDuration, Easing.Linear);
            }
        }
Пример #2
0
        private async void Animation()
        {
            //e7f3ea
            //c2ccc5
            var colorOne = Color.FromHex("ffffff");
            var colorTwo = Color.FromHex("d8d8db");
            var fade     = 1.0;

            if (!clicked)
            {
                await Task.WhenAll(
                    this.ColorTo(colorOne, colorTwo, c => GradientOne.Color = c, 200),
                    PancakeView.ColorTo(colorTwo, colorOne, c => GradientTwo.Color = c, 200));
            }
            else
            {
                await Task.WhenAll(
                    this.ColorTo(colorTwo, colorOne, c => GradientOne.Color = c, 200),
                    PancakeView.ColorTo(colorOne, colorTwo, c => GradientTwo.Color = c, 200));
            }


            clicked = !clicked;
        }