I am transforming and scaling an SVG object to go to the center of the Raphael paper/canvas on the click event. I'd like to get it to return to its original size and position when clicked again. Here's my code...
Code JavaScript:$(window).ready(function() { var paper = new Raphael(document.getElementById('atom_ctr'),324,331) var fb = paper.image('img/FB.svg',60,66,32,32); $(fb.node).click(function() { if (fb.isPointInside(162,165)) { fb.animate({transform: '...t-96,-86s.4'},1500,'elastic'); } else { fb.animate({transform: 't96,86s2.5'},1500,'elastic'); }; }); });
Using Firebug, it looks like there is no identifier or class that I can hook onto in order to reverse the animation, which is why I tried using the isPointInside function. Thing is, I can get one side or the other of the if/else statement to evaluate, but not both!Thanks in advance for your help!



Thanks in advance for your help!
Reply With Quote

Bookmarks