public AnimationState(GeoCoordinate coordinate, float zoom, TimeSpan duration, ITimeInterpolator timeInterpolator)
 {
     Coordinate       = coordinate;
     Zoom             = zoom;
     TimeInterpolator = timeInterpolator;
     TimeLeft         = (float)duration.TotalSeconds;
 }
 public Spotlight(Context context, List <Target> targets, long duration, ITimeInterpolator animation)
 {
     Context   = context;
     Targets   = targets;
     Duration  = duration;
     Animation = animation;
 }
Exemple #3
0
 public PathAnimation(Transform transform,
                      ITimeInterpolator timeInterpolator,
                      IPathInterpolator pathInterpolator,
                      TimeSpan duration, bool isLoop = false)
     : base(transform, timeInterpolator, duration, isLoop)
 {
     _pathInterpolator = pathInterpolator;
 }
Exemple #4
0
 public RotationAnimation(Transform transform,
                          ITimeInterpolator timeInterpolator,
                          IRotationInterpolator rotationInterpolator,
                          TimeSpan duration, bool isLoop = false)
     : base(transform, timeInterpolator, duration, isLoop)
 {
     _rotationInterpolator = rotationInterpolator;
 }
Exemple #5
0
        private ITimeInterpolator GetAndroidInterpolator(
            EasingFunction ease)
        {
            ITimeInterpolator androidEase = null;

            if (null != ease)
            {
                var cubicEase   = ease as CubicEase;
                var elasticEase = ease as SpringEase;

                if (null != cubicEase)
                {
                    if (ease.EasingMode == EasingMode.EaseIn)
                    {
                        androidEase = new AccelerateInterpolator(1.5f);
                    }
                    else if (ease.EasingMode == EasingMode.EaseOut)
                    {
                        androidEase = new DecelerateInterpolator(1.5f);
                    }
                    else if (ease.EasingMode == EasingMode.EaseInOut)
                    {
                        // TODO: A custom interpolator. This is actually a circular ease, not a cubic ease-in-out
                        androidEase = new AccelerateDecelerateInterpolator();
                    }
                    else
                    {
                        throw new NotSupportedException("Unsupported easing mode.");
                    }
                }
                else if (null != elasticEase)
                {
                    // TODO: Custom interpolators
                    if (ease.EasingMode == EasingMode.EaseIn)
                    {
                        androidEase = new BounceInterpolator();
                    }
                    else if (ease.EasingMode == EasingMode.EaseOut)
                    {
                        androidEase = new BounceInterpolator();
                    }
                    else if (ease.EasingMode == EasingMode.EaseInOut)
                    {
                        androidEase = new BounceInterpolator();
                    }
                    else
                    {
                        throw new NotSupportedException("Unsupported easing mode.");
                    }
                }
                else
                {
                    throw new NotSupportedException("Unsupported easing function.");
                }
            }

            return(androidEase);
        }
 protected TransformAnimation(Transform transform,
                              ITimeInterpolator timeInterpolator,
                              TimeSpan duration, bool isLoop = false)
 {
     _transform        = transform;
     _timeInterpolator = timeInterpolator;
     _duration         = (float)duration.TotalSeconds;
     _isLoop           = isLoop;
 }
		protected AbsQuizView (Context context, Category category) : base (context)
		{
			mCategory = category;
			spacingDouble = Resources.GetDimensionPixelSize (Resource.Dimension.spacing_double);
			minHeightTouchTarget = Resources.GetDimensionPixelSize (Resource.Dimension.min_height_touch_target);
			fastOutSlowInInterpolator = AnimationUtils.LoadInterpolator (Context, Android.Resource.Interpolator.FastOutSlowIn);
			linearOutSlowInInterpolator = AnimationUtils.LoadInterpolator (Context, Android.Resource.Interpolator.LinearOutSlowIn);
			colorAnimationDuration = 400;
			iconAnimationDuration = 300;
			scaleAnimationDuration = 200;
		}
