protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var blockingBtn  = FindViewById <Button>(Resource.Id.button_blocking);
            var backgrondBtn = FindViewById <Button>(Resource.Id.button_background);


            var bSet = this.CreateBindingSet <UIThreadDemoView, UIThreadDemoViewModel>();

            bSet.Bind(blockingBtn)
            .To(vm => vm.BlockingLongOp);


            bSet.Bind(backgrondBtn)
            .To(vm => vm.BackgroundLongOp);


            bSet.Apply();
            RotateAnimation anim = new RotateAnimation(0, 360);

            anim.RepeatMode  = RepeatMode.Restart;
            anim.RepeatCount = -1;
            anim.Duration    = 5000;

            var fancyView = FindViewById(Resource.Id.fancyView);

            fancyView.StartAnimation(anim);
        }
예제 #2
0
        private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
                                                       long startOffset, long duration, IInterpolator interpolator)
        {
            AnimationSet animationSet = new AnimationSet(false);

            animationSet.FillAfter = true;

            long      preDuration     = duration / 2;
            Animation rotateAnimation = new RotateAnimation(0, 360, Dimension.RelativeToSelf, 0.5f,
                                                            Dimension.RelativeToSelf, 0.5f);

            rotateAnimation.StartOffset  = startOffset;
            rotateAnimation.Duration     = preDuration;
            rotateAnimation.Interpolator = new LinearInterpolator();
            rotateAnimation.FillAfter    = true;

            animationSet.AddAnimation(rotateAnimation);

            Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);

            translateAnimation.StartOffset  = startOffset + preDuration;
            translateAnimation.Duration     = duration - preDuration;
            translateAnimation.Interpolator = interpolator;
            translateAnimation.FillAfter    = true;

            animationSet.AddAnimation(translateAnimation);

            return(animationSet);
        }
예제 #3
0
        public void OnSensorChanged(SensorEvent e)
        {
            // The light sensor returns a single value.
            // Many sensors return 3 values, one for each axis.

            txtInfo.Text = Sensors.ShowProperlyInfo(e);

            // https://www.codespeedy.com/simple-compass-code-with-android-studio/
            if (sensor.Type == SensorType.Orientation)
            {
                // get angle around the z-axis rotated
                float degree = (float)Math.Round(e.Values[0], 0);

                // rotation animation - reverse turn degree degrees
                RotateAnimation animation = new RotateAnimation(
                    degreeStart,
                    -degree,
                    Dimension.RelativeToSelf, 0.5f,
                    Dimension.RelativeToSelf, 0.5f)
                {
                    // set the compass animation after the end of the reservation status
                    FillAfter = true,
                    // set how long the animation for the compass image will take place
                    Duration = 210
                };
                // Start animation of compass image
                imgVisualization.StartAnimation(animation);
                degreeStart = -degree;
            }
        }
예제 #4
0
        void StartAnimation()
        {
            Animation ScaleIn = AnimationUtils.LoadAnimation(this, Resource.Animation.ScaleIn);

            ScaleIn.FillAfter = true;

            Animation ScaleOut = AnimationUtils.LoadAnimation(this, Resource.Animation.ScaleOut);

            ScaleIn.FillAfter = true;

            ScaleIn.AnimationEnd += (object sender1, Animation.AnimationEndEventArgs e1) =>
            {
                Logo.StartAnimation(ScaleOut);
            };

            ScaleOut.AnimationEnd += (object sender1, Animation.AnimationEndEventArgs e1) =>
            {
                Logo.StartAnimation(ScaleIn);
            };

            RotateAnimation animRotate = new RotateAnimation(0.0f, -360.0f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);

            animRotate.Duration    = 3000;
            animRotate.RepeatCount = Animation.Infinite;

            Logo.StartAnimation(ScaleIn);
        }
