Example #1
0
        public void Play(long duration, long playFrom = 0)
        {
            waterAnimator.SetDuration(duration);
            waterAnimator.Start();

            foreach (var anim in waterTranslateSet.ChildAnimations)
            {
                (anim as ValueAnimator).CurrentPlayTime = playFrom;
            }

            foreach (var anim in waterScaleSet.ChildAnimations)
            {
                (anim as ValueAnimator).CurrentPlayTime = playFrom;
            }
        }
Example #2
0
        private static AnimatorSet AnimateWaves(ImageView wave1, ImageView wave2, bool reverse = false)
        {
            var wave1X           = 0;
            var wave1TranslateTo = wave1.Width;

            var wave2X           = -wave2.Width;
            var wave2TranslateTo = 0;

            if (reverse)
            {
                wave1X           = wave2.Width;
                wave1TranslateTo = 0;

                wave2X           = 0;
                wave2TranslateTo = -wave2.Width;
            }

            wave1.TranslationX = wave1X;
            wave2.TranslationX = wave2X;

            var wave1TranslateX = AnimateRepeat(wave1, "translationX", wave1TranslateTo);
            var wave2TranslateX = AnimateRepeat(wave2, "translationX", wave2TranslateTo);

            var waveSet = new AnimatorSet();

            waveSet.SetDuration(1000);
            waveSet.SetInterpolator(new Android.Views.Animations.LinearInterpolator());
            waveSet.Play(wave1TranslateX).With(wave2TranslateX);

            return(waveSet);
        }
 private async void EndAnimation(object sender, EventArgs e)
 {
     animationcapturePhotoInspectionButtonSet = new AnimatorSet();
     if (clickNameBtn == "capturePhotoInspectionButton")
     {
         animationcapturePhotoInspectionButtonSet.PlayTogether(
             ObjectAnimator.OfFloat(capturePhotoInspectionButton, "scaleX", 0.8f, 1f),
             ObjectAnimator.OfFloat(capturePhotoInspectionButton, "scaleY", 0.8f, 1f));
     }
     else if (clickNameBtn == "capturePhotoButton")
     {
         animationcapturePhotoInspectionButtonSet.PlayTogether(
             ObjectAnimator.OfFloat(scanPhotoButton, "scaleX", 0.8f, 1f),
             ObjectAnimator.OfFloat(scanPhotoButton, "scaleY", 0.8f, 1f));
     }
     else if (clickNameBtn == "capturePhotoButton")
     {
         animationcapturePhotoInspectionButtonSet.PlayTogether(
             ObjectAnimator.OfFloat(capturePhotoButton, "scaleX", 0.8f, 1f),
             ObjectAnimator.OfFloat(capturePhotoButton, "scaleY", 0.8f, 1f));
     }
     else if (clickNameBtn == "capturePhotoInspectionButton")
     {
         animationcapturePhotoInspectionButtonSet.PlayTogether(
             ObjectAnimator.OfFloat(capturePhotoInspectionButton, "scaleX", 0.8f, 1f),
             ObjectAnimator.OfFloat(capturePhotoInspectionButton, "scaleY", 0.8f, 1f));
     }
     animationcapturePhotoInspectionButtonSet.SetDuration(400);
     animationcapturePhotoInspectionButtonSet.Start();
 }
        public static void showPopupSettings()
        {
            RelativeLayout popupContainer = (RelativeLayout)Shared.Activity.FindViewById(Resource.Id.popup_container);

            popupContainer.RemoveAllViews();

            // background
            ImageView imageView = new ImageView(Application.Context);

            imageView.SetBackgroundColor(Color.ParseColor("#88555555"));
            imageView.LayoutParameters = new RelativeLayout.LayoutParams(1, 1);
            imageView.Clickable        = true;
            popupContainer.AddView(imageView);

            // popup
            PopupSettingsView popupSettingsView = new PopupSettingsView(Application.Context);
            int width  = Application.Context.Resources.GetDimensionPixelSize(Resource.Dimension.popup_settings_width);
            int height = Application.Context.Resources.GetDimensionPixelSize(Resource.Dimension.popup_settings_height);

            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(width, height);
            layoutParams.AddRule(LayoutRules.CenterInParent);
            popupContainer.AddView(popupSettingsView, layoutParams);

            // animate all together
            ObjectAnimator scaleXAnimator = ObjectAnimator.OfFloat(popupSettingsView, "scaleX", 0f, 1f);
            ObjectAnimator scaleYAnimator = ObjectAnimator.OfFloat(popupSettingsView, "scaleY", 0f, 1f);
            ObjectAnimator alphaAnimator  = ObjectAnimator.OfFloat(imageView, "alpha", 0f, 1f);
            AnimatorSet    animatorSet    = new AnimatorSet();

            animatorSet.PlayTogether(scaleXAnimator, scaleYAnimator, alphaAnimator);
            animatorSet.SetDuration(500);
            animatorSet.SetInterpolator(new DecelerateInterpolator(2));
            animatorSet.Start();
        }
