public Other2Switch()
        {
            InitializeComponent();
            SwitchPanUpdate += (sender, e) =>
            {
                Color fromColorGradient1 = IsToggled ? Color.FromHex("#a8ff78") : Color.FromHex("#FF512F");
                Color toColorGradient1   = IsToggled ? Color.FromHex("#FF512F") : Color.FromHex("#a8ff78");

                Color fromColorGradient2 = IsToggled ? Color.FromHex("#78ffd6") : Color.FromHex("#DD2476");
                Color toColorGradient2   = IsToggled ? Color.FromHex("#DD2476") : Color.FromHex("#78ffd6");

                double t = e.Percentage * 0.01;

                KnobColorGradientStops = new Xamarin.Forms.PancakeView.GradientStopCollection
                {
                    new Xamarin.Forms.PancakeView.GradientStop
                    {
                        Color  = ColorAnimationUtil.ColorAnimation(fromColorGradient1, toColorGradient1, t),
                        Offset = 0
                    },
                    new Xamarin.Forms.PancakeView.GradientStop
                    {
                        Color  = ColorAnimationUtil.ColorAnimation(fromColorGradient2, toColorGradient2, t),
                        Offset = 1
                    }
                };
            };
        }
Exemplo n.º 2
0
        public static T BackgroundGradientStops <T>(this T pancakeview, params GradientStop[] gradientStops) where T : IRxPancakeView
        {
            var gradientStopsCollection = new GradientStopCollection();

            foreach (var gradientStop in gradientStops)
            {
                gradientStopsCollection.Add(gradientStop);
            }
            pancakeview.BackgroundGradientStops = gradientStopsCollection;
            return(pancakeview);
        }
        public static Xamarin.Forms.PancakeView.GradientStopCollection GetRandomGradient()
        {
            var gradient  = new Xamarin.Forms.PancakeView.GradientStopCollection();
            var itemCount = _randomGen.Next(2, 7);

            for (int i = 0; i < itemCount; i++)
            {
                gradient.Add(new Xamarin.Forms.PancakeView.GradientStop {
                    Color = GetRandomColor(), Offset = (1.0f / itemCount) * i
                });
            }

            return(gradient);
        }
Exemplo n.º 4
0
        //public static T BorderThickness<T>(this T pancakeview, float borderThickness) where T : IRxPancakeView
        //{
        //    pancakeview.BorderThickness = borderThickness;
        //    return pancakeview;
        //}

        //public static T BorderDashPattern<T>(this T pancakeview, DashPattern borderDashPattern) where T : IRxPancakeView
        //{
        //    pancakeview.BorderDashPattern = borderDashPattern;
        //    return pancakeview;
        //}

        //public static T BorderColor<T>(this T pancakeview, Color borderColor) where T : IRxPancakeView
        //{
        //    pancakeview.BorderColor = borderColor;
        //    return pancakeview;
        //}

        //public static T BorderDrawingStyle<T>(this T pancakeview, BorderDrawingStyle borderDrawingStyle) where T : IRxPancakeView
        //{
        //    pancakeview.BorderDrawingStyle = borderDrawingStyle;
        //    return pancakeview;
        //}

        //public static T BackgroundGradientAngle<T>(this T pancakeview, int backgroundGradientAngle) where T : IRxPancakeView
        //{
        //    pancakeview.BackgroundGradientAngle = backgroundGradientAngle;
        //    return pancakeview;
        //}

        public static T BackgroundGradientStops <T>(this T pancakeview, GradientStopCollection gradientStops) where T : IRxPancakeView
        {
            pancakeview.BackgroundGradientStops = gradientStops;
            return(pancakeview);
        }