Created
May 12, 2014 03:48
-
-
Save niusounds/bc96522ea32ed1922c3d to your computer and use it in GitHub Desktop.
Matrix to Matrix implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.animation.TypeEvaluator; | |
import android.graphics.Matrix; | |
public class MatrixEvaluator implements TypeEvaluator<Matrix> { | |
private Matrix evaluated = new Matrix(); | |
private float[] values = new float[9]; | |
private float[] startValues = new float[9]; | |
private float[] endValues = new float[9]; | |
@Override | |
public Matrix evaluate(float fraction, Matrix startValue, Matrix endValue) { | |
startValue.getValues(startValues); | |
endValue.getValues(endValues); | |
for (int i = 0; i < 9; i++) { | |
values[i] = startValues[i] * (1 - fraction) + endValues[i] * fraction; | |
} | |
evaluated.setValues(values); | |
return evaluated; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fork this...
Need attentions please