Search in sources :

Example 26 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project QLibrary by DragonsQC.

the class AnimationUtils method getLessenScaleAnimation.

/**
     * 获取一个缩小动画
     *
     * @param durationMillis    时间
     * @param animationListener 监听
     * @return 一个缩小动画
     */
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);
    return scaleAnimation;
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation)

Example 27 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project android_frameworks_base by DirtyUnicorns.

the class AppTransition method createThumbnailScaleAnimationLocked.

/**
     * This animation runs for the thumbnail that gets cross faded with the enter/exit activity
     * when a thumbnail is specified with the pending animation override.
     */
Animation createThumbnailScaleAnimationLocked(int appWidth, int appHeight, int transit, Bitmap thumbnailHeader) {
    Animation a;
    getDefaultNextAppTransitionStartRect(mTmpRect);
    final int thumbWidthI = thumbnailHeader.getWidth();
    final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
    final int thumbHeightI = thumbnailHeader.getHeight();
    final float thumbHeight = thumbHeightI > 0 ? thumbHeightI : 1;
    if (mNextAppTransitionScaleUp) {
        // Animation for the thumbnail zooming from its initial size to the full screen
        float scaleW = appWidth / thumbWidth;
        float scaleH = appHeight / thumbHeight;
        Animation scale = new ScaleAnimation(1, scaleW, 1, scaleH, computePivot(mTmpRect.left, 1 / scaleW), computePivot(mTmpRect.top, 1 / scaleH));
        scale.setInterpolator(mDecelerateInterpolator);
        Animation alpha = new AlphaAnimation(1, 0);
        alpha.setInterpolator(mThumbnailFadeOutInterpolator);
        // This AnimationSet uses the Interpolators assigned above.
        AnimationSet set = new AnimationSet(false);
        set.addAnimation(scale);
        set.addAnimation(alpha);
        a = set;
    } else {
        // Animation for the thumbnail zooming down from the full screen to its final size
        float scaleW = appWidth / thumbWidth;
        float scaleH = appHeight / thumbHeight;
        a = new ScaleAnimation(scaleW, 1, scaleH, 1, computePivot(mTmpRect.left, 1 / scaleW), computePivot(mTmpRect.top, 1 / scaleH));
    }
    return prepareThumbnailAnimation(a, appWidth, appHeight, transit);
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) WindowAnimation_wallpaperCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperCloseExitAnimation) CurvedTranslateAnimation(com.android.server.wm.animation.CurvedTranslateAnimation) WindowAnimation_activityOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation) WindowAnimation_wallpaperOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation) WindowAnimation_taskToBackEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation) WindowAnimation_activityOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) ClipRectAnimation(android.view.animation.ClipRectAnimation) WindowAnimation_wallpaperOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation) WindowAnimation_launchTaskBehindTargetAnimation(com.android.internal.R.styleable.WindowAnimation_launchTaskBehindTargetAnimation) WindowAnimation_launchTaskBehindSourceAnimation(com.android.internal.R.styleable.WindowAnimation_launchTaskBehindSourceAnimation) WindowAnimation_taskCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) WindowAnimation_wallpaperIntraCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseEnterAnimation) WindowAnimation_taskToBackExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation) WindowAnimation_activityCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation) WindowAnimation_taskCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation) WindowAnimation_taskOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation) WindowAnimation_wallpaperIntraCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation) ClipRectTBAnimation(com.android.server.wm.animation.ClipRectTBAnimation) WindowAnimation_taskOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation) ClipRectLRAnimation(com.android.server.wm.animation.ClipRectLRAnimation) WindowAnimation_activityCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation) WindowAnimation_taskToFrontEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation) WindowAnimation_wallpaperIntraOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenEnterAnimation) WindowAnimation_wallpaperIntraOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation) WindowAnimation_taskToFrontExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation) WindowAnimation_wallpaperCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 28 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project weex-example by KalicyZhou.

the class SplashActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    View textView = findViewById(R.id.fullscreen_content);
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(scaleAnimation);
    animationSet.setDuration(1000);
    animationSet.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            startMainActivity();
            finish();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    textView.startAnimation(animationSet);
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) View(android.view.View) AnimationSet(android.view.animation.AnimationSet) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 29 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project android_packages_apps_DUI by DirtyUnicorns.

