How do I apply multiple rotation transforms on a Raphael text object?

Posted by Pridkett on Stack Overflow See other posts from Stack Overflow or by Pridkett
Published on 2010-06-18T03:58:39Z Indexed on 2010/06/18 4:03 UTC
Read the original article Hit count: 657

Filed under:
|
|
|

I have a Raphael text object that I would like to rotate around an axis some distance away and also rotate the text accordingly so it stays horizontal. I know this is possible using SVG transformation matrices, but the author of Raphael has stated that they won't be a part of the toolkit anytime soon. Here's some code of what I'd like to do:

txt_obj = paper.text(100, 0, "Hello!");
txt_obj.rotate(90, 100, 100); // rotate text so it is sideways at (200,100)
txt_obj.rotate(-90); // rotate text back to horizontal

Unfortunately, the second rotate command obliterates the translation and rotation accomplished by the first.

Ideally I'd like to animate the operation, but I'll take it one step at a time for right now.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about svg