Use GSAP's MorphSVG with Motion.page Today! šŸ”„

In this video, we will show you how to add awesome curves to your sections as you scroll down.

In todayā€™s video, Luke demonstrates how to create morphing SVG effects using the MorphSVG plugin integrated with Motion Page. The focus is on enhancing the visual appeal and interactivity of websites by transforming SVG shapes dynamically. He guides viewers through each step, using Bricks Builder for the setup and Motion Page for the animations.

Steps

Setting Up the Page in Bricks Builder:

  • Create a New Page: Begin by setting up a new page with text elements and sections.
  • Import and Arrange Sections: Add and arrange various sections, preparing the layout for the animation.
  • Prepare Elements for Animation: Insert the SVG code and apply the necessary IDs or classes to the SVG paths that will be animated.

Configuring the MorphSVG Animation:

  • Set Up Animation Containers: Ensure the SVG elements with the target IDs or classes are properly positioned and ready for animation.
  • Create Animation Classes: Assign unique identifiers to the SVG paths for easy targeting in Motion Page.

Animating with Motion Page:

  • Create a New Timeline: Initiate a new timeline named ā€˜MorphSVG.ā€™
  • Configure Animation Trigger: Set triggers that activate the animation on page load or scroll, based on the demonstration needs.
  • Apply Morphing Effects: Implement the morphing effect by targeting the SVG paths and using custom code to specify the transformation.

Enhancing the Animation:

  • Customize Character Display: Use different SVG shapes and symbols to create unique morphing effects.
  • Adjust Animation Speed and Duration: Modify the speed and duration of the morphing effect to match the design aesthetics.
  • Refine Animation for Smooth Transitions: Optimize settings for smooth transitions, ensuring the morphing effect integrates seamlessly with the rest of the page design.

Conclusion

Lukeā€™s tutorial offers a comprehensive and practical guide for integrating sophisticated morphing animations into web designs using Bricks Builder and Motion Page. This approach not only boosts the aesthetic quality of web pages but also enhances user interaction through creative and dynamic design elements. By following these steps, designers can add engaging, animated content to their websites, significantly improving the visual and interactive experience for visitors.

Video transcript

Hello guys, welcome back to the channel. My name is Luke, and in todayā€™s video, I want to show you something that a lot of people might have missed with one of our releases. As you can see, back in April of this year, we released 2.1.8 and we actually introduced the MorphSVG plugin, which is for Club GreenSock members only. Weā€™ve integrated it with Motion Page, and I wanted to show you an example of how we can use MorphSVG in todayā€™s video.

Hereā€™s GreenSockā€™s website talking about the MorphSVG plugin and feature. It tells you how you can get started with it, but since weā€™ve implemented it into Motion Page, we donā€™t need to register the plugin. An example of MorphSVG is right here. As you can see, this SVG is morphing from a circle to a hippo. The way this works is it reads the path data in the SVGs and morphs those path coordinates into one another. In this example, the MorphSVG plugin finds the path with the ID of circle and the path with ID of hippo, then it automatically figures out how to add enough points to the circle to get a super smooth morph.

Here is a very basic example. First, we have an ID here, this is what weā€™re going to target, how we normally would target an element in Motion Page, and then weā€™re going to use the custom code box to basically add just this. Here weā€™ll have our original element and then weā€™ll use the custom code box to morph into our target path. It might sound confusing, but when I open Motion Page, youā€™ll see how this is done, and itā€™s actually very simple.

For demonstration purposes, Iā€™m just going to use this SVG code from the GreenSock website. Iā€™m going to use Bricks Builder to do this example today. Letā€™s go to the HTML, and Iā€™m going to copy and paste all of this here, but Iā€™ll copy only up to the SVG because I donā€™t need this button here. Iā€™ll paste it into a code block in Bricks Builder. What Iā€™ve done already is Iā€™ve added two sections to this page, and each sectionā€™s container has a height of 100 viewport height just so we have some room to scroll. Then Iā€™m going to add a third section in the middle. In this container, Iā€™m going to do our code block, and in here, just do content and paste the code from GreenSockā€™s website. As you can see, we have this huge hippo here.

I will also need to copy some CSS, but I donā€™t need the play because this is related to the play button. Iā€™m just going to copy and paste everything else here except for body. So SVG and the hippo. Letā€™s add some styles. When I paste the CSS, the hippopotamus will be hidden because hippo has visibility set to hidden. From the start, we donā€™t want to see it; we only want to see the first SVG, which is the circle here. The circle has an ID of circle, and the hippo has an ID of hippo.

The way this works is we have an SVG tag, and inside that, we have two paths. The first path is the circle, and the second path is the hippo, which we want to morph into. Itā€™s important that these have IDs or classes. Iā€™m going to save this and open up Motion Page.

Iā€™m going to create a new timeline and call it MorphSVG. Letā€™s target our MorphSVG page that I just created with the hippo. Remember what we need to target first, and Iā€™ll use page load for demonstration purposes. First, Iā€™ll need to target the first path, which has an ID of circle. Type circle, press enter, and itā€™s highlighted, which is good. Now we want to morph this into our target path. Go to custom, click this box to add custom code, and paste the MorphSVG code. In Motion Page, you can see it morphing into our second path, which has the ID of hippo.

Now, Iā€™ll show you a second example using custom SVGs. Iā€™m going to delete the SVG code and keep the setup the same. Iā€™m going to find an SVG of a thumbs up and morph it into an SVG of a thumbs down. Since Iā€™m a member of flaticon.com, Iā€™ll grab some SVG code and paste it in.

Iā€™ve found an SVG for a thumbs down, but first, I want it to go from a thumbs up. Iā€™ve found a similar SVG of a thumbs up and pasted it above. We have two SVGs, a thumbs up and a thumbs down. We only need the SVG tag once, so Iā€™ll delete the extra and clean up the code. The most important parts are the paths. Iā€™m going to give these paths a class: thumb1 for thumbs up and thumb2 for thumbs down.

In the CSS, Iā€™ll hide the thumbs down paths. Weā€™ve given the paths a class, and thatā€™s all we need to animate in Motion Page. Save the page and go back to Motion Page. Refresh, and you see our thumbs up. Edit the target to thumb1 and morph it to thumb2. Play the timeline and see the effect.

You can apply this to a scroll trigger as well. Change from page load to scroll trigger, and as you scroll down, the effect takes place. Lock it to the scroll bar for a smooth effect. You can adjust the settings, like the ease and delay, to get the desired effect.

Save the timeline and check it on the front end. As you scroll down, you get this nice morphing effect. Adjust the settings as needed for the desired effect.

I hope you liked this tutorial. We now have MorphSVG included with Motion Page. This simple tutorial should help you get started with morphing your SVGs. Please consider subscribing to the channel and give us a thumbs up on this video. It really helps us out. Iā€™ll see you again in another video very soon. Thank you very much.

100 %