Example #1
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;
        }
Example #2
0
        private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
                long startOffset, long duration, IInterpolator interpolator)
        {
            Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
            animation.StartOffset = startOffset;
            animation.Duration = duration;
            animation.Interpolator = interpolator;
            animation.FillAfter = true;

            return animation;
        }