Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clip-rect area rotation raphael.js

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

Could you please tell me how I can rotate that clip-rect area (not the image). Maybe I should use clipPath svg attr? But it has to be raphael.js solution, so that IE's vml would do this as well?

like image 757
Dima Bildin Avatar asked Nov 14 '22 00:11

Dima Bildin


1 Answers

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 in fiddle: http://jsfiddle.net/arpitworld/ME2Gr/1/

like image 101
Arpit Agrawal Avatar answered Jan 08 '23 23:01

Arpit Agrawal