the class FlingLogoController method getSpinAnimation.

public static AnimationSet getSpinAnimation(int mode) {
    final boolean makeHidden = mode == LOGO_ANIMATE_HIDE;
    final float from = makeHidden ? 1.0f : 0.0f;
    final float to = makeHidden ? 0.0f : 1.0f;
    final float fromDeg = makeHidden ? 0.0f : 360.0f;
    final float toDeg = makeHidden ? 360.0f : 0.0f;
    Animation scale = new ScaleAnimation(from, to, from, to, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    RotateAnimation rotate = new RotateAnimation(fromDeg, toDeg, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    AnimationSet animSet = new AnimationSet(true);
    animSet.setInterpolator(new LinearInterpolator());
    animSet.setDuration(150);
    animSet.setFillAfter(true);
    animSet.addAnimation(scale);
    animSet.addAnimation(rotate);
    return animSet;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) AnimationSet(android.view.animation.AnimationSet) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 30 with ScaleAnimation

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

the class AbsListView method setAnimation.

private View setAnimation(View view) {
    if (view == null) {
        return view;
    }
    int scrollY = 0;
    boolean down = false;
    Animation anim = null;
    try {
        scrollY = getChildAt(0).getTop();
    } catch (NullPointerException e) {
        scrollY = mPositionV;
    }
    if (mPositionV < scrollY) {
        down = true;
    }
    mPositionV = scrollY;
    switch(mListAnimationMode) {
        case 1:
            anim = new ScaleAnimation(0.5f, 1.0f, 0.5f, 1.0f);
            break;
        case 2:
            anim = new ScaleAnimation(0.5f, 1.0f, 0.5f, 1.0f, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 1.0f);
            break;
        case 3:
            anim = new ScaleAnimation(0.5f, 1.0f, 0.5f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
            break;
        case 4:
            anim = new AlphaAnimation(0.0f, 1.0f);
            break;
        case 5:
            anim = new TranslateAnimation(0.0f, 0.0f, -mHeight, 0.0f);
            break;
        case 6:
            anim = new TranslateAnimation(0.0f, 0.0f, mHeight, 0.0f);
            break;
        case 7:
            if (down) {
                anim = new TranslateAnimation(0.0f, 0.0f, -mHeight, 0.0f);
            } else {
                anim = new TranslateAnimation(0.0f, 0.0f, mHeight, 0.0f);
            }
            break;
        case 8:
            if (down) {
                anim = new TranslateAnimation(0.0f, 0.0f, mHeight, 0.0f);
            } else {
                anim = new TranslateAnimation(0.0f, 0.0f, -mHeight, 0.0f);
            }
            break;
        case 9:
            anim = new TranslateAnimation(-mWidth, 0.0f, 0.0f, 0.0f);
            break;
        case 10:
            anim = new TranslateAnimation(mWidth, 0.0f, 0.0f, 0.0f);
            break;
    }
    if (mListAnimationInterpolatorMode == 0) {
        return applyAnimationToView(view, anim);
    }
    switch(mListAnimationInterpolatorMode) {
        case 1:
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.anim.accelerate_interpolator));
            break;
        case 2:
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.anim.decelerate_interpolator));
            break;
        case 3:
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.anim.accelerate_decelerate_interpolator));
            break;
        case 4:
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.anim.anticipate_interpolator));
            break;
        case 5:
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.anim.overshoot_interpolator));
            break;
        case 6:
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.anim.anticipate_overshoot_interpolator));
            break;
        case 7:
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.anim.bounce_interpolator));
            break;
    }
    return applyAnimationToView(view, anim);
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

Aggregations

ScaleAnimation (android.view.animation.ScaleAnimation)114 AnimationSet (android.view.animation.AnimationSet)60 AlphaAnimation (android.view.animation.AlphaAnimation)56 Animation (android.view.animation.Animation)50 TranslateAnimation (android.view.animation.TranslateAnimation)40 ClipRectAnimation (android.view.animation.ClipRectAnimation)28 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)28 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)26 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)26 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)26 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)26 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)26 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)26 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)26 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)26 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)26 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)26 WindowAnimation_taskToFrontEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation)26 WindowAnimation_taskToFrontExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation)26 WindowAnimation_wallpaperCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation)26