예제 #5
0
        /// <summary>
        /// Handles the Elapsed event of the autoShowTimer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ElapsedEventArgs"/> instance containing the event data.</param>
        private void autoShowTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            lock (this)
            {
                if (autoShowTimer != null)
                {
                    autoShowTimer.Dispose();
                    autoShowTimer = null;

                    imageView.Post(() =>
                    {
                        lock (this)
                        {
                            if (IsRunning && imageView.Animation == null)
                            {
                                //
                                // Start an animation for rotating the spinner forever.
                                //
                                var anim = new RotateAnimation(0, 360f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f)
                                {
                                    Duration     = 1500,
                                    RepeatCount  = Animation.Infinite,
                                    Interpolator = new LinearInterpolator()
                                };
                                var animationSet = new AnimationSet(false);
                                animationSet.AddAnimation(anim);

                                imageView.StartAnimation(animationSet);
                                imageView.Visibility = ViewStates.Visible;
                            }
                        }
                    });
                }
            }
        }
예제 #6
0
        public void Appear()
        {
            g_rotation = RANDOM.NextDouble() * 90d - 45d;
            g_pos_x    = RANDOM.NextDouble() * 160d - 80d;
            g_pos_y    = RANDOM.NextDouble() * 240d - 120d;

            if (_SpriteType == Control.SpriteType.Photo)
            {
                g_scale = 1d;
                double from_x = RANDOM.Next(2) == 0 ? -imageWidthInitial : App.SCREEN_WIDTH + imageWidthInitial;
                double from_y = RANDOM.Next(2) == 0 ? -imageHeightInitial : App.SCREEN_HEIGHT + imageHeightInitial;

                RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION);
                MoveAnimation.MoveFromTo(contentPanel, from_x, from_y, g_pos_x, g_pos_y, APPEAR_DURATION, EASING,
                                         fe =>
                {
                    PrepareForManipulation();
                });
            }
            else if (_SpriteType == Control.SpriteType.Material || _SpriteType == Control.SpriteType.Text)
            {
                g_scale = RANDOM.NextDouble() * 0.3d + 0.8d;
                MoveAnimation.SetPosition(contentPanel, g_pos_x, g_pos_y);
                FadeAnimation.Fade(contentPanel, 0d, 1d, APPEAR_DURATION);
                RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION);
                ScaleAnimation.ScaleFromTo(contentPanel, 1.5d, 1.5d, g_scale, g_scale, APPEAR_DURATION,
                                           fe =>
                {
                    ScaleAnimation.SetScale(fe, 1d, 1d);
                    PrepareForManipulation();
                });
            }
        }
        public void animatePlayAsManaOPP(int cardID)
        {
            Models.CardGUIModel        card;
            Animations.MoveAnimation   moveAnimation;
            Animations.RotateAnimation rotateAnimation;

            // create the origin and destination cards

            card = new Models.CardGUIModel(ctrl.getCardWithGamePropertiesByID(cardID), this, AnimationAndEventsConstants.oppHandLocation, Visibility.Visible);

            // add cards to grids
            grdParent.Children.Add(card.Border);

            moveAnimation = new Animations.MoveAnimation(
                grdParent,
                grdOppMana,
                grdParent,
                null,
                listOppManaZone,
                card,
                AnimationAndEventsConstants.DESTINATIONMANA);
            rotateAnimation        = new RotateAnimation(true, 180);
            rotateAnimation.border = card.Border;
            addEvent(new Event(moveAnimation));
            //addAnimation(rotateAnimation);
        }
        public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
        {
            if (Math.Abs(velocityX) < 500)
            {
                return(false);
            }
            _lastView = _parentActivity.LastView;
            var animationSet = new AnimationSet(true)
            {
                Interpolator = new AccelerateDecelerateInterpolator(),
                Duration     = 300,
                FillAfter    = true
            };
            var animationRotate    = new RotateAnimation(0, Math.Sign(velocityX) * 15);
            var animationTranslate = new TranslateAnimation(0, Math.Sign(velocityX) * 400,
                                                            0, 10);
            var animationAlpha = new AlphaAnimation(1, 0);

            animationSet.AddAnimation(animationRotate);
            animationSet.AddAnimation(animationTranslate);
            animationSet.AddAnimation(animationAlpha);
            animationSet.AnimationEnd += AnimationSet_AnimationEnd;
            _lastView.StartAnimation(animationSet);
            return(true);
        }
