Share Posted June 13, 2019 Hi, This simple example doesn't work with Chrome , but work with Firefox. Do you know the reason ? Chrome : Version 75.0.3770.80 (Build officiel) (64 bits) Firefox : 67.0.2 Thanks you See the Pen BgNbpj by jackisjack-the-bold (@jackisjack-the-bold) on CodePen Link to comment Share on other sites More sharing options...
Share Posted June 13, 2019 Hello @JackIsJack44 and welcome to the GreenSock Forum! That doesn't work in Chrome due to the nesting of SVG element within another SVG element. You have to target your main parent <svg> #main and not its child nested <svg> #test. var t1 = new TimelineMax(); t1.to('#main', 2, {x:200,y:200}); See the Pen agOrBJ by jonathan (@jonathan) on CodePen Happy Tweening 3 Link to comment Share on other sites More sharing options...
Author Share Posted June 13, 2019 Thanks you but I can't move the main svg (Sorry I didn't explain the whole situation...) 1/ I am using a global svg as a main container because it has a viewbox property that enables me to make zoom/focus easily. 2/ and I use as many svg child as elements because I want to be able to know their positions and width/height easily. Is there a better way to do that ? See the Pen BgozYz by jackisjack-the-bold (@jackisjack-the-bold) on CodePen Link to comment Share on other sites More sharing options...
Share Posted June 13, 2019 Maybe I'm not understanding this project, but why does each child need to a be a new SVG? Couldn't they just be groups of elements? 1 Link to comment Share on other sites More sharing options...
Author Share Posted June 13, 2019 Good question. That's because I didn't find a proper way to get the 'height/width' of a <g> element. Link to comment Share on other sites More sharing options...
Share Posted June 13, 2019 If you just need all the original sizes and positions before transforms, getBBox() should work fine. After transforms have been applied is a different story. Blake has a good write-up here: Happy tweening. 1 Link to comment Share on other sites More sharing options...
Author Share Posted June 13, 2019 Great link. Thanks you. I have to think now... native getBBox() vs specific getBBox() vs getBoundingClientRect() vs nested svg (but gsap+chrome KO) vs <g>+<use> ... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now