Esempio n. 1
0
        public ShineView(Context context, ShineButton shineButton, ShineParams shineParams) : base(context)
        {
            initShineParams(shineParams, shineButton);


            this.shineAnimator       = new ShineAnimator(animDuration, shineDistanceMultiple, clickAnimDuration);
            ValueAnimator.FrameDelay = FRAME_REFRESH_DELAY;
            this.shineButton         = shineButton;


            paint             = new Paint();
            paint.Color       = bigShineColor;
            paint.StrokeWidth = 20;
            paint.SetStyle(Paint.Style.Stroke);
            paint.StrokeCap = Paint.Cap.Round;

            paint2             = new Paint();
            paint2.Color       = Color.White;
            paint2.StrokeWidth = 20;
            paint2.StrokeCap   = Paint.Cap.Round;

            paintSmall             = new Paint();
            paintSmall.Color       = smallShineColor;
            paintSmall.StrokeWidth = 10;
            paintSmall.SetStyle(Paint.Style.Stroke);
            paintSmall.StrokeCap = Paint.Cap.Round;

            clickAnimator            = ValueAnimator.OfFloat(0f, 1.1f);
            ValueAnimator.FrameDelay = FRAME_REFRESH_DELAY;
            clickAnimator.SetDuration(clickAnimDuration);
            clickAnimator.SetInterpolator(new XEI(Ease.QUART_OUT));

            clickAnimator.AddUpdateListener(new XAnimatorUpdateListener()
            {
                AnimationUpdate = (valueAnimator) =>
                {
                    clickValue = (float)valueAnimator.AnimatedValue;
                    Invalidate();
                }
            });

            clickAnimator.AddListener(new XAnimatorListener()
            {
                End = (animator) =>
                {
                    clickValue = 0;
                    Invalidate();
                }
            });

            shineAnimator.AddListener(new XAnimatorListener()
            {
                End = (animator) =>
                {
                    shineButton.removeView(this);
                }
            });
        }
Esempio n. 2
0
        public ShineView(Context context, ShineButtonControl shineButton, ShineParams shineParams, ColourSet randomColourSet = null) : base(context)
        {
            // Populate a custom selection of random colours if provided
            if (randomColourSet != null && randomColourSet.ColourSelection?.Length != 0)
            {
                suppliedColorRandom = randomColourSet.ColourSelection;
            }

            InitShineParams(shineParams, shineButton);

            this.shineAnimator       = new ShineAnimator(animDuration, shineDistanceMultiple, clickAnimDuration);
            ValueAnimator.FrameDelay = FRAME_REFRESH_DELAY;
            this.shineButton         = shineButton;

            paint             = new Paint();
            paint.Color       = bigShineColor;
            paint.StrokeWidth = 20;
            paint.SetStyle(Paint.Style.Stroke);
            paint.StrokeCap = Paint.Cap.Round;

            paint2             = new Paint();
            paint2.Color       = Color.White;
            paint2.StrokeWidth = 20;
            paint2.StrokeCap   = Paint.Cap.Round;

            paintSmall             = new Paint();
            paintSmall.Color       = smallShineColor;
            paintSmall.StrokeWidth = 10;
            paintSmall.SetStyle(Paint.Style.Stroke);
            paintSmall.StrokeCap = Paint.Cap.Round;

            clickAnimator            = ValueAnimator.OfFloat(0f, 1.1f);
            ValueAnimator.FrameDelay = FRAME_REFRESH_DELAY;
            clickAnimator.SetDuration(clickAnimDuration);
            clickAnimator.SetInterpolator(new EasingInterpolator(Ease.QuartOut));

            clickAnimator.Update += (s, e) =>
            {
                clickValue = (float)e.Animation.AnimatedValue;
                Invalidate();
            };

            clickAnimator.AnimationEnd += (s, e) =>
            {
                clickValue = 0;
                Invalidate();
            };

            shineAnimator.AnimationEnd += (s, e) =>
            {
                shineButton.RemoveView(this);
            };
        }
Esempio n. 3
0
        private void initShineParams(ShineParams shineParams, ShineButton shineButton)
        {
            shineCount            = shineParams.shineCount;
            turnAngle             = shineParams.shineTurnAngle;
            smallOffsetAngle      = shineParams.smallShineOffsetAngle;
            enableFlashing        = shineParams.enableFlashing;
            allowRandomColor      = shineParams.allowRandomColor;
            shineDistanceMultiple = shineParams.shineDistanceMultiple;
            animDuration          = shineParams.animDuration;
            clickAnimDuration     = shineParams.clickAnimDuration;
            smallShineColor       = shineParams.smallShineColor;
            bigShineColor         = shineParams.bigShineColor;
            shineSize             = shineParams.shineSize;
            if (smallShineColor == 0)
            {
                smallShineColor = colorRandom[6];
            }

            if (bigShineColor == 0)
            {
                bigShineColor = shineButton.getColor();
            }
        }
Esempio n. 4
0
        private void InitShineParams(ShineParams shineParams, ShineButtonControl shineButton)
        {
            shineCount            = shineParams.ShineCount;
            turnAngle             = shineParams.ShineTurnAngle;
            smallOffsetAngle      = shineParams.SmallShineOffsetAngle;
            enableFlashing        = shineParams.EnableFlashing;
            useRandomColor        = shineParams.UseRandomColor;
            shineDistanceMultiple = shineParams.ShineDistanceMultiple;
            animDuration          = shineParams.AnimDuration;
            clickAnimDuration     = shineParams.ClickAnimDuration;
            smallShineColor       = shineParams.SmallShineColor;
            bigShineColor         = shineParams.BigShineColor;
            shineSize             = shineParams.ShineSize;

            if (smallShineColor == 0)
            {
                smallShineColor = internalColorRandom[0];
            }

            if (bigShineColor == 0)
            {
                bigShineColor = internalColorRandom[1];
            }
        }