예제 #9
0
        public override void initView()
        {
            btn_start    = FindViewById <Button> (Resource.Id.btn_start);
            tv_maintitle = FindViewById <TextView> (Resource.Id.tv_maintitle);
            ll_root      = FindViewById <LinearLayout> (Resource.Id.ll_root);
            //ll_root animation
            AnimationSet set = new AnimationSet(true);
            //rotate animation
            RotateAnimation rotate = new RotateAnimation(0, 360, Dimension.RelativeToSelf, 0.5f,
                                                         Dimension.RelativeToSelf, 0.5f);
            //scale animation
            ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f);

            set.AddAnimation(rotate);
            set.AddAnimation(scaleAnimation);
            set.Duration  = 2000;
            set.FillAfter = true;
            ll_root.StartAnimation(set);
            set.AnimationEnd += delegate(object sender, Animation.AnimationEndEventArgs e) {
                handler.PostDelayed(delegate() {
                    NineOldAndroids.View.ViewPropertyAnimator.Animate(tv_maintitle).SetDuration(1200).Alpha(1.0f).Start();
                }, 2000);
                handler.PostDelayed(delegate() {
                    btn_start.Visibility = ViewStates.Visible;
                    NineOldAndroids.View.ViewPropertyAnimator.Animate(btn_start).SetDuration(1500).TranslationY(-150).Start();
                }, 1200);
            };
        }
        public gradesRecyclerViewAdapter(List <Card> grades, Context context)
        {
            // Set the local list to the list passed in
            GradesCardList = grades;
            _context       = context;

            /* Create rotate animation */
            rotateArrow = new RotateAnimation(0, 180, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f)
            {
                Duration     = 500,
                Interpolator = new AnticipateOvershootInterpolator(),
                FillAfter    = true
            };

            #region THE FOLLOWING TRANSITION IS NOT USED

            /*transitionSet = new TransitionSet();
             * transitionSet.SetOrdering(TransitionOrdering.Together);
             * transitionSet.SetDuration(400);
             * ChangeBounds changeBounds = new ChangeBounds();
             * ChangeImageTransform changeImageTransform = new ChangeImageTransform();
             * Fade fadeIn = new Fade(FadingMode.In);
             * transitionSet.AddTransition(changeBounds)
             *           .AddTransition(changeImageTransform)
             *           .AddTransition(fadeIn);*/
            /* If this was used, these would be called later */

            /* transitionSet.AddTarget(GradesViewHolder.ExpandCard);
             * TransitionManager.BeginDelayedTransition(GradesViewHolder.ExpandCard, transitionSet); */
            #endregion
        }
예제 #11
0
        public IndicatorLayout(Context context, PullMode mode) : base(context)
        {
            mArrowImageView = new ImageView(context);

            Drawable arrowD = ContextCompat.GetDrawable(Context, Resource.Drawable.indicator_arrow); /*Resources.GetDrawable(Resource.Drawable.indicator_arrow);*/

            mArrowImageView.SetImageDrawable(arrowD);

            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final int padding = getResources().getDimensionPixelSize(PullToRefresh.Resource.Dimension.indicator_internal_padding);
            int padding = Resources.GetDimensionPixelSize(Resource.Dimension.indicator_internal_padding);

            mArrowImageView.SetPadding(padding, padding, padding, padding);
            AddView(mArrowImageView);

            int inAnimResId, outAnimResId;

            switch (mode)
            {
            case PullMode.PULL_FROM_END:
                inAnimResId  = Resource.Animation.slide_in_from_bottom;
                outAnimResId = Resource.Animation.slide_out_to_bottom;
                SetBackgroundResource(Resource.Drawable.indicator_bg_bottom);

                // Rotate Arrow so it's pointing the correct way
                mArrowImageView.SetScaleType(ImageView.ScaleType.Matrix);
                Matrix matrix = new Matrix();
                matrix.SetRotate(180f, arrowD.IntrinsicWidth / 2f, arrowD.IntrinsicHeight / 2f);
                mArrowImageView.ImageMatrix = matrix;
                break;

            case PullMode.PULL_FROM_START:
            default:
                inAnimResId  = Resource.Animation.slide_in_from_top;
                outAnimResId = Resource.Animation.slide_out_to_top;
                SetBackgroundResource(Resource.Drawable.indicator_bg_top);
                break;
            }

            mInAnim = AnimationUtils.LoadAnimation(context, inAnimResId);
            mInAnim.SetAnimationListener(this);

            mOutAnim = AnimationUtils.LoadAnimation(context, outAnimResId);
            mOutAnim.SetAnimationListener(this);

            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final android.view.animation.Interpolator interpolator = new android.view.animation.LinearInterpolator();
            IInterpolator interpolator = new LinearInterpolator();

            mRotateAnimation = new RotateAnimation(0, -180, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
            mRotateAnimation.Interpolator = interpolator;
            mRotateAnimation.Duration     = DEFAULT_ROTATION_ANIMATION_DURATION;
            mRotateAnimation.FillAfter    = true;

            mResetRotateAnimation = new RotateAnimation(-180, 0, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
            mResetRotateAnimation.Interpolator = (interpolator);
            mResetRotateAnimation.Duration     = (DEFAULT_ROTATION_ANIMATION_DURATION);
            mResetRotateAnimation.FillAfter    = (true);
        }
예제 #12
0
            private void animateCollapse()
            {
                RotateAnimation rotate =
                    new RotateAnimation(180, 360, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);

                rotate.Duration  = 300;
                rotate.FillAfter = true;
                arrow.Animation  = rotate;
            }
예제 #13
0
        public static Animation createItemInAnimation(Context context, int index, long expandDuration, int x, int y)
        {
            RotateAnimation rotate = new RotateAnimation(720, 0,
                                                         Dimension.RelativeToSelf, 0.5f,
                                                         Dimension.RelativeToSelf, 0.5f);

            rotate.SetInterpolator(context, Resource.Animation.sat_item_in_rotate_interpolator);
            rotate.Duration = expandDuration;

            TranslateAnimation translate = new TranslateAnimation(x, 0, y, 0);


            long delay = 250;

            if (expandDuration <= 250)
            {
                delay = expandDuration / 3;
            }

            long duration = 400;

            if ((expandDuration - delay) > duration)
            {
                duration = expandDuration - delay;
            }

            translate.Duration    = duration;
            translate.StartOffset = delay;

            translate.SetInterpolator(context, Resource.Animation.sat_item_anticipate_interpolator);

            AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0f);
            long           alphaDuration  = 10;

            if (expandDuration < 10)
            {
                alphaDuration = expandDuration / 10;
            }
            alphaAnimation.Duration    = alphaDuration;
            alphaAnimation.StartOffset = (delay + duration) - alphaDuration;

            AnimationSet animationSet = new AnimationSet(false);

            animationSet.FillAfter   = false;
            animationSet.FillBefore  = true;
            animationSet.FillEnabled = true;

            animationSet.AddAnimation(alphaAnimation);
            animationSet.AddAnimation(rotate);
            animationSet.AddAnimation(translate);


            animationSet.StartOffset = 30 * index;
            animationSet.Start();
            animationSet.StartNow();
            return(animationSet);
        }
        /// <summary>
        /// Delete button revelation animation
        /// </summary>
        private static void ShowDeleteButton()
        {
            Animation animNewNoteButton = new RotateAnimation(0, 45, Dimension.RelativeToSelf, .5f, Dimension.RelativeToSelf, .5f)
            {
                Duration = 500
            };

            animNewNoteButton.AnimationEnd += (object sender, Animation.AnimationEndEventArgs e) => _deleteNoteButton.BringToFront();
            _newNoteButton.StartAnimation(animNewNoteButton);
        }
예제 #15
0
        /// <summary>
        /// Delete button hiding animation
        /// </summary>
        private void HideDeleteButton()
        {
            Animation animDeleteNoteButton = new RotateAnimation(0, -45, Dimension.RelativeToSelf, .5F, Dimension.RelativeToSelf, .5F)
            {
                Duration = 500
            };

            animDeleteNoteButton.AnimationEnd += (object sender, Animation.AnimationEndEventArgs e) => _revealDialogButton.BringToFront();
            _deleteCategoriesButton.StartAnimation(animDeleteNoteButton);
        }
        private void startAnimation()
        {
            var rotate = new RotateAnimation(0, 360, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f)
            {
                Duration    = 1000,
                RepeatMode  = RepeatMode.Restart,
                RepeatCount = int.MaxValue
            };

            Control.StartAnimation(rotate);
        }
예제 #17
0
        private static Animation createHintSwitchAnimation(bool expanded)
        {
            Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Dimension.RelativeToSelf,
                                                      0.5f, Dimension.RelativeToSelf, 0.5f);

            animation.StartOffset  = 0;
            animation.Duration     = 100;
            animation.Interpolator = new DecelerateInterpolator();
            animation.FillAfter    = true;

            return(animation);
        }
