Search in sources :

Example 46 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project Tapad by berict.

the class AnimateHelper method scaleInOverShoot.

public void scaleInOverShoot(final int view_id, final int delay, final long duration, String handlerName, final Activity activity) {
    final ScaleAnimation scaleInOverShoot = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scaleInOverShoot.setInterpolator(new OvershootInterpolator());
    Map<String, Handler> handlerCreator = new HashMap<>();
    handlerCreator.put(handlerName, new Handler());
    handlerCreator.get(handlerName).postDelayed(new Runnable() {

        @Override
        public void run() {
            View view = activity.findViewById(view_id);
            scaleInOverShoot.setDuration(duration);
            view.startAnimation(scaleInOverShoot);
            view.setVisibility(View.VISIBLE);
            Log.i("AnimateHelper", "scale IN OVERSHOOT effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
        }
    }, delay);
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) HashMap(java.util.HashMap) Handler(android.os.Handler) View(android.view.View) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 47 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project Tapad by berict.

the class AnimateHelper method scaleIn.

public void scaleIn(final View view, final int delay, final long duration, String handlerName) {
    final ScaleAnimation scaleIn = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    view.setVisibility(View.INVISIBLE);
    scaleIn.setInterpolator(new AccelerateDecelerateInterpolator());
    if (delay > 0) {
        Map<String, Handler> handlerCreator = new HashMap<>();
        handlerCreator.put(handlerName, new Handler());
        handlerCreator.get(handlerName).postDelayed(new Runnable() {

            @Override
            public void run() {
                scaleIn.setDuration(duration);
                view.startAnimation(scaleIn);
                view.setVisibility(View.VISIBLE);
                Log.i("AnimateHelper", "scale IN effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
            }
        }, delay);
    } else {
        scaleIn.setDuration(duration);
        view.startAnimation(scaleIn);
        view.setVisibility(View.VISIBLE);
        Log.i("AnimateHelper", "scale IN effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
    }
}
Also used : HashMap(java.util.HashMap) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Handler(android.os.Handler) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 48 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project Tapad by berict.

the class AnimateHelper method scaleIn.

public void scaleIn(final View view, int touchX, int touchY, final int delay, final long duration, String handlerName, Activity activity) {
    float x = touchX / window.getWindowWidthPx(activity);
    float y = touchY / window.getWindowHeightPx(activity);
    final ScaleAnimation scaleOut = new ScaleAnimation(0, 1, 0, 1, Animation.ABSOLUTE, x, Animation.ABSOLUTE, y);
    scaleOut.setInterpolator(new AccelerateDecelerateInterpolator());
    Map<String, Handler> handlerCreator = new HashMap<>();
    handlerCreator.put(handlerName, new Handler());
    handlerCreator.get(handlerName).postDelayed(new Runnable() {

        @Override
        public void run() {
            view.setVisibility(View.VISIBLE);
            scaleOut.setDuration(duration);
            view.startAnimation(scaleOut);
            Log.i("AnimateHelper", "scale IN effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
        }
    }, delay);
    handlerCreator.get(handlerName).postDelayed(new Runnable() {

        @Override
        public void run() {
            view.setVisibility(View.GONE);
        }
    }, delay + 10);
}
Also used : HashMap(java.util.HashMap) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Handler(android.os.Handler) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 49 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project Klyph by jonathangerbaud.

the class AnimationHelper method createHeightOutAnimation.

/**
 * @return A fade out animation from 100% - 0% taking half a second
 */
public static Animation createHeightOutAnimation() {
    Animation heightOut = new ScaleAnimation(SCALE_1, SCALE_1, SCALE_1, SCALE_0);
    heightOut.setDuration(ANIMATION_LENGTH);
    return heightOut;
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 50 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project GwellDemo by dxsdyhm.

the class ScreenShotImageView method AnimalStar.

private void AnimalStar() {
    final AlphaAnimation alphaAnimation = new AlphaAnimation(0.1f, 1.0f);
    alphaAnimation.setDuration(100);
    final ScaleAnimation animation = new ScaleAnimation(1.0f, 0.3f, 1.0f, 0.3f, Animation.RELATIVE_TO_SELF, 0.1f, Animation.RELATIVE_TO_SELF, 0.9f);
    animation.setDuration(800);
    animation.setFillAfter(true);
    AnimationSet set = new AnimationSet(false);
    set.setFillAfter(true);
    set.addAnimation(alphaAnimation);
    set.addAnimation(animation);
    this.setAnimation(set);
    set.start();
    set.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
            setColorFilter(Color.WHITE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            if (removeHandler != null) {
                removeHandler.sendEmptyMessageDelayed(0, DeleteTime);
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationSet(android.view.animation.AnimationSet) 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