Example #5
0
        private AnimatorSet BuildExpandingAnimatorSet(ImageView expandedView, Rect startBounds, Rect finalBounds, float startScale)
        {
            // Each expanding animator is unique to the start location - we'll cache the AnimatorSet
            // instance based on the starting location.
            int key = startBounds.GetHashCode();

            if (_expandingAnimators.ContainsKey(key))
            {
                return(_expandingAnimators[key]);
            }

            AnimatorSet expandSet = new AnimatorSet();

            expandSet.Play(ObjectAnimator.OfFloat(expandedView, View.X, startBounds.Left, finalBounds.Left))
            .With(ObjectAnimator.OfFloat(expandedView, View.Y, startBounds.Top, finalBounds.Top))
            .With(ObjectAnimator.OfFloat(expandedView, "ScaleX", startScale, 1f))
            .With(ObjectAnimator.OfFloat(expandedView, "ScaleY", startScale, 1f));
            expandSet.SetDuration(_shortAnimationDuration);
            expandSet.SetInterpolator(new DecelerateInterpolator());
            expandSet.AnimationEnd    += NullOutCurrentAnimator;
            expandSet.AnimationCancel += NullOutCurrentAnimator;

            _expandingAnimators.Add(key, expandSet);
            return(expandSet);
        }
Example #6
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);
                }
            });
        }
Example #7
0
        private void Animator()
        {
            var paddingTop = Resources.GetDimensionPixelSize(Resource.Dimension.scroll_padding_top);

            var scrollAnimator = ViewPropertyObjectAnimator
                                 .Animate(scrollView)
                                 .ScrollY(paddingTop)
                                 .Get();

            var imageAnimator = ViewPropertyObjectAnimator
                                .Animate(imageView)
                                .VerticalMargin(140)
                                .RightMarginBy(10)
                                .Width(600)
                                .Height(700)
                                .RotationXBy(20)
                                .TopPadding(10)
                                .RotationY(360)
                                .LeftPaddingBy(100)
                                .RightPadding(300)
                                .Get();

            animatorSet?.Cancel();

            animatorSet = new AnimatorSet();
            animatorSet.PlayTogether(scrollAnimator, imageAnimator);
            animatorSet.SetDuration(2000);
            animatorSet.Start();
        }
Example #8
0
        public ExpandHelper(Context context, Callback callback, int small, int large)
        {
            this.smallSize      = small;
            this.maximumStretch = Math.Max(smallSize, 1) * StretchInterval;
            this.largeSize      = large;
            this.context        = context;
            this.callback       = callback;
            this.scaler         = new ViewScaler();
            this.gravity        = GravityFlags.Top;

            //this.scaleAnimation = ObjectAnimator.OfFloat (scaler, "Height", 0f);
            this.scaleAnimation         = ValueAnimator.OfFloat(0f);
            this.scaleAnimation.Update += (sender, e) => scaler.Height = (float)e.Animation.AnimatedValue;
            this.scaleAnimation.SetDuration(ExpandDuration);

            AnimatorListenerAdapter glowVisibilityController = new AnimatorListener();

            glowTopAnimation = ObjectAnimator.OfFloat(null, "alpha", 0f);
            glowTopAnimation.AddListener(glowVisibilityController);
            glowBottomAnimation = ObjectAnimator.OfFloat(null, "alpha", 0f);
            glowBottomAnimation.AddListener(glowVisibilityController);
            glowAnimationSet = new AnimatorSet();
            glowAnimationSet.Play(glowTopAnimation).With(glowBottomAnimation);
            glowAnimationSet.SetDuration(GlowDuration);

            detector = new DoubleSwipeDetector(context, new GestureDetector(this));
        }
Example #9
0
        /**
         * Toogle the play/pause status
         *
         * @param withAnim false to change status without animation
         */
        public void Toggle(bool withAnim)
        {
            if (withAnim)
            {
                if (mAnimatorSet != null)
                {
                    mAnimatorSet.Cancel();
                }

                mAnimatorSet = new AnimatorSet();
                bool           isPlay    = mDrawable.IsPlay();
                ObjectAnimator colorAnim = ObjectAnimator.OfInt(this, "color", isPlay ? mPauseBackgroundColor : mPlayBackgroundColor);
                colorAnim.SetEvaluator(new ArgbEvaluator());
                Animator pausePlayAnim = mDrawable.GetPausePlayAnimator();
                mAnimatorSet.SetInterpolator(new DecelerateInterpolator());
                mAnimatorSet.SetDuration(PlayPauseAnimationDuration);
                mAnimatorSet.PlayTogether(colorAnim, pausePlayAnim);
                mAnimatorSet.Start();
            }
            else
            {
                bool isPlay = mDrawable.IsPlay();
                InitStatus(!isPlay);
                Invalidate();
            }
        }
Example #10
0
        public override void OnKeyboardShow()
        {
            base.OnKeyboardShow();

            long duration = 500;

            AnimatorSet set1 = new AnimatorSet();

            set1.SetInterpolator(new AccelerateDecelerateInterpolator());
            set1.SetTarget(this.LogoImage);
            set1.SetDuration(duration);
            set1.PlayTogether(new[] {
                ObjectAnimator.OfFloat(this.LogoImage, "scaleX", .45f),
                ObjectAnimator.OfFloat(this.LogoImage, "scaleY", .45f),
                ObjectAnimator.OfFloat(this.LogoImage, "translationY", ViewBuilder.AsPixels(-58f))
            });
            set1.Start();

            AnimatorSet set2 = new AnimatorSet();

            set2.SetInterpolator(new AccelerateDecelerateInterpolator());
            set2.SetTarget(this.InputLayout);
            set2.SetDuration(duration);
            set2.PlayTogether(new[] {
                ObjectAnimator.OfFloat(this.InputLayout, "translationY", ViewBuilder.AsPixels(-130f))
            });
            set2.Start();
        }
Example #11
0
            public ColorItem(Context context) : base(context)
            {
                View.Inflate(context, Resource.Layout.ColorPickerItem, this);

                label     = FindViewById <TextView> (Resource.Id.Label);
                colorView = FindViewById <CircledImageView> (Resource.Id.Color);

                expandCircleRadius = colorView.CircleRadius;
                shrinkCircleRadius = expandCircleRadius * ShrinkCricleRatio;

                shrinkCircleAnimator = ObjectAnimator.OfFloat(colorView, "circleRadius",
                                                              expandCircleRadius, shrinkCircleRadius);
                shrinkLabelAnimator = ObjectAnimator.OfFloat(label, "alpha",
                                                             ExpandLabelAlpha, ShrinkLabelAlpha);

                // FIXME Xamarin: new AnimatorSet().SetDuration(long) should return an AnimatorSet
                shrinkAnimator = new AnimatorSet();
                shrinkAnimator.SetDuration(AnimationDurationMs);
                shrinkAnimator.PlayTogether(shrinkCircleAnimator, shrinkLabelAnimator);

                expandCircleAnimator = ObjectAnimator.OfFloat(colorView, "circleRadius",
                                                              shrinkCircleRadius, expandCircleRadius);
                expandLabelAnimator = ObjectAnimator.OfFloat(label, "alpha",
                                                             ShrinkLabelAlpha, ExpandLabelAlpha);
                expandAnimator = new AnimatorSet();
                expandAnimator.SetDuration(AnimationDurationMs);
                expandAnimator.PlayTogether(expandCircleAnimator, expandLabelAnimator);
            }
        public void Stop()
        {
            try
            {
                AnimatorSet    set    = new AnimatorSet();
                ObjectAnimator scaleY = ObjectAnimator.OfFloat(View, "scaleY", 1.0f);
                //        scaleY.setDuration(250);
                //        scaleY.setInterpolator(new DecelerateInterpolator());


                ObjectAnimator scaleX = ObjectAnimator.OfFloat(View, "scaleX", 1.0f);
                //        scaleX.setDuration(250);
                //        scaleX.setInterpolator(new DecelerateInterpolator());


                set.SetDuration(150);
                set.SetInterpolator(new AccelerateDecelerateInterpolator());
                set.PlayTogether(scaleY, scaleX);
                set.Start();
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Example #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var btnRun = FindViewById <Button>(Resource.Id.btnRun);

            var imageView = FindViewById <ImageView>(Resource.Id.faceIcon);

            btnRun.Click += delegate
            {
                var animatorX = ObjectAnimator.OfFloat(imageView, "scaleX", 1f, 2f).SetDuration(1000);
                var animatorY = ObjectAnimator.OfFloat(imageView, "scaleY", 1f, 2f).SetDuration(1000);

                var animatorSet = new AnimatorSet();
                //animatorSet.PlaySequentially(animatorX, animatorY);

                animatorSet.PlayTogether(animatorX, animatorY);

                animatorSet.SetDuration(3000);
                animatorSet.Start();
            };
        }
        public static void showPopupWon(GameState gameState)
        {
            RelativeLayout popupContainer = (RelativeLayout)Shared.Activity.FindViewById(Resource.Id.popup_container);

            popupContainer.RemoveAllViews();

            // popup
            PopupWonView popupWonView = new PopupWonView(Application.Context);

            popupWonView.SetGameState(gameState);
            int width  = Application.Context.Resources.GetDimensionPixelSize(Resource.Dimension.popup_won_width);
            int height = Application.Context.Resources.GetDimensionPixelSize(Resource.Dimension.popup_won_height);

            RelativeLayout.LayoutParams relparams = new RelativeLayout.LayoutParams(width, height);
            relparams.AddRule(LayoutRules.CenterInParent);
            popupContainer.AddView(popupWonView, relparams);

            // animate all together
            ObjectAnimator scaleXAnimator = ObjectAnimator.OfFloat(popupWonView, "scaleX", 0f, 1f);
            ObjectAnimator scaleYAnimator = ObjectAnimator.OfFloat(popupWonView, "scaleY", 0f, 1f);
            AnimatorSet    animatorSet    = new AnimatorSet();

            animatorSet.PlayTogether(scaleXAnimator, scaleYAnimator);
            animatorSet.SetDuration(500);
            animatorSet.SetInterpolator(new DecelerateInterpolator(2));
            popupWonView.SetLayerType(LayerType.Hardware, null);
            animatorSet.Start();
        }
Example #15
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
		
			SetContentView (Resource.Layout.activity_main);

			easingList = FindViewById<ListView> (Resource.Id.easing_list);
			adapter = new EasingAdapter (this);
			easingList.Adapter = adapter;
			target = FindViewById (Resource.Id.target);
			history = FindViewById<DrawView> (Resource.Id.history);
			easingList.ItemClick += (sender, e) => {
				history.Clear ();

				var s = (Skill)e.View.Tag;

				var set = new AnimatorSet ();
				target.TranslationX = 0;
				target.TranslationY = 0;
				set.PlayTogether (
					Glider.Glide (s, 1200, ObjectAnimator.OfFloat (target, "translationY", 0, DrawView.DipToPixels (this, -(160 - 3))), args => {
						history.DrawPoint (args.Time, args.Duration, args.Value - DrawView.DipToPixels (this, 60));
					}));
				set.SetDuration (1200);
				set.Start ();
			};
		}
Example #16
0
        private AnimatorSet BuildShrinkingAnimatorSet(View bigView, View thumbView, Rect startBounds, float scale)
        {
            if (_shrinkingAnimators.ContainsKey(thumbView.Id))
            {
                return(_shrinkingAnimators[thumbView.Id]);
            }

            AnimatorSet shrinkSet = new AnimatorSet();

            shrinkSet.Play(ObjectAnimator.OfFloat(bigView, View.X, startBounds.Left))
            .With(ObjectAnimator.OfFloat(bigView, View.Y, startBounds.Top))
            .With(ObjectAnimator.OfFloat(bigView, "ScaleX", scale))
            .With(ObjectAnimator.OfFloat(bigView, "ScaleY", scale));
            shrinkSet.SetDuration(_shortAnimationDuration);
            shrinkSet.SetInterpolator(new DecelerateInterpolator());
            shrinkSet.AnimationEnd += (sender1, args1) => {
                thumbView.Alpha    = 1.0f;
                bigView.Visibility = ViewStates.Gone;
                NullOutCurrentAnimator(sender1, args1);
            };

            shrinkSet.AnimationCancel += (sender1, args1) => {
                thumbView.Alpha    = 1.0f;
                bigView.Visibility = ViewStates.Gone;
                NullOutCurrentAnimator(sender1, args1);
            };

            _shrinkingAnimators.Add(thumbView.Id, shrinkSet);
            return(shrinkSet);
        }
 private void SetupEventHandlers()
 {
     capturePhotoButtonSatart.Click += async(sender, e) =>
     {
         clickTypeBtn = "capturePhotoButtonSatart";
         capturePhotoButtonStop.Visibility = ViewStates.Visible;
         animatorSet = new AnimatorSet();
         animatorSet.PlayTogether(
             ObjectAnimator.OfFloat(capturePhotoButtonStop, "alpha", 0f, 1f).SetDuration(2000),
             ObjectAnimator.OfFloat(capturePhotoButtonSatart, "alpha", 1f, 0f).SetDuration(2000));
         animatorSet.SetDuration(500);
         animatorSet.AnimationEnd += EndAnimation;
         animatorSet.Start();
         AutoFocus();
     };
     capturePhotoButtonStop.Click += async(sender, e) =>
     {
         clickTypeBtn = "capturePhotoButtonStop";
         capturePhotoButtonSatart.Visibility = ViewStates.Visible;
         animatorSet = new AnimatorSet();
         animatorSet.PlayTogether(
             ObjectAnimator.OfFloat(capturePhotoButtonSatart, "alpha", 0f, 1),
             ObjectAnimator.OfFloat(capturePhotoButtonStop, "alpha", 1f, 0f));
         animatorSet.SetDuration(500);
         animatorSet.AnimationEnd += EndAnimation;
         animatorSet.Start();
         await StopRecorddVideo();
     };
     liveView.SurfaceTextureListener = this;
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            easingList            = FindViewById <ListView> (Resource.Id.easing_list);
            adapter               = new EasingAdapter(this);
            easingList.Adapter    = adapter;
            target                = FindViewById(Resource.Id.target);
            history               = FindViewById <DrawView> (Resource.Id.history);
            easingList.ItemClick += (sender, e) => {
                history.Clear();

                var s = (Skill)e.View.Tag;

                var set = new AnimatorSet();
                target.TranslationX = 0;
                target.TranslationY = 0;
                set.PlayTogether(
                    Glider.Glide(s, 1200, ObjectAnimator.OfFloat(target, "translationY", 0, DrawView.DipToPixels(this, -(160 - 3))), args => {
                    history.DrawPoint(args.Time, args.Duration, args.Value - DrawView.DipToPixels(this, 60));
                }));
                set.SetDuration(1200);
                set.Start();
            };
        }
