Skip to content

Instantly share code, notes, and snippets.

@niusounds
Created May 12, 2014 03:48
Show Gist options
  • Save niusounds/bc96522ea32ed1922c3d to your computer and use it in GitHub Desktop.
Save niusounds/bc96522ea32ed1922c3d to your computer and use it in GitHub Desktop.
Matrix to Matrix implementation
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;
}
}
@setiawanjemy88
Copy link

Fork this...
Need attentions please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment