public override void Start(GoogleMap googleMap, IList <PositionModel> route)
        {
            _googleMap = googleMap;
            if (_firstRunAnimSet == null)
            {
                _firstRunAnimSet = new AnimatorSet();
            }
            else
            {
                _firstRunAnimSet.RemoveAllListeners();
                _firstRunAnimSet.End();
                _firstRunAnimSet.Cancel();

                _firstRunAnimSet = new AnimatorSet();
            }

            LatLng[] bangaloreRoute = route.Select(e => new LatLng(e.Lat.GetValueOrDefault(0), e.Lng.GetValueOrDefault(0))).ToArray();

            if (bangaloreRoute.Length == 0)
            {
                return;
            }
            var foregroundRouteAnimator = ObjectAnimator.OfObject(this, "routeIncreaseForward", new RouteEvaluator(), bangaloreRoute.ToArray <Object>());

            foregroundRouteAnimator.SetInterpolator(new LinearInterpolator());
            foregroundRouteAnimator.SetDuration((long)TimeSpan.FromMinutes(3).TotalMilliseconds);
            foregroundRouteAnimator.RepeatCount = ValueAnimator.Infinite;
            _firstRunAnimSet.PlaySequentially(foregroundRouteAnimator);
            _firstRunAnimSet.Start();
        }
Пример #2
0
            private void CreateAnimation()
            {
                if (animation == null)
                {
                    var anim1 = ObjectAnimator.OfFloat(balls[0], "y", 0f, Height - balls[0].Height);
                    anim1.SetDuration(500);
                    var anim2 = anim1.Clone();
                    anim2.SetTarget(balls[1]);
                    anim1.Update += delegate { Invalidate(); };

                    var ball2    = balls[2];
                    var animDown = ObjectAnimator.OfFloat(ball2, "y", 0f, Height - ball2.Height);
                    animDown.SetDuration(500);
                    animDown.SetInterpolator(new AccelerateInterpolator());
                    var animUp = ObjectAnimator.OfFloat(ball2, "y", Height - ball2.Height, 0f);
                    animUp.SetDuration(500);
                    animUp.SetInterpolator(new DecelerateInterpolator());

                    var s1 = new AnimatorSet();
                    s1.PlaySequentially(animDown, animUp);
                    animDown.Update += delegate { Invalidate(); };
                    animUp.Update   += delegate { Invalidate(); };
                    var s2 = (AnimatorSet)s1.Clone();
                    s2.SetTarget(balls[3]);

                    animation = new AnimatorSet();
                    animation.PlayTogether(anim1, anim2, s1);
                    animation.PlaySequentially(s1, s2);
                }
            }
        public FlippingView(Context context, int width, int height)
            : base(context)
        {
            flipOutView = new ImageView(context);
            flipInView  = new ImageView(context);

            AddView(flipOutView, width, height);
            AddView(flipInView, width, height);

            flipInView.RotationY = -90;

            var flipOutAnimator = ObjectAnimator.OfFloat(flipOutView, "rotationY", 0, 90);

            flipOutAnimator.SetInterpolator(new AccelerateInterpolator());

            var flipInAnimator = ObjectAnimator.OfFloat(flipInView, "rotationY", -90, 0);

            flipInAnimator.SetInterpolator(new DecelerateInterpolator());

            animations = new AnimatorSet();
            animations.PlaySequentially(flipOutAnimator, flipInAnimator);

            animations.AnimationEnd += (sender, e) =>
            {
                flipOutView.RotationY = 0;
                flipInView.RotationY  = -90;

                Flipped?.Invoke(this, EventArgs.Empty);
            };
        }
Пример #4
0
        public FlippingView(Context context, Listener listener, int width, int height) : base(context)
        {
            this.listener    = listener;
            this.flipOutView = new ImageView(context);
            this.flipInView  = new ImageView(context);

            AddView(flipOutView, width, height);
            AddView(flipInView, width, height);

            flipInView.Rotation = -90;

            ObjectAnimator flipOutAnimator = ObjectAnimator.OfFloat(flipOutView, "rotationY", 0, 90);

            flipOutAnimator.SetInterpolator(new AccelerateInterpolator());
            Animator flipInAnimator = ObjectAnimator.OfFloat(flipInView, "rotationY", -90, 0);

            flipInAnimator.SetInterpolator(new DecelerateInterpolator());
            animations = new AnimatorSet();
            animations.PlaySequentially(flipOutAnimator, flipInAnimator);
            animations.SetDuration(1000);
            animations.AddListener(new AnimationListener()
            {
                AnimationEnd = (animation) =>
                {
                    flipOutView.Rotation = 0;
                    flipInView.Rotation  = -90;
                    listener.onFlipped(this);
                }
            });
        }
