/ / Raphael, obtenez les éléments angle après transformation - raphael, transformation, angle

Raphael, obtenez les éléments angle après transformation - raphael, transformation, angle

Comme est affiché ici: http://raphaeljs.com/reference.html#Element.transform

La transformation de Raphaël me permet de déplacer l’élément, mais sans changer les attributs de cet élément.

Mais comme expliqué ici: http://grokbase.com/t/gg/raphaeljs/126j03p95c/get-x-y-coordinates-after-transformation il est possible d’obtenir les valeurs x et y d’un post-traitement. Mais ce que je ne peux pas comprendre, c'est comment obtenir la post-transformation angle du rectangle.

Comment je fais ça?

Réponses:

7 pour la réponse № 1

Accéder à l'objet matrice de l'élément etinvoquez la méthode split () pour obtenir un objet renvoyé avec un ensemble d'informations sur la transformation de matrice. Vérifiez la propriété "rotation" dans l'objet pour obtenir l'état de rotation de l'élément en degrés.

var R = Raphael(0, 0, 500, 400),
rect = R.rect(0, 0, 100, 100).transform("r45");
console.log(rect.matrix.split().rotate);

Référer http://raphaeljs.com/reference.html#Matrix.split

J'espère que cela t'aides.