예제 #18
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            /* Create rotate animation */
            _rotateArrow = new RotateAnimation(0, 180, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f)
            {
                Duration     = 550,
                Interpolator = new AnticipateOvershootInterpolator(),
                FillAfter    = true
            };
        }
예제 #19
0
        public void play()
        {
            RotateAnimation    rotate = new RotateAnimation(0f, 360f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
            LinearInterpolator lin    = new LinearInterpolator();

            rotate.Interpolator = lin;
            rotate.Duration     = 2000;
            rotate.RepeatCount  = -1;
            rotate.FillAfter    = true;
            rotate.StartOffset  = 10;
            Animation           = rotate;
        }
예제 #20
0
        public EndlessTriviaItemAdapter(IListAdapter wrapped, string after, string dataUrl)
            : base(wrapped)
        {
            _after   = after;
            _dataUrl = dataUrl;

            _rotateAnimation = new RotateAnimation(0f, 360f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);

            _rotateAnimation.Duration    = 600;
            _rotateAnimation.RepeatMode  = RepeatMode.Restart;
            _rotateAnimation.RepeatCount = Animation.Infinite;
        }
 public PixelDefaultHeader(Activity context)
 {
     MainContext  = context;
     RotateUpAnim = new RotateAnimation(0.0f, -180.0f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f)
     {
         Duration = 180, FillAfter = true
     };
     RotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f)
     {
         Duration = 180, FillAfter = true
     };
 }
예제 #22
0
        private void Initialize()
        {
            mFlipAnimation = new RotateAnimation(0, -180,
                                                 Android.Views.Animations.Dimension.RelativeToSelf, 0.5f,
                                                 Android.Views.Animations.Dimension.RelativeToSelf, 0.5f);


            mFlipAnimation.Interpolator = new LinearInterpolator();

            mFlipAnimation.Duration  = 250;
            mFlipAnimation.FillAfter = true;

            mReverseFlipAnimation = new RotateAnimation(-180, 0,
                                                        Android.Views.Animations.Dimension.RelativeToSelf, 0.5f,
                                                        Android.Views.Animations.Dimension.RelativeToSelf, 0.5f);

            mReverseFlipAnimation.Interpolator = new LinearInterpolator();
            mReverseFlipAnimation.Duration     = 250;
            mReverseFlipAnimation.FillAfter    = true;


            mInflater = Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater;

            mRefreshView = (RelativeLayout)mInflater.Inflate(Resource.Layout.pull_to_refresh_header, this, false);

            mRefreshViewText =
                (TextView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_text);
            mRefreshViewImage =
                (ImageView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_image);
            mRefreshViewProgress =
                (ProgressBar)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_progress);
            mRefreshViewLastUpdated =
                (TextView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_updated_at);

            mRefreshViewImage.SetMinimumHeight(50);

            mRefreshView.SetOnClickListener(new OnClickRefreshListener(this));

            mRefreshOriginalTopPadding = mRefreshView.PaddingTop;

            mRefreshState = TAP_TO_REFRESH;

            AddHeaderView(mRefreshView);

            base.SetOnScrollListener(this);


            MeasureView(mRefreshView);
            mRefreshViewHeight = mRefreshView.MeasuredHeight;
        }