Пример #5
0
        /// <summary>
        /// Playes a series of animations.
        /// </summary>
        /// <param name="animations">The series of animations to be played.</param>
        protected void PlayAnimations(ObjectAnimator[] animations)
        {
            AnimatorSet animatorSet = new AnimatorSet();

            animatorSet.PlaySequentially(animations);
            animatorSet.Start();

            //animatorSet.AnimationEnd
            //animatorSet.Pause
        }
Пример #6
0
        public void StartAnimation(bool slowMode)
        {
            textBubble.Visibility = ViewStates.Visible;
            textBubble.PivotX     = textBubble.Width / 2;
            textBubble.PivotY     = 0;

            var fallTime = 270;
            var time     = 600;

            if (slowMode)
            {
                fallTime *= 4;
                time     *= 5;
            }

            var interpolator = curve.ToAndroidInterpolator();

            var deltaY   = TypedValue.ApplyDimension(ComplexUnitType.Dip, 200, Resources.DisplayMetrics);
            var animator = ObjectAnimator.OfPropertyValuesHolder(textBubble,
                                                                 PropertyValuesHolder.OfFloat("translationY", deltaY, 0),
                                                                 PropertyValuesHolder.OfFloat("alpha", 0, 1));

            animator.SetAutoCancel(true);
            animator.SetDuration(fallTime);
            animator.SetInterpolator(new Android.Views.Animations.AccelerateInterpolator());

            var squashStretch = ObjectAnimator.OfPropertyValuesHolder(textBubble,
                                                                      PropertyValuesHolder.OfFloat("scaleY", 1f, 0.4f),
                                                                      PropertyValuesHolder.OfFloat("scaleX", 1f, 1.1f));

            squashStretch.SetAutoCancel(true);
            squashStretch.SetDuration(time);
            squashStretch.SetInterpolator(interpolator);

            if (AnimationCurrentCompletion != null)
            {
                squashStretch.AnimationEnd += (sender, e) => {
                    AnimationCurrentCompletion(-1);
                    ((Animator)sender).RemoveAllListeners();
                };
                squashStretch.Update += (sender, e) => AnimationCurrentCompletion(e.Animation.CurrentPlayTime / (float)time);
            }

            var animSet = new AnimatorSet();

            animSet.PlaySequentially(animator, squashStretch);
            animSet.Start();
        }
        private void startTootipAnimation()
        {
            ObjectAnimator scaleY = ObjectAnimator.OfFloat(mTooltip, "scaleY", 0.8f);

            scaleY.SetDuration(200);
            ObjectAnimator scaleYBack = ObjectAnimator.OfFloat(mTooltip, "scaleY", 1f);

            scaleYBack.SetDuration(500);
            scaleYBack.SetInterpolator(new BounceInterpolator());
            AnimatorSet animatorSet = new AnimatorSet();

            animatorSet.StartDelay = 1000;
            animatorSet.PlaySequentially(scaleY, scaleYBack);
            animatorSet.AnimationEnd += (sender, e) =>
            {
                animatorSet.StartDelay = 2000;
                animatorSet.Start();
            };
            mTooltip.SetLayerType(LayerType.Hardware, null);
            animatorSet.Start();
        }
Пример #8
0
        public void SetCount(int count, bool animate)
        {
            if (!animate)
            {
                Count = count;
                return;
            }

            ValueAnimator outAnimator = null;

            if (this.count != 0)
            {
                outAnimator = ValueAnimator.OfInt(255, 0);
                outAnimator.SetDuration(250);
                outAnimator.Update       += (sender, e) => { currentBubbleTransparency = (int)e.Animation.AnimatedValue; Invalidate(); };
                outAnimator.AnimationEnd += (sender, e) => { this.count = count; outAnimator.RemoveAllListeners(); };
            }
            else
            {
                this.count = count;
            }

            var inAnimator = ValueAnimator.OfInt(0, 255);

            inAnimator.SetDuration(700);
            inAnimator.Update       += (sender, e) => { currentBubbleTransparency = (int)e.Animation.AnimatedValue; Invalidate(); };
            inAnimator.AnimationEnd += (sender, e) => inAnimator.RemoveAllListeners();

            if (outAnimator != null)
            {
                var set = new AnimatorSet();
                set.PlaySequentially(outAnimator, inAnimator);
                set.Start();
            }
            else
            {
                inAnimator.Start();
            }
        }
        private void SetupUserInterface()
        {
            mainLayout = new Android.Widget.RelativeLayout(Context);
            liveView   = new TextureView(Context);

            Android.Widget.RelativeLayout.LayoutParams liveViewParams = new Android.Widget.RelativeLayout.LayoutParams(
                LayoutParams.MatchParent,
                LayoutParams.MatchParent);
            liveView.LayoutParameters = liveViewParams;
            mainLayout.AddView(liveView);

            capturePhotoButtonSatart = new Button(Context);
            capturePhotoButtonSatart.SetBackgroundDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.startVideo));
            Android.Widget.RelativeLayout.LayoutParams captureButtonParamsStart = new Android.Widget.RelativeLayout.LayoutParams(
                LayoutParams.WrapContent,
                LayoutParams.WrapContent);
            captureButtonParamsStart.Height           = 120;
            captureButtonParamsStart.Width            = 120;
            capturePhotoButtonSatart.LayoutParameters = captureButtonParamsStart;
            mainLayout.AddView(capturePhotoButtonSatart);

            capturePhotoButtonStop = new Button(Context);
            capturePhotoButtonStop.SetBackgroundDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.stopVideo));
            Android.Widget.RelativeLayout.LayoutParams captureButtonParamsStop = new Android.Widget.RelativeLayout.LayoutParams(
                LayoutParams.WrapContent,
                LayoutParams.WrapContent);
            captureButtonParamsStop.Height          = 120;
            captureButtonParamsStop.Width           = 120;
            capturePhotoButtonStop.LayoutParameters = captureButtonParamsStop;
            capturePhotoButtonStop.Visibility       = ViewStates.Invisible;
            animatorSet = new AnimatorSet();
            animatorSet.PlaySequentially(
                ObjectAnimator.OfFloat(capturePhotoButtonStop, "alpha", 1, 0));
            animatorSet.SetDuration(0);
            //animationcapturePhotoInspectionButtonSet.AnimationEnd += EndAnimation;
            animatorSet.Start();
            mainLayout.AddView(capturePhotoButtonStop);
            AddView(mainLayout);
        }
Пример #10
0
        //@Override
        //@NonNull
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View view = base.GetView(position, convertView, parent);

            if (mInsertQueue.getActiveIndexes().Contains(position))
            {
                int widthMeasureSpec  = View.MeasureSpec.MakeMeasureSpec(ViewGroup.LayoutParams.MatchParent, MeasureSpecMode.AtMost);
                int heightMeasureSpec = View.MeasureSpec.MakeMeasureSpec(ViewGroup.LayoutParams.WrapContent, MeasureSpecMode.Unspecified);
                view.Measure(widthMeasureSpec, heightMeasureSpec);

                int originalHeight = view.MeasuredHeight;

                ValueAnimator heightAnimator = ValueAnimator.OfInt(1, originalHeight);
                heightAnimator.AddUpdateListener(new HeightUpdater(view));

                Animator[] customAnimators = getAdditionalAnimators(view, parent);
                Animator[] animators       = new Animator[customAnimators.Length + 1];
                animators[0] = heightAnimator;

                //System.arraycopy(customAnimators, 0, animators, 1, customAnimators.length);
                Array.Copy(customAnimators, 0, animators, 1, customAnimators.Length);

                AnimatorSet animatorSet = new AnimatorSet();
                animatorSet.PlayTogether(animators);

                //ViewHelper.setAlpha(view, 0);
                view.Alpha = 0;
                ObjectAnimator alphaAnimator = ObjectAnimator.OfFloat(view, ALPHA, 0, 1);

                AnimatorSet allAnimatorsSet = new AnimatorSet();
                allAnimatorsSet.PlaySequentially(animatorSet, alphaAnimator);

                allAnimatorsSet.SetDuration(mInsertionAnimationDurationMs);
                allAnimatorsSet.AddListener(new ExpandAnimationListener(this, position));
                allAnimatorsSet.Start();
            }

            return(view);
        }
