Morphing Page Transition
Today we’d like to share a simple morphing page transition effect with you. The idea is to morph an SVG path while moving an intro page up, creating an interesting, flowy look. For the animations we use anime.js and for some letter effects we use Charming. In the demos we use an “intro transition” in order to showcase the effect, but that’s of course only one of the many use cases for this kind of page transition.
This demo is kindly sponsored by PageCloud, the website builder you’ll love to use.
If you would like to become a demo sponsor, you can find out more here.
The structure that allows us to move the shape along with the intro content, looks as follows:
<div class="content content--intro">
<div class="content__inner">
<!-- ... -->
</div>
<div class="shape-wrap">
<svg class="shape" width="100%" height="100vh" preserveAspectRatio="none" viewBox="0 0 1440 800" xmlns:pathdata="http://www.codrops.com/">
<path
d="M -44,-50 C -52.71,28.52 15.86,8.186 184,14.69 383.3,22.39 462.5,12.58 638,14 835.5,15.6 987,6.4 1194,13.86 1661,30.68 1652,-36.74 1582,-140.1 1512,-243.5 15.88,-589.5 -44,-50 Z"
pathdata:id="M -44,-50 C -137.1,117.4 67.86,445.5 236,452 435.3,459.7 500.5,242.6 676,244 873.5,245.6 957,522.4 1154,594 1593,753.7 1793,226.3 1582,-126 1371,-478.3 219.8,-524.2 -44,-50 Z">
</path>
</svg>
</div>
</div><!-- /content--intro -->
<div class="content content--fixed">
<div class="content__inner">
<!-- ... -->
</div>
</div><!-- /content--fixed -->
The fixed content lies beneath the intro content, and once we move the intro content up, it gets revealed. At the same time we morph the SVG path into the one defined in the pathdata:id. When creating the two paths, one needs to make sure that they both have the same amount of points so that the morphing happens smoothly.
We hope you enjoy this little effect and find it useful!
References and Credits
- anime.js by Julian Garnier
- Images by Unsplash.com
- Charming.js by Yuan Qing
- imagesLoaded by Dave DeSandro
- Black Grunge set by Freepik
- City Skylines by Freepik
Morphing Page Transition was written by Mary Lou and published on Codrops.
LEAVE A REPLY
You must be logged in to post a comment.