Exemple #8
0
 protected AbsQuizView(Context context, Category category) : base(context)
 {
     mCategory                   = category;
     spacingDouble               = Resources.GetDimensionPixelSize(Resource.Dimension.spacing_double);
     minHeightTouchTarget        = Resources.GetDimensionPixelSize(Resource.Dimension.min_height_touch_target);
     fastOutSlowInInterpolator   = AnimationUtils.LoadInterpolator(Context, Android.Resource.Interpolator.FastOutSlowIn);
     linearOutSlowInInterpolator = AnimationUtils.LoadInterpolator(Context, Android.Resource.Interpolator.LinearOutSlowIn);
     colorAnimationDuration      = 400;
     iconAnimationDuration       = 300;
     scaleAnimationDuration      = 200;
 }
Exemple #9
0
        public void StartProgress(long paramLong, ITimeInterpolator paramTimeInterpolator)
        {
            HideIndeterminateSlider(true);
            ShowSlider(false);
            int i = Resources.DisplayMetrics.WidthPixels;

            FrameLayout.LayoutParams localLayoutParams = (FrameLayout.LayoutParams) this.slider.LayoutParameters;
            localLayoutParams.Width = i;
            localLayoutParams.SetMargins(-i, 0, 0, 0);
            this.slider.LayoutParameters = localLayoutParams;
            this.slider.Animate().TranslationX(i).SetDuration(paramLong)
            .SetInterpolator(paramTimeInterpolator);
        }
Exemple #10
0
        public void TurnUp(float x, float y, float radius, long duration, ITimeInterpolator animation)
        {
            Point.Set(x, y);

            Animator         = ValueAnimator.OfFloat(0f, radius);
            Animator.Update += (sender, e) =>
            {
                Invalidate();
            };

            Animator.SetInterpolator(animation);
            Animator.SetDuration(duration);
            Animator.Start();
        }
Exemple #11
0
 public void AnimateCircular(float toValue, int milliseconds = 500, ITimeInterpolator interpolator = null)
 {
     if (animator != null)
     {
         animator.Cancel();
     }
     animator = ObjectAnimator.OfFloat(this, "Progress", 0.0f, toValue);
     if (interpolator != null)
     {
         animator.SetInterpolator(interpolator);
     }
     animator.SetDuration(milliseconds);
     animator.RepeatMode = ValueAnimatorRepeatMode.Restart;
     animator.Start();
 }
        public static void TranslationYAnimate(this View view, int translation, int duration = 300,
		                                        ITimeInterpolator interpolator = null, Action endAction = null)
        {
            ClearOldAnimation (view);
            var animator = ObjectAnimator.OfFloat (view, "translationY", view.TranslationY, translation);
            animator.SetDuration (duration);
            if (interpolator != null)
                animator.SetInterpolator (interpolator);
            animator.AnimationEnd += (sender, e) => {
                currentAnimations.Remove (view);
                if (endAction != null)
                    endAction ();
                ((Animator)sender).RemoveAllListeners ();
            };
            animator.Start ();
        }
Exemple #13
0
        public void TurnDown(float radius, long duration, ITimeInterpolator animation)
        {
            Animator         = ValueAnimator.OfFloat(radius, 0f);
            Animator.Update += (sender, e) =>
            {
                Invalidate();
            };

            Animator.AnimationEnd += (sender, e) =>
            {
                OnTargetClosed?.Invoke();
            };

            Animator.SetInterpolator(animation);
            Animator.SetDuration(duration);
            Animator.Start();
        }
Exemple #14
0
        /// <summary>
        /// Animates a view by changing its Y translation property.
        /// </summary>
        public static ObjectAnimator TranslateToY(this View v, float to, long duration,
                                                  ITimeInterpolator interpolator, Animator.IAnimatorListener listener)
        {
            float from = v.TranslationY;

            //No special skipping

            var animator = ObjectAnimator.OfFloat(v, "translationY", from, to);

            animator.SetInterpolator(interpolator);
            animator.SetDuration(duration);
            if (listener != null)
            {
                animator.AddListener(listener);
            }
            animator.Start();

            return(animator);
        }