Пример #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.menu_principal);

            //reproducir la musica principal
            player_musica_menu   = MediaPlayer.Create(this, Resource.Raw.menuMusic);
            player_up_sound      = MediaPlayer.Create(this, Resource.Raw.upMono);
            player_loteria_sound = MediaPlayer.Create(this, Resource.Raw.LOTERIA);
            player_letrero_sound = MediaPlayer.Create(this, Resource.Raw.loteriaLetrero);

            var btn_crear   = FindViewById <Button>(Resource.Id.btn_crear);
            var btn_unirse  = FindViewById <Button>(Resource.Id.btn_unirse);
            var txt_usuario = FindViewById <EditText>(Resource.Id.txt_usuario);
            var linearRojo  = FindViewById <LinearLayout>(Resource.Id.lineaRoja);
            var mono        = FindViewById <ImageView>(Resource.Id.mono);
            var fuegos      = FindViewById <LottieAnimationView>(Resource.Id.fuegos_artificiales);
            var letrero     = FindViewById <ImageView>(Resource.Id.letrero);

            //animar mono para que salga desde abajo
            var originalPosition = mono.TranslationY;
            //obtener la medida de la pantalla
            var metrics = Resources.DisplayMetrics;

            //poner por defecto la medida de la pantalla en la imagen
            mono.TranslationY = metrics.HeightPixels / 3;
            //correr la animacion para que suba el mono
            ObjectAnimator animatorY = ObjectAnimator.OfFloat(mono, "translationY", originalPosition);

            animatorY.SetDuration(3000);
            animatorY.Start();

            player_up_sound.Start();
            player_up_sound.Completion += delegate
            {
                player_letrero_sound.Start();
                //animar el letrero
                ObjectAnimator scaleDownX = ObjectAnimator.OfFloat(letrero, "scaleX", 1f);
                ObjectAnimator scaleDownY = ObjectAnimator.OfFloat(letrero, "scaleY", 1f);
                scaleDownX.SetDuration(200);
                scaleDownY.SetDuration(200);

                AnimatorSet scaleDown = new AnimatorSet();
                scaleDown.PlaySequentially(scaleDownX, scaleDownY);
                scaleDown.Start();
            };
            player_letrero_sound.Completion += delegate
            {
                fuegos.PlayAnimation();
                player_loteria_sound.Start();
                player_musica_menu.Start();
                player_musica_menu.Looping = true;

                ObjectAnimator alpha1 = ObjectAnimator.OfFloat(linearRojo, "alpha", 1);
                alpha1.SetDuration(1000);
                ObjectAnimator alpha2 = ObjectAnimator.OfFloat(btn_crear, "alpha", 1);
                alpha2.SetDuration(1000);
                ObjectAnimator alpha3 = ObjectAnimator.OfFloat(btn_unirse, "alpha", 1);
                alpha3.SetDuration(1000);
                alpha1.Start();
                alpha2.Start();
                alpha3.Start();
            };

            //poner el nombre de usuario si ya existia antes
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            txt_usuario.Text = prefs.GetString("pref_nombre_jugador", "");
            ISharedPreferencesEditor editor = prefs.Edit();

            editor.PutBoolean("pref_back_from_game", false);
            editor.Apply();

            btn_crear.Click += delegate
            {
                //comprobar si esta conectado a una red

                if (chekWiFiConnection())
                {
                    if (!string.IsNullOrEmpty(txt_usuario.Text))
                    {
                        prefs = PreferenceManager.GetDefaultSharedPreferences(this);
                        editor.PutString("pref_nombre_jugador", txt_usuario.Text);
                        // editor.Commit();    // applies changes synchronously on older APIs
                        editor.Apply();        // applies changes asynchronously on newer APIs

                        player_musica_menu.Stop();
                        var activity = new Intent(this, typeof(mesa_de_juego));
                        activity.PutExtra("jugador", txt_usuario.Text);
                        activity.PutExtra("cliente", "no");
                        StartActivity(activity);
                    }
                    else
                    {
                        Toast.MakeText(this, "Necesitas un nombre de usuario", ToastLength.Short).Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "Necesitas estar conectado a una red", ToastLength.Short).Show();
                }
            };

            btn_unirse.Click += delegate
            {
                if (!string.IsNullOrEmpty(txt_usuario.Text))
                {
                    prefs = PreferenceManager.GetDefaultSharedPreferences(this);
                    editor.PutString("pref_nombre_jugador", txt_usuario.Text);
                    // editor.Commit();    // applies changes synchronously on older APIs
                    editor.Apply();

                    player_musica_menu.Stop();
                    var activity = new Intent(this, typeof(mesa_de_juego));
                    activity.PutExtra("jugador", txt_usuario.Text);
                    activity.PutExtra("cliente", "si");
                    StartActivity(activity);
                }
                else
                {
                    Toast.MakeText(this, "Necesitas un nombre de usuario", ToastLength.Short).Show();
                }
            };
        }