Example #19
0
        public override void OnKeyboardHide()
        {
            base.OnKeyboardHide();

            long duration = 300;

            AnimatorSet set = new AnimatorSet();

            set.SetInterpolator(new AccelerateDecelerateInterpolator());
            set.SetTarget(this.LogoImage);
            set.SetDuration(duration);
            set.PlayTogether(new[] {
                ObjectAnimator.OfFloat(this.LogoImage, "scaleX", 1f),
                ObjectAnimator.OfFloat(this.LogoImage, "scaleY", 1f),
                ObjectAnimator.OfFloat(this.LogoImage, "translationY", 0f)
            });
            set.Start();

            AnimatorSet set2 = new AnimatorSet();

            set2.SetInterpolator(new AccelerateDecelerateInterpolator());
            set2.SetTarget(this.InputLayout);
            set2.SetDuration(duration);
            set2.PlayTogether(new[] {
                ObjectAnimator.OfFloat(this.InputLayout, "translationY", 0f)
            });
            set2.Start();
        }
Example #20
0
        private void ReverseAnimator()
        {
            var width   = Resources.GetDimensionPixelSize(Resource.Dimension.image_width);
            var height  = Resources.GetDimensionPixelSize(Resource.Dimension.image_height);
            var margin  = Resources.GetDimensionPixelSize(Resource.Dimension.image_margin);
            var padding = Resources.GetDimensionPixelSize(Resource.Dimension.image_padding);

            var scrollAnimator = ViewPropertyObjectAnimator
                                 .Animate(scrollView)
                                 .ScrollY(0)
                                 .Get();

            var imageAnimator = ViewPropertyObjectAnimator
                                .Animate(imageView)
                                .Width(width)
                                .Height(height)
                                .Margin(margin)
                                .Padding(padding)
                                .RotationX(0)
                                .RotationY(0)
                                .Get();

            animatorSet?.Cancel();

            animatorSet = new AnimatorSet();
            animatorSet.PlayTogether(scrollAnimator, imageAnimator);
            animatorSet.SetDuration(2000);
            animatorSet.Start();
        }
Example #21
0
        public void Select()
        {
            var translateX = ObjectAnimator.OfFloat(TickImage, "translationX", 0);
            var fadeIn     = ObjectAnimator.OfFloat(TickImage, "alpha", 0f, 1f);
            var set        = new AnimatorSet();

            set.PlayTogether(translateX, fadeIn);
            set.SetInterpolator(new Android.Views.Animations.LinearInterpolator());
            set.SetDuration(200);
            set.Start();
        }
Example #22
0
        private void PlayAnimation()
        {
            var animator    = ObjectAnimator.OfFloat(this, "animationSeek", 0.0f, 1.0f);
            var animatorSet = new AnimatorSet();

            animatorSet.SetDuration(AnimationDuration);
            animatorSet.SetInterpolator(new DecelerateInterpolator());
            animatorSet.SetTarget(this);
            animatorSet.Play(animator);
            animatorSet.Start();
        }
        private void animateShow(View view)
        {
            ObjectAnimator animatorScaleX = ObjectAnimator.OfFloat(view, "scaleX", 0.5f, 1f);
            ObjectAnimator animatorScaleY = ObjectAnimator.OfFloat(view, "scaleY", 0.5f, 1f);
            AnimatorSet    animatorSet    = new AnimatorSet();

            animatorSet.SetDuration(300);
            animatorSet.PlayTogether(animatorScaleX, animatorScaleY);
            animatorSet.SetInterpolator(new DecelerateInterpolator(2));
            view.SetLayerType(LayerType.Hardware, null);
            animatorSet.Start();
        }