Exemple #15
0
        public GuillotineAnimation(GuillotineBuilder builder)
        {
            _actionBarView = builder.ActionBarView;
            _listner       = builder.GuillotineListener;

            _guillotineView      = builder.GuillotineView;
            _duration            = builder.Duration > 0 ? builder.Duration : DEFAULT_DURATION;
            _delay               = builder.StartDelay;
            _isRightToLeftLayout = builder.IsRightToLeftLayout;
            _interpolator        = builder.Interpolator == null ? new GuillotineInterpolator() : builder.Interpolator;
            setUpOpeningView(builder.OpeningView);
            setUpClosingView(builder.ClosingView);
            _openingAnimation = buildOpeningAnimation();
            _closingAnimation = buildClosingAnimation();
            if (builder.IsClosedOnStart)
            {
                _guillotineView.Rotation   = GUILLOTINE_CLOSED_ANGLE;
                _guillotineView.Visibility = ViewStates.Gone;
            }
        }
Exemple #16
0
        public static void TranslationYAnimate(this View view, int translation, int duration = 300,
                                               ITimeInterpolator interpolator = null, Action endAction = null)
        {
            ClearOldAnimation(view);
            var animator = ObjectAnimator.OfFloat(view, "translationY", view.TranslationY, translation);

            animator.SetDuration(duration);
            if (interpolator != null)
            {
                animator.SetInterpolator(interpolator);
            }
            animator.AnimationEnd += (sender, e) => {
                currentAnimations.Remove(view);
                if (endAction != null)
                {
                    endAction();
                }
                ((Animator)sender).RemoveAllListeners();
            };
            animator.Start();
        }
Exemple #17
0
        /// <inheritdoc />
        protected override Animation CreateAnimationTo(GeoCoordinate coordinate, float zoom, TimeSpan duration, ITimeInterpolator timeInterpolator)
        {
            var position   = Pivot.localPosition;
            var position2D = TileController.Projection.Project(coordinate, 0);

            return(CreatePathAnimation(Pivot, duration, timeInterpolator, new List <Vector3>()
            {
                position,
                new Vector3(position2D.x, TileController.GetHeight(zoom), position2D.z)
            }));
        }
Exemple #18
0
 protected PathAnimation CreatePathAnimation(Transform target, TimeSpan duration, ITimeInterpolator timeInterpolator, IEnumerable <Vector3> points)
 {
     return(new PathAnimation(target, timeInterpolator,
                              new UtyMap.Unity.Animations.Path.LinearInterpolator(points),
                              duration));
 }