Пример #12
0
        void Switch(Drawable src, ColorStateList tint)
        {
            const int ScaleDuration = 200;
            const int AlphaDuration = 150;
            const int AlphaInDelay  = 50;
            const int InitialDelay  = 100;

            if (switchAnimation != null)
            {
                switchAnimation.Cancel();
                switchAnimation = null;
            }

            var currentSrc = this.Drawable;

            // Scaling down animation
            var circleAnimOutX = ObjectAnimator.OfFloat(this, "scaleX", 1, 0.1f);
            var circleAnimOutY = ObjectAnimator.OfFloat(this, "scaleY", 1, 0.1f);

            circleAnimOutX.SetDuration(ScaleDuration);
            circleAnimOutY.SetDuration(ScaleDuration);

            // Alpha out of the icon
            var iconAnimOut = ObjectAnimator.OfInt(currentSrc, "alpha", 255, 0);

            iconAnimOut.SetDuration(AlphaDuration);

            var outSet = new AnimatorSet();

            outSet.PlayTogether(circleAnimOutX, circleAnimOutY, iconAnimOut);
            outSet.SetInterpolator(AnimationUtils.LoadInterpolator(Context,
                                                                   Android.Resource.Animation.AccelerateInterpolator));
            outSet.StartDelay    = InitialDelay;
            outSet.AnimationEnd += (sender, e) => {
                BackgroundTintList = tint;
                SetImageDrawable(src);
                JumpDrawablesToCurrentState();
                ((Animator)sender).RemoveAllListeners();
            };

            // Scaling up animation
            var circleAnimInX = ObjectAnimator.OfFloat(this, "scaleX", 0.1f, 1);
            var circleAnimInY = ObjectAnimator.OfFloat(this, "scaleY", 0.1f, 1);

            circleAnimInX.SetDuration(ScaleDuration);
            circleAnimInY.SetDuration(ScaleDuration);

            // Alpha in of the icon
            src.Alpha = 0;
            var iconAnimIn = ObjectAnimator.OfInt(src, "alpha", 0, 255);

            iconAnimIn.SetDuration(AlphaDuration);
            iconAnimIn.StartDelay = AlphaInDelay;

            var inSet = new AnimatorSet();

            inSet.PlayTogether(circleAnimInX, circleAnimInY, iconAnimIn);
            inSet.SetInterpolator(AnimationUtils.LoadInterpolator(Context,
                                                                  Android.Resource.Animation.DecelerateInterpolator));

            switchAnimation = new AnimatorSet();
            switchAnimation.PlaySequentially(outSet, inSet);
            switchAnimation.Start();
        }
            private void CreateAnimation()
            {
                if (animation == null)
                {
                    var anim1 = ObjectAnimator.OfFloat(balls[0], "y", 0f, Height - balls[0].Height);
                    anim1.SetDuration(500);
                    var anim2 = anim1.Clone();
                    anim2.SetTarget(balls[1]);
                    anim1.Update += delegate { Invalidate(); };

                    var ball2 = balls[2];
                    var animDown = ObjectAnimator.OfFloat(ball2, "y", 0f, Height - ball2.Height);
                    animDown.SetDuration(500);
                    animDown.SetInterpolator(new AccelerateInterpolator());
                    var animUp = ObjectAnimator.OfFloat(ball2, "y", Height - ball2.Height, 0f);
                    animUp.SetDuration(500);
                    animUp.SetInterpolator(new DecelerateInterpolator());

                    var s1 = new AnimatorSet();
                    s1.PlaySequentially(animDown, animUp);
                    animDown.Update += delegate { Invalidate(); };
                    animUp.Update += delegate { Invalidate(); };
                    var s2 = (AnimatorSet)s1.Clone();
                    s2.SetTarget(balls[3]);

                    animation = new AnimatorSet();
                    animation.PlayTogether(anim1, anim2, s1);
                    animation.PlaySequentially(s1, s2);
                }
            }
