Hi,
I've created SVG animation which you can see below.
1. Demo with animated <g id="tomato"> element
http://codepen.io/ihatetomatoes/pen/VYLMrJ
This works great in Chrome, but not in FF & IE because I didn't realize that <g> can not be animated because it doesn't have x/y coordinates.
2. Demo with animated <svg id="tomato"> element
So I've created svg out of that group and animated that instead. You can see it here:
http://codepen.io/ihatetomatoes/pen/xbZzXp
Again, this works as expected in Chrome, and FF also bounces the tomato, but some reason the xPercent values are not applied in FF & IE. Any idea why?
tl.set(tomatoLeft, {xPercent: 23.6});
tl.set(tomatoLeaves, {xPercent: 41});
3. Demo with animated <svg id="tomato"> and animating x
When I change the xPercent offset to x, everything seems to be working fine also in FF & IE, but I wanted to keep the animation responsive.
All I've changed is the xPercent to x like this:
tl.set(tomatoLeft, {xPercent: 23.6});
tl.set(tomatoLeaves, {xPercent: 41});
// Became
tl.set(tomatoLeft, {x: "+=26px"});
tl.set(tomatoLeaves, {x: "+=26px"});
.to([tomatoLeft, tomatoLeaves], 0.2, {xPercent: 0},"split")
// Became
.to([tomatoLeft, tomatoLeaves], 0.2, {x: "-=26px"},"split")
Here is the updated Codepen, which works fine in FF & IE.
http://codepen.io/ihatetomatoes/pen/XJXYZa
Questions
How do I keep the xPercent offsets and make this work in FF & IE? Maybe I am missing something simple, after staring at the tomato too long.
Keep up the great work with GSAP Carl and the team.
Cheers
Petr