Exemple #19
0
 /// <summary> Animates to given coordinate using given timeinterpolator and duration. </summary>
 public abstract void AnimateTo(GeoCoordinate coordinate, float zoom, TimeSpan duration, ITimeInterpolator timeInterpolator);
        public static ValueAnimator Flip(this View view, FlipDirection flipDirection, bool returnToOriginalPosition = false, long duration = DefaultAnimationDuration, ITimeInterpolator interpolator = null)
        {
            var flipProperty = "rotationY";
            var flipDegrees  = -180f;

            switch (flipDirection)
            {
            case FlipDirection.LeftToRight:
                flipDegrees = -flipDegrees;
                break;

            case FlipDirection.RightToLeft:
                break;

            case FlipDirection.TopToBottom:
                flipProperty = "rotationX";
                break;

            case FlipDirection.BottomToTop:
                flipProperty = "rotationX";
                flipDegrees  = -flipDegrees;
                break;
            }

            var rotation = ObjectAnimator.OfFloat(
                view,
                flipProperty,
                returnToOriginalPosition ? flipDegrees : 0,
                returnToOriginalPosition ? 0 : flipDegrees);

            rotation.SetDuration(duration);
            rotation.SetInterpolator(interpolator ?? new LinearInterpolator());

            rotation.Start();

            return(rotation);
        }
        public static ValueAnimator Spin(this View view, SpinDirection spinDirection = SpinDirection.Clockwise, long duration = DefaultAnimationDuration, ITimeInterpolator interpolator = null)
        {
            ObjectAnimator rotation = ObjectAnimator.OfFloat(view, "rotation", 0, 360);

            switch (spinDirection)
            {
            case SpinDirection.Clockwise:
                rotation = ObjectAnimator.OfFloat(view, "rotation", 0, 360);
                break;

            case SpinDirection.CounterClockwise:
                rotation = ObjectAnimator.OfFloat(view, "rotation", 0, -360);
                break;
            }

            rotation.SetDuration(duration);
            rotation.SetInterpolator(interpolator ?? new LinearInterpolator());
            rotation.RepeatCount = ValueAnimator.Infinite;

            rotation.Start();

            return(rotation);
        }
        public static ValueAnimator ResetAnimation(this View view, long duration = DefaultAnimationDuration, ITimeInterpolator interpolator = null)
        {
            System.Diagnostics.Debug.WriteLine("Reset Values");

            var reset = ObjectAnimator.OfPropertyValuesHolder(
                view,
                PropertyValuesHolder.OfFloat("translationY", view.TranslationY, 0f),
                PropertyValuesHolder.OfFloat("translationX", view.TranslationX, 0f),
                PropertyValuesHolder.OfFloat("scaleX", view.ScaleX, 1.0f),
                PropertyValuesHolder.OfFloat("scaleY", view.ScaleY, 1.0f),
                PropertyValuesHolder.OfFloat("rotation", view.Rotation, 0.0f),
                PropertyValuesHolder.OfFloat("rotationX", view.RotationX, 0.0f),
                PropertyValuesHolder.OfFloat("rotationY", view.RotationY, 0.0f),
                PropertyValuesHolder.OfFloat("alpha", view.Alpha, 1.0f));

            reset.SetInterpolator(interpolator ?? new AccelerateDecelerateInterpolator());
            reset.SetDuration(duration);
            reset.RepeatCount = 0;
            reset.Start();
            return(reset);
        }
        public static ValueAnimator Slide(this View view, SlideDirection slideDirection, long duration = DefaultAnimationDuration, ITimeInterpolator interpolator = null)
        {
            System.Diagnostics.Debug.WriteLine("Slide Direction: {0}", slideDirection);

            ObjectAnimator slide = null;

            switch (slideDirection)
            {
            case SlideDirection.FromBottom:
                slide = ObjectAnimator.OfFloat(view, "translationY", view.MeasuredHeight, 0f);
                break;

            case SlideDirection.FromLeft:
                slide = ObjectAnimator.OfFloat(view, "translationX", -view.MeasuredWidth, 0f);
                break;

            case SlideDirection.FromRight:
                slide = ObjectAnimator.OfFloat(view, "translationX", view.MeasuredWidth, 0f);
                break;

            case SlideDirection.FromTop:
                slide = ObjectAnimator.OfFloat(view, "translationY", -view.MeasuredHeight, 0f);
                break;

            case SlideDirection.ToBottom:
                slide = ObjectAnimator.OfFloat(view, "translationY", 0f, view.MeasuredHeight);
                break;

            case SlideDirection.ToLeft:
                slide = ObjectAnimator.OfFloat(view, "translationX", 0f, -view.MeasuredWidth);
                break;

            case SlideDirection.ToRight:
                slide = ObjectAnimator.OfFloat(view, "translationX", 0f, view.MeasuredWidth);
                break;

            case SlideDirection.ToTop:
            default:
                slide = ObjectAnimator.OfFloat(view, "translationY", 0f, -view.MeasuredHeight);
                break;
            }

            slide.SetInterpolator(interpolator ?? new DecelerateInterpolator());
            slide.SetDuration(duration);
            slide.Start();
            return(slide);
        }
