Straight line rotation raphael.js

I can show the rectangular part of the image using the clip-rect attribute in raphael.js.

Could you tell me how I can rotate this area with a clip (and not an image). Maybe I should use clippath svg attr? But this should be a raphael.js solution, so IE vml would also do this?

+5
source share
1 answer

You can do something like this:

r = Raphael('myid',600,400);
myimage = r.image('http://25.media.tumblr.com/032e7b64fbc53862cb4c53b6a564f216/tumblr_mnthd5m5y21sqq5odo3_1280.jpg',0,0,600,400)
myimage.attr({'clip-rect':[100,100,200,200]})
myrect  = r.rect(100,100,200,200).transform("r45")
myimage.clip.setAttribute("transform", myrect.node.getAttribute("transform"))

See the script: http://jsfiddle.net/arpitworld/ME2Gr/1/

+1
source

All Articles