Share Posted July 15, 2021 In this case I want blue circle to come on top of the orange square when the morphing has happened. This is a part of a bigger animation timeline which I am trying to create ? How can I control rendering order, as I belive the first svg takes presidence when morphing to other shape ? See the Pen df3b972a2673cd9e434a35b81966c5ef by krenovate (@krenovate) on CodePen Link to comment Share on other sites More sharing options...
Share Posted July 15, 2021 There's no such thing as zIndex for SVG. Things always render in the order they occur in the DOM, so you literally need to alter the DOM to make the stacking order different. Here's a demo where I flip the order mid-tween: See the Pen 346ac3b8c00eb64766dfc3d3336f5e63?editors=0010 by GreenSock (@GreenSock) on CodePen Does that help? 3 Link to comment Share on other sites More sharing options...
Share Posted July 15, 2021 ... just a little joke. See the Pen GRmWYMg by mikeK (@mikeK) on CodePen Happy tweening ... Mikel 4 1 Link to comment Share on other sites More sharing options...
Share Posted July 15, 2021 You may get some use out of insertBefore (some information seen here) like the below two examples. See the Pen YXoEQe by osublake (@osublake) on CodePen See the Pen yLYJodZ by GreenSock (@GreenSock) on CodePen Edit: Sorry @GreenSock, I just looked at your Pen after the fact, which is what you are doing. ☺️ 6 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