Пример #14
0
        public override Animator CreateAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues)
        {
            if (startValues == null || endValues == null)
            {
                return(null);
            }
            var startBounds = (Rect)startValues.Values[PROPERTY_BOUNDS];
            var endBounds   = (Rect)endValues.Values[PROPERTY_BOUNDS];

            if (startBounds == null || endBounds == null || startBounds.Equals(endBounds))
            {
                return(null);
            }

            var      startImage      = (Bitmap)startValues.Values[PROPERTY_IMAGE];
            Drawable startBackground = new BitmapDrawable(sceneRoot.Context.Resources, startImage);

            _startView = AddViewToOverlay(sceneRoot, startImage.Width,
                                          startImage.Height, startBackground);
            Drawable shrinkingBackground = new ColorDrawable(new Color(_color));

            _shrinkingView = AddViewToOverlay(sceneRoot, startImage.Width,
                                              startImage.Height, shrinkingBackground);

            var sceneRootLoc = new int[2];

            sceneRoot.GetLocationInWindow(sceneRootLoc);
            var startLoc          = (int[])startValues.Values[PROPERTY_POSITION];
            var startTranslationX = startLoc[0] - sceneRootLoc[0];
            var startTranslationY = startLoc[1] - sceneRootLoc[1];

            _startView.TranslationX     = startTranslationX;
            _startView.TranslationY     = startTranslationY;
            _shrinkingView.TranslationX = startTranslationX;
            _shrinkingView.TranslationY = startTranslationY;

            _endView = endValues.View;
            var startRadius = CalculateMaxRadius(_shrinkingView);
            var minRadius   = Math.Min(CalculateMinRadius(_shrinkingView), CalculateMinRadius(_endView));

            var circleBackground = new ShapeDrawable(new OvalShape());

            circleBackground.Paint.Color = new Color(_color);
            _circleView = AddViewToOverlay(sceneRoot, minRadius * 2, minRadius * 2,
                                           circleBackground);
            float circleStartX = startLoc[0] - sceneRootLoc[0] +
                                 ((_startView.Width - _circleView.Width) / 2);
            float circleStartY = startLoc[1] - sceneRootLoc[1] +
                                 ((_startView.Height - _circleView.Height) / 2);

            _circleView.TranslationX = circleStartX;
            _circleView.TranslationY = circleStartY;

            _circleView.Visibility = ViewStates.Invisible;
            _shrinkingView.Alpha   = 0f;
            _endView.Alpha         = 0f;

            var shrinkingAnimator = CreateCircularReveal(_shrinkingView, startRadius, minRadius);

            shrinkingAnimator.AddListener(new ShrinkingAnimator());

            var startAnimator  = CreateCircularReveal(_startView, startRadius, minRadius);
            var fadeInAnimator = ObjectAnimator.OfFloat(_shrinkingView, "angle", 0, 1);  // <<<<==================

            var shrinkFadeSet = new AnimatorSet();

            shrinkFadeSet.PlayTogether(shrinkingAnimator, startAnimator, fadeInAnimator);

            var   endLoc     = (int[])endValues.Values[PROPERTY_POSITION];
            float circleEndX = endLoc[0] - sceneRootLoc[0] +
                               ((_endView.Width - _circleView.Width) / 2);
            float circleEndY = endLoc[1] - sceneRootLoc[1] +
                               ((_endView.Height - _circleView.Height) / 2);
            var      circlePath     = PathMotion.GetPath(circleStartX, circleStartY, circleEndX, circleEndY);
            Animator circleAnimator = ObjectAnimator.OfFloat(_circleView, View.X,
                                                             View.Y, circlePath);

            _growingView = AddViewToOverlay(sceneRoot, _endView.Width,
                                            _endView.Height, shrinkingBackground);
            _growingView.Visibility = ViewStates.Invisible;
            float endTranslationX = endLoc[0] - sceneRootLoc[0];
            float endTranslationY = endLoc[1] - sceneRootLoc[1];

            _growingView.TranslationX = endTranslationX;
            _growingView.TranslationY = endTranslationY;

            var endRadius = CalculateMaxRadius(_endView);

            circleAnimator.AddListener(new CircleAnimator());

            Animator fadeOutAnimator = ObjectAnimator.OfFloat(_growingView, "angle", 1, 0); //<<<============
            var      endAnimator     = CreateCircularReveal(_endView, minRadius, endRadius);
            var      growingAnimator = CreateCircularReveal(_growingView, minRadius, endRadius);

            growingAnimator.AddListener(new GrowingAnimator(sceneRoot));
            var growingFadeSet = new AnimatorSet();

            growingFadeSet.PlayTogether(fadeOutAnimator, endAnimator, growingAnimator);

            var animatorSet = new AnimatorSet();

            animatorSet.PlaySequentially(shrinkFadeSet, circleAnimator, growingFadeSet);
            return(animatorSet);
        }