예제 #23
0
        public BallService()
        {
            this.AniSet = new AnimationSet(true);
            var rotat = new RotateAnimation(0f, 360f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);

            rotat.RepeatMode = RepeatMode.Reverse;
            rotat.Duration   = 500;
            //rotat.AnimationStart += Ani_AnimationStart;
            //rotat.AnimationEnd += Ani_AnimationEnd;
            rotat.FillBefore = true;
            //AccelerateDecelerateInterpolator  先加速后减速
            rotat.Interpolator = new AccelerateDecelerateInterpolator();
            this.AniSet.AddAnimation(rotat);
        }
예제 #24
0
        public DemoAdapter(Context ctxt, List <string> list)
            : base(new ArrayAdapter <string>(ctxt,
                                             IslamicHadithAND.Resource.Layout.row,
                                             global::Android.Resource.Id.Text1,
                                             list))
        {
            _rotateAnimation = new RotateAnimation(0f, 360f, Dimension.RelativeToSelf,
                                                   0.5f, Dimension.RelativeToSelf,
                                                   0.5f);

            _rotateAnimation.Duration    = 600;
            _rotateAnimation.RepeatMode  = RepeatMode.Restart;
            _rotateAnimation.RepeatCount = Animation.Infinite;
        }
예제 #25
0
        private void initArrowAnim()
        {
            //arrow up
            animUp = new RotateAnimation(0, -180, Dimension.RelativeToSelf, 0.5f,
                                         Dimension.RelativeToSelf, 0.5f);
            animUp.Duration  = 300;
            animUp.FillAfter = true;

            //arrow down
            animDown = new RotateAnimation(-180, 0, Dimension.RelativeToSelf, 0.5f,
                                           Dimension.RelativeToSelf, 0.5f);
            animDown.Duration  = 300;
            animDown.FillAfter = true;
        }
예제 #26
0
        public static Animation createItemOutAnimation(Context context, int index, long expandDuration, int x, int y)
        {
            AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
            long           alphaDuration  = 60;

            if (expandDuration < 60)
            {
                alphaDuration = expandDuration / 4;
            }
            alphaAnimation.Duration    = alphaDuration;
            alphaAnimation.StartOffset = 0;


            TranslateAnimation translate = new TranslateAnimation(0, x, 0, y);

            translate.StartOffset = 0;
            translate.Duration    = expandDuration;
            translate.SetInterpolator(context, Resource.Animation.sat_item_overshoot_interpolator);

            RotateAnimation rotate = new RotateAnimation(0f, 360f,
                                                         Dimension.RelativeToSelf, 0.5f,
                                                         Dimension.RelativeToSelf, 0.5f);

            rotate.SetInterpolator(context, Resource.Animation.sat_item_out_rotate_interpolator);

            long duration = 100;

            if (expandDuration <= 150)
            {
                duration = expandDuration / 3;
            }

            rotate.Duration    = expandDuration - duration;
            rotate.StartOffset = duration;

            AnimationSet animationSet = new AnimationSet(false);

            animationSet.FillAfter   = false;
            animationSet.FillBefore  = true;
            animationSet.FillEnabled = true;

            //animationSet.addAnimation(alphaAnimation);
            //animationSet.addAnimation(rotate);
            animationSet.AddAnimation(translate);

            animationSet.StartOffset = 30 * index;

            return(animationSet);
        }
