Search in sources :

Example 71 with Transformation

use of android.view.animation.Transformation in project remusic by aa112901.

the class SwipeRefreshLayout method startScaleDownAnimation.

private void startScaleDownAnimation(AnimationListener listener) {
    mScaleDownAnimation = new Animation() {

        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            setAnimationProgress(1 - interpolatedTime);
        }
    };
    mScaleDownAnimation.setDuration(SCALE_DOWN_DURATION);
    mHeadViewContainer.setAnimationListener(listener);
    mHeadViewContainer.clearAnimation();
    mHeadViewContainer.startAnimation(mScaleDownAnimation);
}
Also used : Transformation(android.view.animation.Transformation) Animation(android.view.animation.Animation)

Example 72 with Transformation

use of android.view.animation.Transformation in project Carbon by ZieIony.

the class MatrixHelper method getMatrix.

public static Matrix getMatrix(View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        return view.getMatrix();
    Animation animation = view.getAnimation();
    if (animation == null)
        return matrix;
    Transformation transformation = new Transformation();
    animation.getTransformation(view.getDrawingTime(), transformation);
    return transformation.getMatrix();
}
Also used : Transformation(android.view.animation.Transformation) Animation(android.view.animation.Animation)

Example 73 with Transformation

use of android.view.animation.Transformation in project platform_frameworks_base by android.

the class View method setDisplayListProperties.

/**
     * This method is called by getDisplayList() when a display list is recorded for a View.
     * It pushes any properties to the RenderNode that aren't managed by the RenderNode.
     */
void setDisplayListProperties(RenderNode renderNode) {
    if (renderNode != null) {
        renderNode.setHasOverlappingRendering(getHasOverlappingRendering());
        renderNode.setClipToBounds(mParent instanceof ViewGroup && ((ViewGroup) mParent).getClipChildren());
        float alpha = 1;
        if (mParent instanceof ViewGroup && (((ViewGroup) mParent).mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {
            ViewGroup parentVG = (ViewGroup) mParent;
            final Transformation t = parentVG.getChildTransformation();
            if (parentVG.getChildStaticTransformation(this, t)) {
                final int transformType = t.getTransformationType();
                if (transformType != Transformation.TYPE_IDENTITY) {
                    if ((transformType & Transformation.TYPE_ALPHA) != 0) {
                        alpha = t.getAlpha();
                    }
                    if ((transformType & Transformation.TYPE_MATRIX) != 0) {
                        renderNode.setStaticMatrix(t.getMatrix());
                    }
                }
            }
        }
        if (mTransformationInfo != null) {
            alpha *= getFinalAlpha();
            if (alpha < 1) {
                final int multipliedAlpha = (int) (255 * alpha);
                if (onSetAlpha(multipliedAlpha)) {
                    alpha = 1;
                }
            }
            renderNode.setAlpha(alpha);
        } else if (alpha < 1) {
            renderNode.setAlpha(alpha);
        }
    }
}
Also used : Transformation(android.view.animation.Transformation) Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 74 with Transformation

use of android.view.animation.Transformation in project ListViewCellDeleteAnimation by paraches.

the class MainActivity method collapse.

private void collapse(final View v, AnimationListener al) {
    final int initialHeight = v.getMeasuredHeight();
    Animation anim = new Animation() {

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
                v.setVisibility(View.GONE);
            } else {
                v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };
    if (al != null) {
        anim.setAnimationListener(al);
    }
    anim.setDuration(ANIMATION_DURATION);
    v.startAnimation(anim);
}
Also used : Transformation(android.view.animation.Transformation) ScaleAnimation(android.view.animation.ScaleAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation)

Example 75 with Transformation

use of android.view.animation.Transformation in project sweet-alert-dialog by pedant.

the class SuccessTickView method startTickAnim.

public void startTickAnim() {
    // hide tick
    mLeftRectWidth = 0;
    mRightRectWidth = 0;
    invalidate();
    Animation tickAnim = new Animation() {

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            super.applyTransformation(interpolatedTime, t);
            if (0.54 < interpolatedTime && 0.7 >= interpolatedTime) {
                // grow left and right rect to right
                mLeftRectGrowMode = true;
                mLeftRectWidth = mMaxLeftRectWidth * ((interpolatedTime - 0.54f) / 0.16f);
                if (0.65 < interpolatedTime) {
                    mRightRectWidth = MAX_RIGHT_RECT_W * ((interpolatedTime - 0.65f) / 0.19f);
                }
                invalidate();
            } else if (0.7 < interpolatedTime && 0.84 >= interpolatedTime) {
                // shorten left rect from right, still grow right rect
                mLeftRectGrowMode = false;
                mLeftRectWidth = mMaxLeftRectWidth * (1 - ((interpolatedTime - 0.7f) / 0.14f));
                mLeftRectWidth = mLeftRectWidth < MIN_LEFT_RECT_W ? MIN_LEFT_RECT_W : mLeftRectWidth;
                mRightRectWidth = MAX_RIGHT_RECT_W * ((interpolatedTime - 0.65f) / 0.19f);
                invalidate();
            } else if (0.84 < interpolatedTime && 1 >= interpolatedTime) {
                // restore left rect width, shorten right rect to const
                mLeftRectGrowMode = false;
                mLeftRectWidth = MIN_LEFT_RECT_W + (CONST_LEFT_RECT_W - MIN_LEFT_RECT_W) * ((interpolatedTime - 0.84f) / 0.16f);
                mRightRectWidth = CONST_RIGHT_RECT_W + (MAX_RIGHT_RECT_W - CONST_RIGHT_RECT_W) * (1 - ((interpolatedTime - 0.84f) / 0.16f));
                invalidate();
            }
        }
    };
    tickAnim.setDuration(750);
    tickAnim.setStartOffset(100);
    startAnimation(tickAnim);
}
Also used : Transformation(android.view.animation.Transformation) Animation(android.view.animation.Animation)

Aggregations

Transformation (android.view.animation.Transformation)108 Animation (android.view.animation.Animation)61 Point (android.graphics.Point)24 Paint (android.graphics.Paint)22 AlphaAnimation (android.view.animation.AlphaAnimation)18 Animatable (android.graphics.drawable.Animatable)17 LinearInterpolator (android.view.animation.LinearInterpolator)17 Matrix (android.graphics.Matrix)15 RectF (android.graphics.RectF)13 Rect (android.graphics.Rect)7 Bitmap (android.graphics.Bitmap)6 MagnificationSpec (android.view.MagnificationSpec)5 View (android.view.View)3 BezierDecelerateInterpolator (acr.browser.lightning.interpolator.BezierDecelerateInterpolator)2 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)2 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)2 WindowPanel (com.android.server.wm.WindowManagerService.WindowPanel)2 Fragment (android.app.Fragment)1 FragmentTransaction (android.app.FragmentTransaction)1 Intent (android.content.Intent)1