Share Posted May 22, 2017 For the life of me can't figure out how to make my SVG morph. What am I missing? Oh and why is the SVG getting cut off? See the Pen rmoWMq by markmulvey (@markmulvey) on CodePen Link to comment Share on other sites More sharing options...
Share Posted May 22, 2017 Hi @iammarkmulvey Welcome to the forum and thanks for joining Club GreenSock. You're targeting a group for your morph, but the plugin works path to path. To fix this, move your IDs from the groups to the paths within those groups like this: <path id="Finger1" class="st0" d="M-214 570.4c0-4.7-2.9-6.7-6-6.7 -3.5 0-6.3 2.4-6.3 5.6v5.9 -13c0-3.1-1.4-7.3-5.8-7.3 -4.2 0-6 2.3-6 6l-0.1 10.6 0.1-15.9c0-3.1-4-5.7-7.1-5.7s-6.1 2.7-6.1 5.8v11.6 -41.9c0-3.1-2.9-5.7-6-5.7s-6 2.5-6 5.7v55.5l-4.8-13.9c-0.7-2.8-4.4-4.9-7.2-4.2 -4 1-5.1 4.4-4.6 7.5 0 0 4.8 17 4.9 17.7 3.2 17.2 12.9 31 30 31s31.2-13.9 31.2-31L-214 570.4z"/> <path id="Finger2" class="st0" d="M-214 570.4c0-4.7-2.9-6.7-6-6.7 -3.5 0-6.3 2.4-6.3 5.6v5.9 -13c0-3.1-1.4-7.3-5.8-7.3 -4.2 0-6 2.3-6 6l-0.1 10.6 0.1-46.1c0-3.1-4-5.7-7.1-5.7s-6.1 2.7-6.1 5.8v41.8 -8.9c0-3.1-2.9-5.7-6-5.7s-6 2.5-6 5.7v22.5l-4.8-13.9c-0.7-2.8-4.4-4.9-7.2-4.2 -4 1-5.1 4.4-4.6 7.5 0 0 4.8 17 4.9 17.7 3.2 17.2 12.9 31 30 31s31.2-13.9 31.2-31L-214 570.4z"/> You actually don't need the paths to be in groups so you can delete the group wrappers if you like. Once you move those IDs, switch your morph tween to this: TweenMax.to("#Finger1", 1, {morphSVG: "#Finger2", ease:Power1.easeInOut}); See the Pen 532712e3a929eb11cb600b34ecfe6ecd by PointC (@PointC) on CodePen That should get you working correctly. Happy tweening. 2 Link to comment Share on other sites More sharing options...
Author Share Posted May 22, 2017 Craig you rock! Thank you. Link to comment Share on other sites More sharing options...
Author Share Posted May 22, 2017 one more question though. When I add. The SVG gets cut off? TweenMax.to("#Finger1", 1, {x: 20, ease: Power1.easeOut}); See the Pen rmoWMq by markmulvey (@markmulvey) on CodePen Link to comment Share on other sites More sharing options...
Share Posted May 22, 2017 Your path is moving outside of the SVG viewBox. To fix that you could animate the x position of the entire SVG or you can set the svg overflow to visible in your CSS. Happy morphing. 1 Link to comment Share on other sites More sharing options...
Author Share Posted May 22, 2017 Perfect and understood. Overflow in CSS. Thanks again Craig. 1 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