これは古い質問ですが、私は自分の道を切り開いたので、答えを共有したいと思いました.
したがって、Raphael 呼び出し内であっても、SVG オブジェクトに直接アクセスできます。
this.node.getAttribute('x')
また
this.node.getAttribute('transform')
2 つ目は、必要なものを取得するものです。Raphael でテキストを回転させる際の問題は、SVG で変換を設定することだけです。
<text x="600" y="606.240234375" text-anchor="middle" style="text-anchor: middle;
font: normal normal normal 10px/normal Arial; font-family: Arial; font-weight: 900;
font-size: 18px; " font="10px "Arial"" stroke="none" fill="#000000"
font-family="Arial" font-weight="900" font-size="18px" transform="rotate(45 600 600)">
<tspan style="-webkit-user-select: none; cursor: pointer; ">FOOBAR</tspan></text>
.rotate() を複数回呼び出すと以前の設定が上書きされるため、最終的に SVG 変換で回転する呼び出しは 1 つだけになります。ただし、属性に直接アクセスすることで、独自の変換を追加できます。変換は逆の順序で実行されるように見えるので (または何か -- 正直なところあまり考えたことはありません)、追加の回転を最初に実行する場合は最後に配置します。
<script>
(function (raphael) {
$(function () {
var paper = raphael("raphael_div", 500, 500);
upside_down_text = paper.text(100,100,'UPSIDE DOWN')
.attr('font-family','Arial')
.attr('font-size','24px');
upside_down_text.rotate(25,250,250); // rotate using Raphael
// But first we want to rotate 180 degrees.
height = upside_down_text.getBBox().height;
upside_down_text.node.setAttribute('transform',
upside_down_text.node.getAttribute('transform')+
' rotate(180 '+
upside_down_text.node.getAttribute('x')+
' '+
(upside_down_text.node.getAttribute('y')-(height/2))+
')');
});
})(Raphael.ninja());
</script>
<div id="raphael_div"></div>