get Matrix for transform animation - Android android.graphics

Android examples for android.graphics:Matrix

Description

get Matrix for transform animation

Demo Code


//package com.java2s;
import android.graphics.Matrix;
import android.os.Build;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;

public class Main {
    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 new Matrix();
        Transformation transformation = new Transformation();
        animation.getTransformation(view.getDrawingTime(), transformation);
        return transformation.getMatrix();
    }/*from   www  . j a  v  a 2  s  .c om*/
}

Related Tutorials