예제 #27
0
    private void CreateMoveAwayAnimation(GameObject o,
                                         Vector3 start, Vector3 mid, Vector3 end,
                                         Vector3 startRotation, Vector3 endRotation, float startTime)
    {
        var step1 = new TranslateAnimation(o, start, mid, startTime + Random.value * 0.5f, 1f, Ease.Square);
        var step2 = new TranslateAnimation(o, mid, end, step1.EndTime, 1f, Ease.Linear);

        var q0 = Quaternion.Euler(startRotation);
        var q1 = Quaternion.Euler(endRotation);

        var rot = new RotateAnimation(o, q0, q1, step1.StartTime + 0.5f, 2f, Ease.Square);

        m_animations.Add(step1);
        m_animations.Add(step2);
        m_animations.Add(rot);
    }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public FlipLoadingLayout(android.content.Context context, final PullToRefresh.PullMode mode, final PullToRefresh.ScrollOrientation scrollDirection, android.content.res.TypedArray attrs)
        public FlipLoadingLayout(Context context, PullMode mode, ScrollOrientation scrollDirection, TypedArray attrs) : base(context, mode, scrollDirection, attrs)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int rotateAngle = mode == PullToRefresh.PullMode.PULL_FROM_START ? -180 : 180;
            int rotateAngle = mode == PullMode.PULL_FROM_START ? -180 : 180;

            mRotateAnimation = new RotateAnimation(0, rotateAngle, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
            mRotateAnimation.Interpolator = ANIMATION_INTERPOLATOR;
            mRotateAnimation.Duration     = FLIP_ANIMATION_DURATION;
            mRotateAnimation.FillAfter    = true;

            mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
            mResetRotateAnimation.Interpolator = (ANIMATION_INTERPOLATOR);
            mResetRotateAnimation.Duration     = FLIP_ANIMATION_DURATION;
            mResetRotateAnimation.FillAfter    = true;
        }
예제 #29
0
 public static void AnimateButton(ImageButton button, int resource = 0)
 {
     try
     {
         if (resource != 0)
         {
             button.SetImageResource(resource);
         }
         RotateAnimation rotateAnimation = new RotateAnimation(0, 359, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
         rotateAnimation.RepeatCount  = Animation.Infinite;
         rotateAnimation.RepeatMode   = RepeatMode.Restart;
         rotateAnimation.Duration     = 700;
         rotateAnimation.Interpolator = new LinearInterpolator();
         button.StartAnimation(rotateAnimation);
     }
     catch { }
 }
        private void StartRotationButtonClick(object sender, EventArgs e)
        {
            var rotateAnimation = new RotateAnimation(
                fromDegrees: 0,
                toDegrees: 359,
                pivotXType: Dimension.RelativeToSelf,
                pivotXValue: 0.5f,
                pivotYType: Dimension.RelativeToSelf,
                pivotYValue: 0.5f)
            {
                Duration     = 1000, // 1 second
                FillAfter    = false,
                RepeatCount  = Animation.StartOnFirstFrame,
                Interpolator = new LinearInterpolator()
            };

            _calendarImageView.StartAnimation(rotateAnimation);
        }
예제 #31
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            RotationImage image       = (RotationImage)sender;
            float         newRotation = (float)(image.NextRotation % 360);

            if (Control != null)
            {
                RotateAnimation animation = new RotateAnimation((float)currentDegree, (float)newRotation,
                                                                Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf,
                                                                0.5f);
                animation.Duration  = 250;
                animation.FillAfter = true;
                Control.StartAnimation(animation);
                currentDegree = (float)newRotation;
            }
        }