Search in sources :

Example 61 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project material-sheet-fab by gowong.

the class Fab method hide.

/**
	 * Hides the FAB.
	 */
@Override
public void hide() {
    // Only use scale animation if FAB is visible
    if (getVisibility() == View.VISIBLE) {
        // Pivots indicate where the animation begins from
        float pivotX = getPivotX() + getTranslationX();
        float pivotY = getPivotY() + getTranslationY();
        // Animate FAB shrinking
        ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, pivotX, pivotY);
        anim.setDuration(FAB_ANIM_DURATION);
        anim.setInterpolator(getInterpolator());
        startAnimation(anim);
    }
    setVisibility(View.INVISIBLE);
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation)

Example 62 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project actor-platform by actorapp.

the class ViewUtils method elevateView.

public static void elevateView(final View view, boolean isAnimated, float scale) {
    if (view == null) {
        return;
    }
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, scale, 1.0f, scale, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5);
    scaleAnimation.setDuration(isAnimated ? 150 : 0);
    scaleAnimation.setInterpolator(MaterialInterpolator.getInstance());
    scaleAnimation.setFillAfter(true);
    view.clearAnimation();
    view.startAnimation(scaleAnimation);
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation)

Example 63 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project actor-platform by actorapp.

the class ViewUtils method zoomInView.

public static void zoomInView(final View view) {
    if (view == null) {
        return;
    }
    if (view.getVisibility() != View.VISIBLE) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(0, 1f, 0, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(150);
        scaleAnimation.setInterpolator(MaterialInterpolator.getInstance());
        view.clearAnimation();
        view.startAnimation(scaleAnimation);
        view.setVisibility(View.VISIBLE);
    }
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation)

Example 64 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project actor-platform by actorapp.

the class ViewUtils method zoomOutView.

public static void zoomOutView(final View view) {
    if (view == null) {
        return;
    }
    if (view.getVisibility() != View.INVISIBLE) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 0, 1f, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(150);
        scaleAnimation.setInterpolator(MaterialInterpolator.getInstance());
        view.clearAnimation();
        view.startAnimation(scaleAnimation);
        view.setVisibility(View.INVISIBLE);
    }
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation)

Example 65 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project LuaViewSDK by alibaba.

the class UDAnimation method build.

/**
     * build an animation
     *
     * @return
     */
public Animation build(View view) {
    Animation animation = null;
    if (view != null) {
        switch(mAnimationType) {
            case TYPE_ALPHA:
                if (this.mValues != null && this.mValues.length > 0) {
                    animation = new AlphaAnimation(view.getAlpha(), this.mValues[0]);
                }
                break;
            case TYPE_ROTATE:
                if (this.mValues != null && this.mValues.length > 0) {
                    animation = new RotateAnimation(view.getRotation(), this.mValues[0]);
                }
                break;
            case TYPE_SCALE:
                if (this.mValues != null && this.mValues.length > 1) {
                    animation = new ScaleAnimation(view.getScaleX(), this.mValues[0], view.getScaleY(), this.mValues[1]);
                }
                break;
            case TYPE_TRANSLATE:
                if (this.mValues != null && this.mValues.length > 1) {
                    animation = new TranslateAnimation(view.getX(), DimenUtil.dpiToPx(this.mValues[0]), view.getY(), DimenUtil.dpiToPx(this.mValues[1]));
                }
                break;
        }
        if (animation != null) {
            animation.setFillEnabled(true);
            //默认结束后设置属性
            animation.setFillAfter(true);
            animation.setFillBefore(true);
            animation.setDuration(mDuration);
            animation.setStartOffset(mStartOffset);
            animation.setRepeatCount(mRepeatCount);
            if (mOnStartCallback != null || mOnRepeatCallback != null || mOnEndCallback != null) {
                animation.setAnimationListener(new Animation.AnimationListener() {

                    @Override
                    public void onAnimationStart(Animation animation) {
                        LuaUtil.callFunction(mOnStartCallback);
                    }

                    @Override
                    public void onAnimationEnd(Animation animation) {
                        LuaUtil.callFunction(mOnEndCallback);
                    }

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