Search in sources :

Example 31 with AnimationSet

use of android.view.animation.AnimationSet in project android_frameworks_base by ResurrectionRemix.

the class DragState method createReturnAnimationLocked.

private Animation createReturnAnimationLocked() {
    final AnimationSet set = new AnimationSet(false);
    set.addAnimation(new TranslateAnimation(0, mOriginalX - mCurrentX, 0, mOriginalY - mCurrentY));
    set.addAnimation(new AlphaAnimation(mOriginalAlpha, mOriginalAlpha / 2));
    set.setDuration(ANIMATION_DURATION_MS);
    set.setInterpolator(mCubicEaseOutInterpolator);
    set.initialize(0, 0, 0, 0);
    // Will start on the first call to getTransformation.
    set.start();
    return set;
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 32 with AnimationSet

use of android.view.animation.AnimationSet in project android_frameworks_base by ResurrectionRemix.

the class DragState method createCancelAnimationLocked.

private Animation createCancelAnimationLocked() {
    final AnimationSet set = new AnimationSet(false);
    set.addAnimation(new ScaleAnimation(1, 0, 1, 0, mThumbOffsetX, mThumbOffsetY));
    set.addAnimation(new AlphaAnimation(mOriginalAlpha, 0));
    set.setDuration(ANIMATION_DURATION_MS);
    set.setInterpolator(mCubicEaseOutInterpolator);
    set.initialize(0, 0, 0, 0);
    // Will start on the first call to getTransformation.
    set.start();
    return set;
}
Also used : AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 33 with AnimationSet

use of android.view.animation.AnimationSet in project UltimateAndroid by cymcsg.

the class DraggableGridViewPager method animateDragged.

private void animateDragged() {
    if (mLastDragged >= 0) {
        final View v = getChildAt(mLastDragged);
        final Rect r = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
        r.inset(-r.width() / 20, -r.height() / 20);
        v.measure(MeasureSpec.makeMeasureSpec(r.width(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(r.height(), MeasureSpec.EXACTLY));
        v.layout(r.left, r.top, r.right, r.bottom);
        AnimationSet animSet = new AnimationSet(true);
        ScaleAnimation scale = new ScaleAnimation(0.9091f, 1, 0.9091f, 1, v.getWidth() / 2, v.getHeight() / 2);
        scale.setDuration(ANIMATION_DURATION);
        AlphaAnimation alpha = new AlphaAnimation(1, .5f);
        alpha.setDuration(ANIMATION_DURATION);
        animSet.addAnimation(scale);
        animSet.addAnimation(alpha);
        animSet.setFillEnabled(true);
        animSet.setFillAfter(true);
        v.clearAnimation();
        v.startAnimation(animSet);
    }
}
Also used : Rect(android.graphics.Rect) View(android.view.View) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 34 with AnimationSet

use of android.view.animation.AnimationSet in project UltimateAndroid by cymcsg.

the class ArcLayout method createShrinkAnimation.

private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long startOffset, long duration, Interpolator interpolator) {
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(true);
    final long preDuration = duration / 2;
    Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setStartOffset(startOffset);
    rotateAnimation.setDuration(preDuration);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setFillAfter(true);
    animationSet.addAnimation(rotateAnimation);
    Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
    translateAnimation.setStartOffset(startOffset + preDuration);
    translateAnimation.setDuration(duration - preDuration);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setFillAfter(true);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) RotateAnimation(android.view.animation.RotateAnimation) Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet)

Example 35 with AnimationSet

use of android.view.animation.AnimationSet in project UltimateAndroid by cymcsg.

the class ArcMenu method createItemDisapperAnimation.

private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
    animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));
    animationSet.setDuration(duration);
    animationSet.setInterpolator(new DecelerateInterpolator());
    animationSet.setFillAfter(true);
    return animationSet;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

Aggregations

AnimationSet (android.view.animation.AnimationSet)118 AlphaAnimation (android.view.animation.AlphaAnimation)86 TranslateAnimation (android.view.animation.TranslateAnimation)75 Animation (android.view.animation.Animation)71 ScaleAnimation (android.view.animation.ScaleAnimation)69 ClipRectAnimation (android.view.animation.ClipRectAnimation)32 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)32 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)30 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)30 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)30 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)30 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)30 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)30 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)30 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)30 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)30 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)30 WindowAnimation_taskToFrontEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation)30 WindowAnimation_taskToFrontExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation)30 WindowAnimation_wallpaperCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation)30