Exemple #24
0
        /// <inheritdoc />
        protected override Animation CreateAnimationTo(GeoCoordinate coordinate, float zoom, TimeSpan duration, ITimeInterpolator timeInterpolator)
        {
            var position = Camera.localPosition;

            return(new CompositeAnimation(new List <Animation>
            {
                CreatePathAnimation(Camera, duration, timeInterpolator, new List <Vector3>()
                {
                    position,
                    new Vector3(position.x, position.y, -TileController.GetHeight(zoom))
                }),
                CreateRotationAnimation(Pivot, duration, timeInterpolator, new List <Quaternion>()
                {
                    Pivot.rotation,
                    Quaternion.Euler(new Vector3((float)coordinate.Latitude, 270 - (float)coordinate.Longitude, 0))
                })
            }));
        }
Exemple #25
0
 public FakeTransformAnimation(ITimeInterpolator timeInterpolator, TimeSpan duration, bool isLoop = false) :
     base(null, timeInterpolator, duration, isLoop)
 {
 }
Exemple #26
0
        /// <inheritdoc />
        public sealed override void AnimateTo(GeoCoordinate coordinate, float zoom, TimeSpan duration, ITimeInterpolator timeInterpolator)
        {
            _lastState = new AnimationState(coordinate, zoom, duration, timeInterpolator);

            SetAnimation(CreateAnimationTo(coordinate, zoom, duration, timeInterpolator));
            Start();
        }
 public SpotlightBuilder SetAnimation(ITimeInterpolator animation)
 {
     Animation = animation;
     return(this);
 }
        private ObjectAnimator CreateAnimatorForButton(ITimeInterpolator interpolator, View button, float toY)
        {
            ObjectAnimator objectAnimator = ObjectAnimator.OfFloat(button, Y_ANIMATION, toY);

            objectAnimator.SetInterpolator(interpolator);

            objectAnimator.SetDuration(this._animationDuration);
            return objectAnimator;
        }
Exemple #29
0
 /// <summary> Creates animation for given coordinate and zoom level with given duration. </summary>
 protected abstract Animation CreateAnimationTo(GeoCoordinate coordinate, float zoom, TimeSpan duration, ITimeInterpolator timeInterpolator);
Exemple #30
0
 public void startProgress(long paramLong, ITimeInterpolator paramTimeInterpolator)
 {
     startProgress(paramLong, paramTimeInterpolator, null);
 }
Exemple #31
0
 public GuillotineBuilder SetInterpolator(ITimeInterpolator interpolator)
 {
     Interpolator = interpolator;
     return(this);
 }
Exemple #32
0
 public override void SetInterpolator(ITimeInterpolator value)
 {
     _animator.SetInterpolator(value);
 }
Exemple #33
0
 protected RotationAnimation CreateRotationAnimation(Transform target, TimeSpan duration, ITimeInterpolator timeInterpolator, IEnumerable <Quaternion> rotations)
 {
     return(new RotationAnimation(target, timeInterpolator,
                                  new UtyMap.Unity.Animations.Rotation.LinearInterpolator(rotations),
                                  duration));
 }
Exemple #34
0
 public void startProgress(long paramLong, ITimeInterpolator paramTimeInterpolator, Animator.IAnimatorListener paramAnimatorListener)
 {
     hideIndeterminateSlider(true);
     this.slider.TranslationX = 0.0F;
     showSlider(false);
     int i = Resources.DisplayMetrics.WidthPixels;
     FrameLayout.LayoutParams localLayoutParams = (FrameLayout.LayoutParams) this.slider.LayoutParameters;
     localLayoutParams.Width= i;
     localLayoutParams.SetMargins(-i, 0, 0, 0);
     this.slider.LayoutParameters = localLayoutParams;
     this.progressAnimator = this.slider.Animate().TranslationX(i).SetDuration(paramLong).SetInterpolator(paramTimeInterpolator).SetListener(paramAnimatorListener);
 }
 public BaseViewAnimator setInterpolator(ITimeInterpolator interpolator)
 {
     mAnimatorSet.SetInterpolator(interpolator);
     return(this);
 }