Convert Android Matrix values to View transform properties -



Convert Android Matrix values to View transform properties -

i have view rotated around x , y axis using view.setrotationx , view.setrotationy. have used view.getmatrix() , modified values of matrix. apply matrix view have not found way of doing without using legacy animation api in android.

basically need convert matrix values view transformation values. example:

float[] src = new float[]{0, 0, view.getwidth(), 0, 0, view.getheight(), view.getwidth(), view.getheight()}; float[] dst = new float[8]; matrix matrix = view.getmatrix(); matrix.mappoints(dst, src); dst[7] = new_y_coord_of_corner; matrix.setpolytopoly(src, 0, dst, 0, dst.length >> 1); //the matrix changed view not. rotation , translation of matrix apply view: float newrotationx = convertmatrixrotationtoviewrotationx(matrix); //method need float newrotationy = convertmatrixrotationtoviewrotationy(matrix); //method need float newtranslationx = convertmatrixrotationtoviewtranslationx(matrix); //method need float newtranslationy = convertmatrixrotationtoviewtranslationy(matrix); //method need view.setrotationy(newrotationx); view.setrotationx(newrotationy); view.setx(newtranslationx); view.sety(newtranslationy);

this might seem far complex way of transforming view need way in order able set x,y corner coordinates of view. more info of getting corner coordinates of way see previous post here: how 4 corner coordinates of view in android

android matrix view transform

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -