"flip" effect on svg rect around its center-X or center-Y

812 views
Skip to first unread message

peter art

unread,
Apr 30, 2017, 9:24:36 AM4/30/17
to Snapsvg
I am looking for a "flip card" effect that behaves consistently across all browser, specifically, one that also works in IE11.

Something similar to flipping div with css3 presented in this: https://jsfiddle.net/james2doyle/qsQun/
I actually just need an animation that ends on the front-side.

I was playing with rotation, something like this: animate({ transform: "r180, x, y"  }, time) but could not achieve the above effect.

A working example or anything that can move me closer to achieve that would be much appreciated.

Ian

unread,
May 1, 2017, 2:01:56 AM5/1/17
to Snapsvg
I don't think this is possible in a simple way IF you need the perspective (ie the top points don't move in a straight line, they are curved due to perspective, and you would need to calculate this yourself)

peter art

unread,
May 1, 2017, 9:03:43 AM5/1/17
to Snapsvg
Ok, I appreciate your comment. At least I know I am not completely crazy. I have probably spent 10 hours on research, I have tried several different options, was looking at browser-native solutions (css3, smil, transform etc) and several javascript libraries and frameworks. I could not find anything that delivers consistent and desired result. There are examples that work in Chrome but nothing else, so it seems like Chrome is ahead. Unfortunately, I have no luxury of pushing my users to 1 browser. For some time I thought Snap.svg has an advantage because it is built upon Raphael and, in theory, should have more advanced functions on board.   
Anyway, it is interesting to learn that with all amazing technology available today and massive work done by the industry to support it, something as seemingly simple [when looking from outside] as "flip card" effect on svg element cannot really be achieved (at least not by a regular developer with an "easy" way, like rect.flip(vertically)).

Thank you very much for your reply.

Ian

unread,
May 1, 2017, 9:26:08 AM5/1/17
to Snapsvg
IF it's just a rect (ie the rect isn't just a simplification of another more complex object, like an image), you may be able to fake it with a couple of animations (eg drawing the rect as a path and animating the various points). Or there probably is a 3d svg implementation, again if it can be done with points, rather than svg that contains a png or something.

Ian

unread,
May 1, 2017, 9:28:47 AM5/1/17
to Snapsvg
Reply all
Reply to author
Forward
0 new messages