Example #24
0
        public void Reset()
        {
            waterAnimator.Cancel();

            var resetDuration = 256;

            waterAnimatorReverse = AnimateWaterReverse(resources);
            waterAnimatorReverse.SetDuration(resetDuration);
            waterAnimatorReverse.Start();

            waterAnimator.StartDelay = resetDuration;
        }
        private void FirstSolution()
        {
            //using an AnimatorSet and Object Animator to rotate the view

            originalSet = new AnimatorSet();
            originalSet.SetInterpolator(new OvershootInterpolator(0.8f));
            originalSet.SetDuration(3000);

            ObjectAnimator dialrotate = ObjectAnimator.OfFloat(originalSolution, "rotation", 0, 826);

            originalSet.Play(dialrotate);
        }
 public async void SetupEventHandlers()
 {
     capturePhotoButton.Click += async(sender, e) =>
     {
         clickNameBtn = "capturePhotoButton";
         animationcapturePhotoInspectionButtonSet = new AnimatorSet();
         animationcapturePhotoInspectionButtonSet.PlayTogether(
             ObjectAnimator.OfFloat(capturePhotoButton, "scaleX", 1, .8f),
             ObjectAnimator.OfFloat(capturePhotoButton, "scaleY", 1, .8f));
         animationcapturePhotoInspectionButtonSet.SetDuration(400);
         animationcapturePhotoInspectionButtonSet.AnimationEnd += EndAnimation;
         animationcapturePhotoInspectionButtonSet.Start();
         AutoFocus();
     };
     scanPhotoButton.Click += async(sender, e) =>
     {
         clickNameBtn = "scanPhotoButton";
         animationcapturePhotoInspectionButtonSet = new AnimatorSet();
         animationcapturePhotoInspectionButtonSet.PlayTogether(
             ObjectAnimator.OfFloat(scanPhotoButton, "scaleX", 1, .8f),
             ObjectAnimator.OfFloat(scanPhotoButton, "scaleY", 1, .8f));
         animationcapturePhotoInspectionButtonSet.SetDuration(400);
         animationcapturePhotoInspectionButtonSet.AnimationEnd += EndAnimation;
         animationcapturePhotoInspectionButtonSet.Start();
         AutoFocus();
     };
     capturePhotoInspectionButton.Click += async(sender, e) =>
     {
         clickNameBtn = "capturePhotoInspectionButton";
         animationcapturePhotoInspectionButtonSet = new AnimatorSet();
         animationcapturePhotoInspectionButtonSet.PlayTogether(
             ObjectAnimator.OfFloat(capturePhotoInspectionButton, "scaleX", 1, .8f),
             ObjectAnimator.OfFloat(capturePhotoInspectionButton, "scaleY", 1, .8f));
         animationcapturePhotoInspectionButtonSet.SetDuration(400);
         animationcapturePhotoInspectionButtonSet.AnimationEnd += EndAnimation;
         animationcapturePhotoInspectionButtonSet.Start();
         AutoFocus();
     };
     capturePhotoInspectionButton1.Click += async(sender, e) =>
     {
         clickNameBtn = "capturePhotoInspectionButton1";
         animationcapturePhotoInspectionButtonSet = new AnimatorSet();
         animationcapturePhotoInspectionButtonSet.PlayTogether(
             ObjectAnimator.OfFloat(capturePhotoInspectionButton1, "scaleX", 1, .8f),
             ObjectAnimator.OfFloat(capturePhotoInspectionButton1, "scaleY", 1, .8f));
         animationcapturePhotoInspectionButtonSet.SetDuration(400);
         animationcapturePhotoInspectionButtonSet.AnimationEnd += EndAnimation;
         animationcapturePhotoInspectionButtonSet.Start();
         AutoFocus();
     };
     liveView.SurfaceTextureListener = this;
 }
Example #27
0
        private AnimatorSet BuildMenuAnimation(View target, float alpha)
        {
            var alphaAnimation = new AnimatorSet();

            if (target != null)
            {
                alphaAnimation.PlayTogether(
                    ObjectAnimator.OfFloat(target, "alpha", alpha)
                    );
                alphaAnimation.SetDuration(250);
            }
            return(alphaAnimation);
        }
