public override void init()
 {
     color           = Color.red;
     color.a         = 0;
     fader           = new AlphaFade();
     fader.FadeState = AlphaFade.FADE_IN;
 }
Exemple #2
0
        public void ApplyFilter(CustomImageView imageView, ImageFilter imageFilter, Activity activity, ProgressBar progressbar)
        {
            ITransformation transform = null;

            switch (imageFilter.FilterName)
            {
            case "Circle crop":
                transform = new CropCircleTransformation(activity);
                break;

            case "Grayscale":
                transform = new GrayscaleTransformation();
                break;

            case "Inverted colors":
                transform = new InvertColorsTransformation();
                break;

            case "Blurred":
                transform = new BlurTransformation(activity);
                break;

            case "Alpha fade":
                transform = new AlphaFade(activity);
                break;

            case "Inverse circle crop":
                transform = new InvertCropCircleTransformation(activity);
                break;

            default:
                break;
            }

            Action onSucces = delegate {
                Animation fadeOut = new AlphaAnimation(0, 1);
                fadeOut.Interpolator = new AccelerateInterpolator();
                fadeOut.Duration     = 1000;
                imageView.StartAnimation(fadeOut);
                progressbar.Visibility = ViewStates.Gone;
            };

            Action onError = delegate {
            };


            if (transform != null)
            {
                Picasso.With(activity.ApplicationContext)
                .Load(imageFilter.ImageUrl)
                .Resize(IMAGE_SIZE, IMAGE_SIZE)
                .Transform(transform)
                .NoFade()
                .Into(imageView, onSucces, onError);
            }
            else
            {
                Picasso.With(activity.ApplicationContext)
                .Load(imageFilter.ImageUrl)
                .Resize(IMAGE_SIZE, IMAGE_SIZE)
                .NoFade()
                .Into(imageView, onSucces, onError);
            }
        }
Exemple #3
0
        public MotionPoint(RectangleF originBounds, MotionDirection direction, MotionSpeed speed, Color color, MotionPointCollection owner)
        {
            this._owner     = owner;
            this._orgBounds = originBounds;
            this._mDir      = direction;
            this._mSpd      = speed;
            this._clr       = color;
            this._bubble    = false;
            this._life      = 0;
            this._aFade     = AlphaFade.None;
            this._drwBounds = originBounds;
            this._xCen      = originBounds.Width / 2;
            this._yCen      = originBounds.Height / 2;

            if (owner != null)
            {
                rnd = this._owner.rnd;
            }
            else
            {
                rnd = new Random(Convert.ToInt32((DateTime.Now.Ticks / 20) + (DateTime.Now.Millisecond * (DateTime.Now.TimeOfDay.Ticks / 10))));
            }

            if (direction > MotionDirection.FromLeft)
            {
                // Calculate for Left/Right/Top/Bottom movement types.

                if (direction > MotionDirection.FromTop)
                {
                    // Top/Bottom
                    _xPos = rnd.Next((int)originBounds.Left, (int)originBounds.Right);
                    if (direction == MotionDirection.FromTop)
                    {
                        _yPos = originBounds.Top;
                    }
                    else
                    {
                        _yPos = originBounds.Bottom;
                    }
                }
                else
                {
                    // Left/Right
                    if (direction == MotionDirection.FromLeft)
                    {
                        _xPos = originBounds.Left;
                    }
                    else
                    {
                        _xPos = originBounds.Right;
                    }
                    _yPos = rnd.Next((int)originBounds.Top, (int)originBounds.Bottom);
                }
                _xSpd = rnd.Next(1, 10);
                _ySpd = rnd.Next(1, 10);
            }
            else
            {
                // For free-random origin types

                _xPos = rnd.Next((int)originBounds.Left, (int)originBounds.Right);
                _yPos = rnd.Next((int)originBounds.Top, (int)originBounds.Bottom);

                if (direction == MotionDirection.Zoom)
                {
                    _xSpd = (_xPos - _xCen) / 2;
                    _ySpd = (_yPos - _yCen) / 2;
                }
                else if (direction == MotionDirection.Bounce)
                {
                    _xSpd = rnd.Next(10) - 5;
                    if (_xSpd == 0)
                    {
                        _xSpd = 1 * System.Math.Sign((originBounds.Width / 2) - _xPos);
                    }

                    _ySpd = rnd.Next(10) - 5;
                    if (_ySpd == 0)
                    {
                        _ySpd = 1 * System.Math.Sign((originBounds.Height / 2) - _yPos);
                    }
                }
                else if (direction == MotionDirection.Snow)
                {
                    _xSpd = rnd.Next(1, 5);
                    _ySpd = rnd.Next(1, 5);
                }
                else if (direction == MotionDirection.Rotate)
                {
                    this.RotationPrecesion = 2;
                    _rad    = rnd.Next(2, (int)(originBounds.Width / 2));
                    _offset = rnd.Next(_rotPrec * 2);
                }
            }
        }