Пример #15
0
        private async void OnRequestOnboardingPage(OnboardingViewModel oVm)
        {
            _viewModel = oVm;
            AnimationInitUI();
            BindEvents();

            var mainAnimatorSet = new AnimatorSet();

            var appNameLayoutFinalTopSpace = TypedValue.ApplyDimension(ComplexUnitType.Dip, 55.0f, Application.Context.Resources.DisplayMetrics);

            var decelerateInterpolator = new DecelerateInterpolator(1.0f);

            var appNameLayoutAnimator = new ValueAnimator();

            appNameLayoutAnimator.SetDuration(750);
            appNameLayoutAnimator.SetInterpolator(decelerateInterpolator);
            appNameLayoutAnimator.SetFloatValues(_appNameLayout.GetY(), appNameLayoutFinalTopSpace);
            appNameLayoutAnimator.Update += (o, args) => { _appNameLayout.SetY((float)args.Animation.AnimatedValue); };

            var whatAccountsAnimator = new ValueAnimator();

            whatAccountsAnimator.SetDuration(750);
            whatAccountsAnimator.SetInterpolator(decelerateInterpolator);
            whatAccountsAnimator.SetFloatValues(0.0f, 1.0f);
            whatAccountsAnimator.Update += (o, args) => { _whatAccounts.Alpha = (float)args.Animation.AnimatedValue; };

            var appNameAnimationSet = new AnimatorSet();

            appNameAnimationSet.PlayTogether(appNameLayoutAnimator, whatAccountsAnimator);


            var socialButtonsAnimatorSet = new AnimatorSet();

            var overshootInterpolator = new OvershootInterpolator(3f);

            var facebookButtonAnimator = new ValueAnimator();

            facebookButtonAnimator.SetDuration(500);
            facebookButtonAnimator.SetInterpolator(overshootInterpolator);
            facebookButtonAnimator.SetFloatValues(_facebookButton.GetY() + _facebookButton.Height, _facebookButton.GetY());
            facebookButtonAnimator.Update += (o, args) =>
            {
                _facebookButton.SetY((float)args.Animation.AnimatedValue);
                _facebookButton.Alpha = args.Animation.AnimatedFraction;
            };

            var twitterButtonAnimator = new ValueAnimator();

            twitterButtonAnimator.SetDuration(500);
            twitterButtonAnimator.SetInterpolator(overshootInterpolator);
            twitterButtonAnimator.SetFloatValues(_facebookButton.GetY() + _facebookButton.Height, _facebookButton.GetY());
            twitterButtonAnimator.Update += (o, args) =>
            {
                _twitterButton.SetY((float)args.Animation.AnimatedValue);
                _twitterButton.Alpha = args.Animation.AnimatedFraction;
            };
            socialButtonsAnimatorSet.PlaySequentially(facebookButtonAnimator, twitterButtonAnimator);
            socialButtonsAnimatorSet.StartDelay = 500;

            var letsGoButtonAnimator = new ValueAnimator();

            letsGoButtonAnimator.SetDuration(500);
            letsGoButtonAnimator.SetInterpolator(decelerateInterpolator);
            letsGoButtonAnimator.SetFloatValues(0.0f, 1.0f);
            letsGoButtonAnimator.Update += (sender, args) =>
            {
                _goButton.Alpha = (float)args.Animation.AnimatedValue;
            };

            mainAnimatorSet.PlaySequentially(appNameAnimationSet, socialButtonsAnimatorSet, letsGoButtonAnimator);

            await _viewModel.DidLoad();

            await Task.Delay(2000);

            mainAnimatorSet.Start();
            await _viewModel.DidAppear();
        }