Example #28
0
        private AnimatorSet GetAnimatorSet(int idx, bool expand)
        {
            AnimatorSet set        = null;
            var         avgRadians = this.ToRadians(360 / (this.ChildCount - 1));
            var         w          = Math.Min(this.MeasuredWidth, this.MeasuredHeight) / 2;

            var cx = this.MeasuredWidth / 2;
            var cy = this.MeasuredHeight / 2;

            var c       = this.GetChildAt(idx);
            var radians = idx * avgRadians;
            var hw      = c.MeasuredWidth / 2;
            var hy      = c.MeasuredHeight / 2;

            var tmp = (w - hw);
            var l   = w + (int)Math.Round(tmp * Math.Cos(radians) - hw);
            var t   = w + (int)Math.Round(tmp * Math.Sin(radians) - hw);

            var duration = new Random(1000).Next(200, 1000);

            set = new AnimatorSet();
            set.SetInterpolator(new Android.Views.Animations.BounceInterpolator());
            set.SetTarget(c);
            set.SetDuration(200 * idx + duration);
            //set.SetDuration(200);

            float[] xs = new float[] { cx - hw, l };
            float[] ys = new float[] { cy - hy, t };
            float[] ss = new float[] { 0.1f, 1 };
            if (!expand)
            {
                Array.Reverse(xs);
                Array.Reverse(ys);
                Array.Reverse(ss);
            }

            var aniX  = ObjectAnimator.OfFloat(c, "X", xs);
            var aniY  = ObjectAnimator.OfFloat(c, "Y", ys);
            var aniSX = ObjectAnimator.OfFloat(c, "ScaleX", ss);
            var aniSY = ObjectAnimator.OfFloat(c, "ScaleY", ss);

            aniX.SetAutoCancel(true);
            aniY.SetAutoCancel(true);
            aniSX.SetAutoCancel(true);
            aniSY.SetAutoCancel(true);

            set.PlayTogether(aniX, aniY, aniSX, aniSY);
            set.AnimationEnd += Set_AnimationEnd;

            return(set);
        }
        public void AnimateObject(View view, string[] PropertyNames, float[] Values, long Duration = 150, long Delay = 0)
        {
            if (PropertyNames != null || PropertyNames.Length != 0)
            {
                List <Animator> animations = new List <Animator>();
                for (int i = 0; i < PropertyNames.Length; i++)
                {
                    ObjectAnimator objectAnimator = ObjectAnimator.OfFloat(view, PropertyNames[i], Values[i]);
                    animations.Add(objectAnimator);
                }
                ObjectAnimator lastAnimation = (ObjectAnimator)animations[animations.Count - 1];
                lastAnimation.AddListener(this);

                animatorSet.PlayTogether(animations.ToArray());
                animatorSet.SetDuration(Duration);
                animatorSet.StartDelay = Delay;

                animatorSet.Start();
            }
            else
            {
                throw new ArgumentNullException(nameof(PropertyNames));
            }
        }
Example #30
0
        private void Animate(params View[] view)
        {
            AnimatorSet animatorSet = new AnimatorSet();

            AnimatorSet.Builder builder = animatorSet.Play(new AnimatorSet());
            for (int i = 0; i < view.Length; i++)
            {
                ObjectAnimator scaleX = ObjectAnimator.OfFloat(view[i], "scaleX", 0.8f, 1f);
                ObjectAnimator scaleY = ObjectAnimator.OfFloat(view[i], "scaleY", 0.8f, 1f);
                builder.With(scaleX).With(scaleY);
            }
            animatorSet.SetDuration(500);
            animatorSet.SetInterpolator(new BounceInterpolator());
            animatorSet.Start();
        }
Example #31
0
        private void AnimateStar(View view, int delay)
        {
            ObjectAnimator alpha = ObjectAnimator.OfFloat(view, "alpha", 0, 1f);

            alpha.SetDuration(100);
            ObjectAnimator scaleX      = ObjectAnimator.OfFloat(view, "scaleX", 0, 1f);
            ObjectAnimator scaleY      = ObjectAnimator.OfFloat(view, "scaleY", 0, 1f);
            AnimatorSet    animatorSet = new AnimatorSet();

            animatorSet.PlayTogether(alpha, scaleX, scaleY);
            animatorSet.SetInterpolator(new BounceInterpolator());
            animatorSet.StartDelay = delay;
            animatorSet.SetDuration(600);
            view.SetLayerType(LayerType.Hardware, null);
            animatorSet.Start();
        }