HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div>
<div id="content">
<svg id="Mountain-Scroll" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 800" preserveAspectRatio="xMidyMin">
<defs>
<style>
.mountain-1 {
fill: #98e2f6;
}
.mountain-2 {
fill: #2992c8;
}
.mountain-3, .mountain-6 {
fill: #fff;
}
.mountain-4 {
opacity: 0.5;
}
.mountain-5 {
fill: #1aace5;
}
.mountain-6 {
stroke: #fff;
stroke-miterlimit: 10;
}
.mountain-7 {
fill: #d6d6d6;
}
</style>
</defs>
<g id="Sky">
<rect class="mountain-1" width="1000" height="447"/>
</g>
<g id="Mountain-Top">
<g id="Layer_19" data-name="Layer 19">
<polygon class="mountain-2" points="1000 261.5 903.9 140.5 813 229.5 614.2 49.5 470.4 237.5 280.6 168.5 251.7 245.5 143.8 152.5 0 305.5 0 714.5 1000 715.6 1000 261.5"/>
</g>
<g id="Layer_18" data-name="Layer 18">
<polygon class="mountain-3" points="0 297.6 0 714.1 60.2 715 60.2 415.4 95.8 360.9 115.7 242.8 119.9 206.5 144 152 0 297.6"/>
</g>
<g id="Layer_17" data-name="Layer 17">
<polygon class="mountain-3" points="281 168 165 263 0.2 715 187 715 243 346 274 357 299 270 283 257 301 263 281 168"/>
</g>
<g id="Layer_16" data-name="Layer 16">
<polygon class="mountain-3" points="614 50 384 206.2 537 264 678 180.8 682 154.5 614 50"/>
</g>
<g id="Layer_15" data-name="Layer 15">
<polygon class="mountain-3" points="904 140 717 247 688 321 534 716 774 716 813 368 830 347 805 331 840 281 883 281 918 207 904 140"/>
</g>
<g id="Layer_14" data-name="Layer 14">
<polygon class="mountain-3" points="411 295 472 299 507 327 531 396 466 328 411 295"/>
</g>
</g>
<g id="Mountain-Middle">
<g id="Layer_11" data-name="Layer 11">
<g class="mountain-4">
<rect class="mountain-2" x="759.7" y="387.7" width="5.6" height="32.32"/>
<polygon class="mountain-2" points="751 402 774 402 762.8 367.8 751 402"/>
</g>
</g>
<g id="Layer_10" data-name="Layer 10">
<g class="mountain-4">
<rect class="mountain-2" x="789.3" y="379.1" width="5.6" height="32.32"/>
<polygon class="mountain-2" points="780.6 393.4 803.6 393.4 792.4 359.2 780.6 393.4"/>
</g>
</g>
<g id="Layer_9" data-name="Layer 9">
<g class="mountain-4">
<rect class="mountain-2" x="143" y="373.9" width="5.6" height="32.32"/>
<polygon class="mountain-2" points="134.3 388.2 157.3 388.2 146.1 354 134.3 388.2"/>
</g>
</g>
<g id="Layer_8" data-name="Layer 8">
<g class="mountain-4">
<rect class="mountain-2" x="172.6" y="376.4" width="5.6" height="32.32"/>
<polygon class="mountain-2" points="163.9 390.7 186.9 390.7 175.7 356.5 163.9 390.7"/>
</g>
</g>
<g id="Layer_7" data-name="Layer 7">
<g class="mountain-4">
<rect class="mountain-2" x="41.3" y="375.5" width="5.6" height="32.32"/>
<polygon class="mountain-2" points="32.6 389.8 55.6 389.8 44.4 355.7 32.6 389.8"/>
</g>
</g>
<g id="Layer_6" data-name="Layer 6">
<path class="mountain-5" d="M1000,302.3C874,345.5,757.1,445.1,627.9,469.1c-120.1,22.2-240.5-22.6-359.7-52.3C179.9,394.8,86.2,382,0,409V852l1000,1.7Z"/>
</g>
<g id="Layer_5" data-name="Layer 5">
<path class="mountain-6" d="M479.7,562.4c-7.4-1.4-16.7-5.4-16.6-14.2s9.2-12.1,16.4-13.6A580.8,580.8,0,0,0,587,501.7c30.7-12.8,63.3-25.8,86.7-49.5,2-2,4-4.2,5.9-6.3-8.4,3.3-8.2,4.8-19.7,8.7-32.4,30.9-101.3,38.3-144.1,44.7-65.3,9.8-132.4,11.4-194.4,37.3-13.7,5.8-26.9,18.9-16.9,33.6,4.8,7,12.8,11.3,20.5,15.3C437.2,643.4,875.5,820.3,999.1,852V656.7C884.1,634.8,594.6,584.3,479.7,562.4Z"/>
</g>
</g>
<g id="Mountain-Bottom">
<g id="Layer_13" data-name="Layer 13">
<path class="mountain-7" d="M1000,594c-133.2,69.4-276.7,101.3-418.9,92.1C385.9,673.4,193.7,585.4,0,577.6V962H1000Z"/>
</g>
<g id="Layer_12" data-name="Layer 12">
<path class="mountain-3" d="M73.6,802.3c44.8,42.3,103.8,61.1,155.7,91.1C249.1,904.9,119.2,929.8,0,950.2v11.9H999c-249.8-77.6-532.6-95-786.4-250.2-41.5-25.5,143.1-45,215.2-48.7L228.4,614c-55,21.1-107.2,52.7-154.8,89.5C62,712.5,50,722.9,46,737.8c-3.3,12.1-.7,25.4,4.9,36.4S64.8,794.1,73.6,802.3Z"/>
</g>
</g>
</svg>
<svg id="Boarder-Scroll" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1000 7600">
<defs>
<style>
.cls-1 {
fill: #fbb469;
}
.cls-2 {
fill: #4699c2;
}
.cls-3 {
fill: #fbda67;
}
.cls-4 {
fill: #fff;
}
.cls-5 {
fill: #8fb3c6;
}
.cls-10, .cls-16, .cls-18, .cls-6 {
fill: none;
}
.cls-7 {
fill: #2f6b82;
}
.cls-14, .cls-8 {
fill: #444d56;
}
.cls-9 {
clip-path: url(#clip-path);
}
.cls-10 {
stroke: #f7931e;
stroke-width: 35px;
}
.cls-10, .cls-16, .cls-18 {
stroke-miterlimit: 10;
}
.cls-11 {
fill: #326a89;
}
.cls-12 {
clip-path: url(#clip-path-2);
}
.cls-13 {
fill: #ee607f;
}
.cls-14 {
opacity: 0.35;
}
.cls-15 {
clip-path: url(#clip-path-3);
}
.cls-16 {
stroke: #fff;
stroke-width: 7px;
}
.cls-17 {
fill: #316a88;
}
.cls-18 {
stroke: #f9f9f9;
}
</style>
<clipPath id="clip-path" transform="translate(0 4.5)">
<path class="cls-1" d="M422.36,420.12c-7.78,23.59-15,47.45-22.82,71.1-4.43,13.46-10.46,29.93-7,44.29a40.2,40.2,0,0,0,20.47,25.64c18,9,38,10.85,57.32,4.47,4.21-1.39,8.39-3.2,11.67-6.19,6-5.48,7.15-16.38,8.33-24,1.43-9.31,15-102.37,15-103.81s4.29-42.95,4.29-42.95,10.74-70.16,12.89-81.61c1.86-9.95,5.11-19.54,7.06-29.49,2.89-14.75,5.78-31.57,1.29-46.25-3.43-11.21-11.19-21.07-23.52-22.62-10.63-1.33-24.6.32-32.08,8.87a31.35,31.35,0,0,0-6.45,10.74L443.12,357.12Z"/>
</clipPath>
<clipPath id="clip-path-2" transform="translate(0 4.5)">
<path class="cls-2" d="M441,297s-1.07,77.68,60.14,89.49l19.33-80.18-5-7.16-40.81-28.64S441.69,296.27,441,297Z"/>
</clipPath>
<clipPath id="clip-path-3" transform="translate(0 4.5)">
<path class="cls-3" d="M467.1,274.43s19.33,19.33,48.69,13.6a34.9,34.9,0,0,1-3.5,9.82,16.37,16.37,0,0,1-9.08,7.36c-4.5,1.56-7.79.37-12.11-1.12a77.22,77.22,0,0,1-23.28-12.48S466.39,280.16,467.1,274.43Z"/>
</clipPath>
</defs>
<rect id="background" class="cls-4" width="1000" height="8008.9"/>
<g id="cliffs">
<g id="Layer0_0_FILL" data-name="Layer0 0 FILL">
<path class="cls-5" d="M745,856.2l70.2,172-84.1,404.4,91.6,50.9-138.4,441v4l34.5,55.9L680.3,2180l233.5,120.9,10.6,279.3L710,2831.9l97.8,195.6-30.6,100.4L731,3172.1l22.1,46.1,42.2,61.7L750.8,3327,803,3428.3l49.6,759.3-167,153.6,90,184.5-16.3,285.8,52.3,69.1-63.2,556.2,95.2,502.7-108,107.4L859,6189.4l100.4,266.3-69.2,239.9L796,6955.1l79,37.6-45.8,311.1,37.3,696.5h135.3V638.3L745,856.2m-547.1-98L0,351.2V8000.7H151.4l127.8-868.5L185,6872.6l155.6-239.9L216.2,6366.4,339.6,6224l-83.9-525,71.2-85.1-63.2-556.2,52.3-69.1-88.5-325.9,114.1-140.3-62.6-487,11.5-313.6L324.6,3482,274,3446.9,262,3165l-100.9-36.1,68.1-496.5-91.6-50.9,138.4-441v-4l-34.5-55.9L280,1885l-77.4-56.8-58.7-475.4,106.4-119.7-97.8-195.5,50.7-78.7-87-111.5,81.7-89.2m185.6,2454h0l-.9-.1Z" transform="translate(0 4.5)"/>
</g>
<path id="Layer0_0_1_STROKES" data-name="Layer0 0 1 STROKES" class="cls-6" d="M0,351.2,197.9,758.1l-81.6,89.3,87,111.5-50.7,78.7,97.8,195.5L144,1352.8l58.7,475.4L280,1885l-38.6,195.6,34.5,55.9m.1,4-138.4,441m91.6,50.9-68.1,496.5L262,3165l12,281.9,50.6,35.1-34.1,239.8L279,4035.4l62.6,486.9L227.5,4662.6,316,4988.5l-52.3,69.1,63.2,556.2-71.2,85.1,83.9,525L216.3,6366.3l124.4,266.3L185.1,6872.5l94.2,259.6L151.5,8000.6m715-.4-37.3-696.5L875,6992.6,796,6955l94.2-259.6,69.2-239.9L859,6189.4,735.7,6046.9l108-107.4-95.2-502.7,63.2-556.2-52.3-69.1,16.3-285.8-90-184.5,167-153.6-49.6-759.3L750.8,3327l44.5-47.1-42.2-61.7L731,3172.1l46.2-44.2,30.6-100.4L710,2831.9l214.4-251.7-10.6-279.3L680.3,2180l38.6-195.6-34.5-55.9v-4l138.4-441-91.6-50.9,84.1-404.4-70.2-172,256.8-217.8" transform="translate(0 4.5)"/>
<g id="shadows">
<polyline class="cls-7" points="245.9 2163.6 202.6 2284.9 136.9 2039.9"/>
<polyline class="cls-7" points="126.3 1436.1 55.6 1509.3 170.2 1789.8"/>
<polyline class="cls-7" points="25.2 1850.4 25.2 2082.8 93.5 1719"/>
<polyline class="cls-7" points="136.9 2636.9 196.4 2674 150.8 3053.9"/>
<polyline class="cls-7" points="48 3136.4 213.4 3202 103.6 3676.9"/>
<polyline class="cls-7" points="231.1 3479.9 275.3 3502.6 166.7 3937.1"/>
<polyline class="cls-7" points="248.8 4078.6 322.7 4482.8 60.6 4348.9"/>
<polyline class="cls-7" points="840.5 1057.1 768 1390.6 957.5 1516.9"/>
<polyline class="cls-7" points="924.6 1287 944.8 1372.9 980.2 1248.4"/>
<polyline class="cls-7" points="714.9 1926.2 790.7 1991.9 821 1544.7"/>
<polyline class="cls-7" points="821 1868.1 821 1961.5 967.6 1868.1"/>
<polyline class="cls-7" points="737.7 2162.4 894.3 2257.1 980.2 1914.8"/>
<polyline class="cls-7" points="747.8 2845.4 821 2994.8 924.6 2636.9"/>
<polyline class="cls-7" points="942.3 2676.5 821 3136.4 980.2 3330.8"/>
<polyline class="cls-7" points="836.2 3429.3 881.7 3429.3 869 4004.5"/>
<polyline class="cls-7" points="725 4351.4 858.9 4222.6 965 4351.4"/>
<polyline class="cls-7" points="798.3 4697.5 783.1 4801.1 881.7 4697.5"/>
<polyline class="cls-7" points="803.4 4540.9 803.4 4664.7 917 4566.2"/>
<polyline class="cls-7" points="234.9 5084.1 298.1 5584.3 65.7 5687.8"/>
<polyline class="cls-7" points="224.8 4783.4 282.9 4955.2 245.9 5000.7"/>
<polyline class="cls-7" points="798.3 6018.8 960 5826.8 975.1 6218.4"/>
<polyline class="cls-7" points="922.1 6266.4 957.5 6367.4 975.1 6266.4"/>
<polyline class="cls-7" points="170.2 6958.6 245.9 7145.5 126.3 7911"/>
<polyline class="cls-7" points="30.3 6958.6 126.3 6660.5 111.1 7706.4"/>
<polyline class="cls-7" points="186.1 6392.7 262.7 6569.5 50.5 6569.5"/>
<polyline class="cls-7" points="170.2 746.4 93.5 812.1 55.6 493.8"/>
<polyline class="cls-7" points="136.9 1057.1 219.8 1213.8 25.2 1418.4"/>
<polyline class="cls-7" points="793.2 865.1 840.5 986.4 980.2 695.9"/>
<polyline class="cls-7" points="922.1 7044.5 864 7309.7 893 7948.9"/>
<polyline class="cls-7" points="840.5 6923.2 972.6 6981.3 972.6 6551.8"/>
<polyline class="cls-7" points="832.4 4980.5 773 5386 965 5056.3"/>
<polyline class="cls-7" points="948.6 5127 860.2 5288.7 948.6 5354.4"/>
<line class="cls-6" x1="845" y1="5331.6" x2="798.3" y2="5407.4"/>
</g>
</g>
<g id="hero">
<path class="cls-8" d="M425.22,421.55c-7.77,23.6-15,47.45-22.82,71.1C398,506.12,392,522.59,395.45,537a40.21,40.21,0,0,0,20.47,25.64c18,9,38,10.84,57.32,4.46,4.21-1.39,8.38-3.2,11.67-6.19,6-5.48,7.15-16.38,8.32-24.05,1.44-9.3,15-102.37,15-103.8s4.29-43,4.29-43,10.74-70.16,12.89-81.61c1.87-9.95,5.12-19.54,7.06-29.48,2.9-14.75,5.78-31.58,1.29-46.26-3.42-11.21-11.19-21.07-23.51-22.61-10.64-1.34-24.61.31-32.09,8.86a31.31,31.31,0,0,0-6.44,10.74L446,358.55Z" transform="translate(0 4.5)"/>
<g>
<path class="cls-1" d="M422.36,420.12c-7.78,23.59-15,47.45-22.82,71.1-4.43,13.46-10.46,29.93-7,44.29a40.2,40.2,0,0,0,20.47,25.64c18,9,38,10.85,57.32,4.47,4.21-1.39,8.39-3.2,11.67-6.19,6-5.48,7.15-16.38,8.33-24,1.43-9.31,15-102.37,15-103.81s4.29-42.95,4.29-42.95,10.74-70.16,12.89-81.61c1.86-9.95,5.11-19.54,7.06-29.49,2.89-14.75,5.78-31.57,1.29-46.25-3.43-11.21-11.19-21.07-23.52-22.62-10.63-1.33-24.6.32-32.08,8.87a31.35,31.35,0,0,0-6.45,10.74L443.12,357.12Z" transform="translate(0 4.5)"/>
<g class="cls-9">
<path class="cls-10" d="M447.2,382.49a789.45,789.45,0,0,1,31.09,75.91c1.74,5,3.45,10.38,2,15.45-1.71,5.84-7.16,9.66-12.24,13l-65.38,43a246.2,246.2,0,0,0,31.85,59" transform="translate(0 4.5)"/>
</g>
</g>
<path class="cls-8" d="M485.36,382.89s-35.08,23.63-35.8,24.34,13.61,9.31,15,10.74-1.43,2.15-4.3,3.58-25.05,7.88-25.05,7.88q-6.72-3.27-13.34-6.7c-5.58-2.89-14.33-5.71-16.88-11.91-2.74-6.66,1.59-11.25,5.06-16.35q4.92-7.22,10-14.34c5.9-8.33,11.69-17.6,19.06-24.75.14-.14.28-.28.43-.41l-1.43-3.58s-30.78,2.15-32.93.72-1.43-6.44,2.15-13.6c3.95-7.91,10.53-15.27,16.12-22.09A200.33,200.33,0,0,1,437.54,301c1.54-1.52,5.67-7,5.82-2.71.09,2.83-2,6.07-2.46,8.88a66,66,0,0,0-.34,21.4c3.61,23.64,21.07,41.19,41.25,52.45C483,381.64,484.17,382.27,485.36,382.89Z" transform="translate(0 4.5)"/>
<path class="cls-11" d="M494.31,384.68s-7.06-.73-7.84-.73-65.9-23.61-45.14-87.32c.11-.33,1.63,73,51.41,87.32" transform="translate(0 4.5)"/>
<g>
<path class="cls-2" d="M441,297s-1.07,77.68,60.14,89.49l19.33-80.18-5-7.16-40.81-28.64S441.69,296.27,441,297Z" transform="translate(0 4.5)"/>
<g class="cls-12">
<path class="cls-11" d="M482,322.11a8.3,8.3,0,0,0-3.56,5.13,15.05,15.05,0,0,0-.17,6.34c.33,2.14.91,4.29,1.38,6.58a24.91,24.91,0,0,1,.46,7.26,28.7,28.7,0,0,1-1.66,7.22,22.31,22.31,0,0,1-3.68,6.28,32,32,0,0,1-5.1,4.91,34.94,34.94,0,0,1-5.88,3.79l-.35-.36a64.44,64.44,0,0,1,3.67-5.84c1.25-1.86,2.49-3.65,3.62-5.45s2.21-3.56,3.21-5.37a19.84,19.84,0,0,0,2.21-5.73c.88-3.95-.21-8.34-.37-13.08a17.22,17.22,0,0,1,1.2-7.05,10.85,10.85,0,0,1,1.9-3.05,7.87,7.87,0,0,1,2.9-2Z" transform="translate(0 4.5)"/>
<path class="cls-11" d="M492.24,319.37a107.84,107.84,0,0,0-15.43,44.29,105.42,105.42,0,0,0-.71,13.41,1.5,1.5,0,0,0,3,0,103.61,103.61,0,0,1,15.73-56.18c1-1.65-1.58-3.15-2.59-1.52Z" transform="translate(0 4.5)"/>
</g>
</g>
<path class="cls-8" d="M486.79,460.21c-.59-.65-9,6-9.86,6.74a27.12,27.12,0,0,0-7.11,9.66c-1.3,3.13-2.6,6.89-2.42,10.33a4.2,4.2,0,0,0,1.36,3.06,3.28,3.28,0,0,0,4.87-1.15,37.7,37.7,0,0,0,6.66,13.8c.66.92,2.42,4,3.61,4.11,1.58.17,3.58-3.19,4.32-4.31l10,2.86c.23-1.43.47-2.86.71-4.29l4.3.71q1.59-9.8,3.2-19.59Z" transform="translate(0 4.5)"/>
<path class="cls-2" d="M558.85,433.75a57.71,57.71,0,0,0-1.63-7q-2.54-9.46-5-18.93c-3.8-14.41-7.56-29.55-11.31-44-4.34,2.2-12.09,6.93-19.38,10.79-9,4.78-17.83,10.19-20.37,11.44L514,409.77q1.07,2,2.12,3.91s3.58,5,0,9.3-34.36,35.8-34.36,35.8l12.89,25.06c.51,1.66,8.36,1.09,11.45-1.44,6.42-5.24,13.26-10,19.87-15q7.54-5.72,15-11.5c4.86-3.78,11-7.11,15-11.85A12.37,12.37,0,0,0,558.85,433.75Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M506.46,482.14c2.6-2.12,5.28-4.17,8-6.19-7.76-7.78-20.13-22.54-20.13-22.54l-6.44,7.16c-.57.62,7.56,10.44,8.45,11.48C499.44,475.64,503,478.86,506.46,482.14Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M494.25,373.44l6.87,12.63,39.68-21.82c-3.82-14.69-6.86-26.44-7.67-29.54-2.8-10.68-4.92-20.69-12.73-29.1-5.13,8.1-10.28,16.18-15.36,24.31-4.69,7.54-10.66,14.47-13.76,22.9a19.06,19.06,0,0,0-.78,12A39.42,39.42,0,0,0,494.25,373.44Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M556,444a12.37,12.37,0,0,0,2.87-10.26,57.71,57.71,0,0,0-1.63-7q-1.23-4.61-2.44-9.21c-5.62,5.33-13.73,13.52-14.65,17.23-1.06,4.23,4.54,12.38,7.52,16.34A41.92,41.92,0,0,0,556,444Z" transform="translate(0 4.5)"/>
<path class="cls-13" d="M464.6,418c4,3.45,8.63,8.33,12.59,11.79,5.7,5,15.52,11.27,12.47,20.43-.72,2.15-7.16,10.74-7.16,10.74q-10-1.44-20-3c-5.19-.82-10.37-1.66-15.53-2.59-4.66-.83-11.6-.94-15.16-4.15-2.74-2.46-4.07-8.13-2.61-11.59,1.53-3.63,12.74-2.28,16.11-2.28l-5.88-5-4.14-2.9S456.72,423,464.6,418Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M458.87,427.28c.72,0,5.73,3.58,6.44,5s-17.18,7.16-17.18,7.16l-3.27-2.67-5.47-4.45Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M453.14,443l8.59,6.44s12.89-1.43,14.32-2.15-5-7.15-5.72-7.87S453.14,443,453.14,443Z" transform="translate(0 4.5)"/>
<path class="cls-14" d="M461.73,449.47s-13,3.26-16.87-12.69Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M371.89,181.36c-12-5.2-12-19.88-11.45-30.87a2.67,2.67,0,0,1,4.51-1.78l.08.07a2.66,2.66,0,0,0,4.42-1.28c.88-3.45,2-7.83,2.44-9.08.51-1.55.65-4.48,2.66-4.78,2.6-.39,3.43,2.93,3.07,4.77-.72,3.58.71-1.43,2.14,0s8.59,17.9,8.59,19.33" transform="translate(0 4.5)"/>
<path class="cls-2" d="M444.55,292.69l47.25-29.35s-3.58-21.48-26.49-43c0,0-16.46-24.34-20-28.64s-12.89-13.6-34.36-24.34l-21.48-10.74S370.1,173.13,371.53,186c0,0,36.51,19.33,38.66,20.76s3.58,2.15,4.29,3.58,1.44,6.44,5,7.16S437.39,236.85,444.55,292.69Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M464.53,279.69s2-39.48,18.55-37.58c0,0-13.47-20.3-17.77-21.73s-21.11,17.94-26.3,41.9l5.54,31.84" transform="translate(0 4.5)"/>
<path class="cls-8" d="M427.31,176.62s-1,24.07,4.71,24.79,20.12-.27,20.12-.27A78.3,78.3,0,0,0,427.31,176.62Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M391.21,157.37c-.71.37-16.46,17.55-15,24l10.74,7.16,17-24.72Z" transform="translate(0 4.5)"/>
<path class="cls-8" d="M467.82,275.15l-.72,18.61,7.16,15.75,7.88,7.16,10.74,1.43,12.17-7.16,10.74-12.88,2.14-9.31s-45.81-13.6-50.83-14.32" transform="translate(0 4.5)"/>
<path class="cls-11" d="M461.73,271.21c-.22,2.56.42,12.16,1.63,20.61.79,5.52,2.83,9.72,5.72,14.36,2.68,4.3,5.47,8.56,8.48,12.65,1.36,1.84,3.85,6.29,6.37,6.79,4,.8,9.36-2.15,12.88-3.67,12.36-5.32,17.41-20.76,22.91-32.13l-2.86-1.43c-2.1,5.77-3.67,12.25-7.82,17a43,43,0,0,1-14.37,10.25c-3.58,1.43-6.45,2.14-10,.71-7.82-3.13-12.83-10.71-15.32-18.47a38.86,38.86,0,0,1-1.86-12c0-.93.68-11.52,0-11.81Z" transform="translate(0 4.5)"/>
<g>
<path class="cls-3" d="M467.1,274.43s19.33,19.33,48.69,13.6a34.9,34.9,0,0,1-3.5,9.82,16.37,16.37,0,0,1-9.08,7.36c-4.5,1.56-7.79.37-12.11-1.12a77.22,77.22,0,0,1-23.28-12.48S466.39,280.16,467.1,274.43Z" transform="translate(0 4.5)"/>
<g class="cls-15">
<path class="cls-16" d="M465.6,290.29l29.85-6.54L476,300.93l58.67-5.17" transform="translate(0 4.5)"/>
</g>
</g>
<path class="cls-2" d="M461.38,273.29S514,287,519.71,289.82c0,0,9-27.56-10.8-53.92C508.91,235.9,462.82,232.31,461.38,273.29Z" transform="translate(0 4.5)"/>
<path class="cls-17" d="M462.84,264.41s51.54,8.34,58.7,14.38l-.38,2.44c-7.16-6-58.71-15.1-58.71-15.1Z" transform="translate(0 4.5)"/>
<path class="cls-17" d="M476.4,267s8.6-27,9.32-27.69,4.29-1.43,4.29-1.43l-12.22,29.83Z" transform="translate(0 4.5)"/>
<polygon class="cls-17" points="512.83 280.27 518.65 259.6 520.08 264.61 514.11 280.62 512.83 280.27"/>
</g>
<g>
<path id="trail" class="cls-18" d="M609.9,164.5C409.6,442.1,358.6,821.2,478.4,1141.8c63.2,169.2,172,330.8,164.4,511.2-10.9,256.6-255.6,464.7-246.1,721.3,8.9,239.3,238.1,431.3,235.1,670.7-2.1,170.6-121.8,315.4-169.7,479.1-55,188.3-12.3,389.2,21.4,582.4a6140.59,6140.59,0,0,1,57.2,1697.7c-27.7,262-72.4,523.1-73.4,786.5s45,534.4,184.9,757.7" transform="translate(0 4.5)"/>
</g>
</svg>
</div>
</div>
html, body {
width:100%;
height:100%;
margin:0;
}
gsap.registerPlugin(ScrollTrigger, MotionPathPlugin);
// this is an old solution - ScrollSmoother is recommended now instead
// https://greensock.com/scrollsmoother/
smoothScroll("#content");
function mountainPara() {
gsap.timeline({
scrollTrigger:{
trigger:"#Mountain-Scroll",
start:"top top",
end:"bottom bottom",
scrub: true
}
})
.from("#Sky", {y:0,}, 0)
.fromTo("#Mountain-Top",{y:150}, {y:-300}, 0)
.fromTo("#Mountain-Middle", {y:350,}, {y:-300}, 0)
.fromTo("#Mountain-Bottom", {y:500}, {y:-300}, 0);
}
function snowboardPara() {
let direction = 1,
isRefreshing = false,
heroGetter = gsap.getProperty("#hero"),
heroSetter = gsap.quickSetter("#hero", "rotation", "deg"),
rotation = {base: heroGetter("rotation"), extra: -180},
addRotation = () => {
rotation.base = heroGetter("rotation");
heroSetter(rotation.base + rotation.extra);
};
gsap.set("#hero", { scale: 0.7, autoAlpha: 1, transformOrigin: "50% 50%" });
gsap.to("#hero", {
motionPath: {
path: "#trail",
align: "#trail",
autoRotate: 90,
alignOrigin: [0.5, 0.5]
},
onUpdate: addRotation,
immediateRender: true,
ease:"none",
scrollTrigger:{
trigger:"#Boarder-Scroll",
start: "top 100",
end: "bottom bottom",
scrub: true,
invalidateOnRefresh: true,
onRefreshInit: () => isRefreshing = true,
onUpdate: self => {
if (isRefreshing) { // don't allow the direction to CHANGE during resize/refresh
direction = self.direction;
} else if (direction !== self.direction) {
direction = self.direction;
gsap.to(rotation, {
extra: direction === 1 ? -180 : 0,
ease: "power1.inOut",
onUpdate: () => heroSetter(rotation.base + rotation.extra),
overwrite: true
});
}
},
onRefresh: () => {
isRefreshing = false;
if (heroGetter("rotation") === rotation.base) {
addRotation();
}
}
}
});
}
// this is the helper function that sets it all up. Pass in the content <div> and then the wrapping viewport <div> (can be the elements or selector text). It also sets the default "scroller" to the content so you don't have to do that on all your ScrollTriggers.
function smoothScroll(content, viewport, smoothness) {
content = gsap.utils.toArray(content)[0];
gsap.set(viewport || content.parentNode, {overflow: "hidden", position: "fixed", height: "100%", width: "100%", top: 0, left: 0, right: 0, bottom: 0});
gsap.set(content, {overflow: "visible", width: "100%"});
let getProp = gsap.getProperty(content),
setProp = gsap.quickSetter(content, "y", "px"),
removeScroll = () => content.style.overflow = "visible",
needsRefreshFix = parseFloat(ScrollTrigger.version.split(".").map(n => ("00" + n).substr(n.length - 1, 3)).join("")) < 3006002,
height;
function onResize() {
height = content.clientHeight;
content.style.overflow = "visible"
document.body.style.height = height + "px";
}
onResize();
ScrollTrigger.addEventListener("refreshInit", onResize);
ScrollTrigger.addEventListener("refresh", () => {
removeScroll();
requestAnimationFrame(removeScroll);
})
ScrollTrigger.defaults({scroller: content});
ScrollTrigger.prototype.update = p => p; // works around an issue in ScrollTrigger 3.6.1 and earlier (fixed in 3.6.2, so this line could be deleted if you're using 3.6.2 or later)
ScrollTrigger.scrollerProxy(content, {
scrollTop(value) {
return arguments.length ? setProp(-value) : -getProp("y");
},
getBoundingClientRect() {
return {top: 0, left: 0, width: window.innerWidth, height: window.innerHeight};
}
});
gsap.fromTo(content, {y:0}, {
y: () => document.documentElement.clientHeight - height,
ease: "none",
onUpdate: ScrollTrigger.update,
scrollTrigger: {
scroller: window,
invalidateOnRefresh: true,
start: 0,
end: () => height - document.documentElement.clientHeight,
scrub: smoothness || 3,
onRefresh: self => {
// when the screen resizes, we just want the animation to immediately go to the appropriate spot rather than animating there, so basically kill the scrub.
gsap.killTweensOf(self.animation);
self.animation.progress(self.progress);
if (needsRefreshFix) {
let all = ScrollTrigger.getAll();
all.slice(all.indexOf(self)+1).forEach(t => t.refresh());
}
}
}
});
}
window.addEventListener("load", function(event) {
mountainPara();
snowboardPara();
});
Also see: Tab Triggers