Use GSAP's MorphSVG with Motion.page Today! š„
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.