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>
<section>
<h1>section 1</h1>
</section>
<section>
<h1>section 2</h1>
</section>
<section id="animation">
<h1 class="typed">hello
<span></span>
</h1>
<div id="draw">
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 512 512" class=icons>
<path fill="none" stroke="#507c5c" stroke-miterlimit="10" stroke-width="2" d="M496.3 280.4h-66.2a15.7 15.7 0 1 0 0 31.4h50.5v163.3l-205-30.7V311.7h63.9a15.7 15.7 0 1 0 0-31.4h-10V238h166.8c8.7 0 15.7-7 15.7-15.7V18.5A15.7 15.7 0 0 0 494 3L257.6 38.5A15.6 15.6 0 0 0 244.2 54v83.9h-39.7V63.7a15.7 15.7 0 0 0-18-15.6L13.4 73.7A15.8 15.8 0 0 0 0 89.3V225c0 8.7 7 15.7 15.7 15.7h78.5v39.6H15.7C7 280.3 0 287.3 0 296v126.7c0 7.8 5.7 14.4 13.4 15.6l173.1 25.5 2.3.2a15.6 15.6 0 0 0 15.7-15.7v-71.6h39.7V458c0 7.7 5.7 14.3 13.4 15.5L494 509l2.3.2c3.7 0 7.4-1.3 10.2-3.8 3.5-3 5.5-7.3 5.5-11.9V296.1c0-8.7-7-15.7-15.7-15.7zM275.6 67.5l205-30.7v169.8h-205V67.5zM31.4 102.9l141.7-21v127.4H31.4V102.9zM173.1 430 31.4 409.1v-97.3h141.7V430zm71.1-134v79.3h-39.7V296c0-8.7-7-15.7-15.7-15.7H95.6v-39.6h93.2c8.7 0 15.8-7 15.7-15.7v-85.6h39.7v82.9c0 8.7 7 15.7 15.7 15.7h68.2v42.3h-68.2c-8.7 0-15.7 7-15.7 15.7z" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 512 512" class=icons>
<path fill="none" stroke="#507c5c" stroke-miterlimit="10" d="M438.8 167a39.8 39.8 0 0 0-39.8 39.8v66.9h-8.5v-26.2a14.6 14.6 0 0 0-29.2 0v130c0 5.5-2.5 7.9-7.9 7.9h-7.8a14.6 14.6 0 0 0 0 29.2h1.3v34.8l-1.3-.1c-8.1 0-14.6 6.5-14.6 14.6 0 9.9-9.1 19-19 19a19 19 0 0 1-13.2-5.8 19 19 0 0 1-5.8-13.2V400c0-8-6.5-14.6-14.6-14.6h-44.8c-8 0-14.6 6.5-14.6 14.6v63.8c0 9.9-9.1 19-19 19s-19-9.1-19-19V400c0-8-6.5-14.6-14.6-14.6h-7.8c-5.4 0-7.9-2.4-7.9-7.9V197.3h225.1c8 0 14.6-6.5 14.6-14.6v-25.9c0-41.3-18.8-78.4-48.3-103.1L371 24.8a14.5 14.5 0 1 0-20.6-20.6l-33 33a134.3 134.3 0 0 0-122.6 0l-33-33a14.5 14.5 0 1 0-20.6 20.6l28.9 28.9a134.1 134.1 0 0 0-48.3 103.1v116.9H113v-66.9a39.8 39.8 0 0 0-79.6 0v126.9a39.8 39.8 0 0 0 79.6 0v-58.8h8.8v102.8a35.4 35.4 0 0 0 30.3 36.4v49.8c0 26.1 22 48.1 48.1 48.1s48.1-22 48.1-48.1v-49.3H264v49.3c0 12.4 5.2 24.7 14.3 33.8a48.3 48.3 0 0 0 33.8 14.3c26.1 0 48.1-22 48.1-48.1 0-7.1-5.1-13.1-11.9-14.3v-35h5.1a36 36 0 0 0 37.1-37V274.9h8.5v58.8a39.8 39.8 0 0 0 79.6 0V206.8a39.9 39.9 0 0 0-39.8-39.8zm-288.1-10.1c0-43.3 26.3-80.7 63.9-96.8v40.3c-6.6.3-11.8 5.7-11.8 12.4 0 6.8 5.6 12.4 12.4 12.4s12.4-5.6 12.4-12.4c0-6.6-5.2-12-11.8-12.4V59.6a105.6 105.6 0 0 1 80.4 0v40.9c-6.6.3-11.8 5.7-11.8 12.4 0 6.8 5.6 12.4 12.4 12.4s12.4-5.6 12.4-12.4c0-6.6-5.2-12-11.8-12.4V60.1a105.5 105.5 0 0 1 63.9 96.8v11.3H150.7v-11.3zM84 333.7c0 5.9-4.9 10.7-10.8 10.7s-10.7-4.8-10.7-10.7V206.8a10.7 10.7 0 0 1 21.5 0v126.9zm365.5 0a10.7 10.7 0 0 1-21.4 0V206.8a10.7 10.7 0 0 1 21.4 0v126.9z" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" class="icons" xml:space="preserve" viewBox="0 0 512 512">
<path fill="none" stroke="#507c5c" stroke-miterlimit="10" stroke-width="2" d="M455.1 318.1c-14.2-53.1-65.5-78.3-75.3-82.7l-3-4.1a147.3 147.3 0 1 0-241.6.1l-3 4.1c-9.8 4.4-61.1 29.5-75.3 82.7-8.1 30.2-7.8 42-7.7 44.1a14 14 0 0 0 9.3 12.3l52.9 18.4a168.3 168.3 0 0 0 22.2 41.1 66 66 0 0 0-40.5 60.8v3.5c0 7.7 6.2 13.9 13.9 13.9h104c7.7 0 13.9-6.2 13.9-13.9v-4.7a150.2 150.2 0 0 0 31.3 3.4l1.8-.1c10.9-.1 21.6-1.4 32.1-3.9v5.3c0 7.7 6.2 13.9 13.9 13.9h104c7.7 0 13.9-6.2 13.9-13.9v-3.5a66 66 0 0 0-122.5-33.6 119.7 119.7 0 0 1-43.1 7.9l-3.7-.1c-37.3-3.6-72.9-61-72.9-119.5 0-45 22.7-76.3 59.9-83.6l5.9 7.3a14 14 0 0 0 21.6 0l5.9-7.3c37.1 7.2 59.9 38.6 59.9 83.6a13.9 13.9 0 1 0 27.8 0c0-53-26.2-92.8-68.5-107.1l28.6-35.3c3.1-3.8 4-8.5 2.4-13-.2-.8-1.6-5.6-4.8-21.1l-.1-.6a13.8 13.8 0 0 0-14.7-10.9l-2.2.1-2.7-.1a26.9 26.9 0 0 1-24.1-26.7 27 27 0 0 1 26.9-26.9 27 27 0 0 1 26.9 26.9 13.9 13.9 0 1 0 27.8 0 54.7 54.7 0 0 0-99.7-30.8 54.7 54.7 0 0 0-100.2 30.5 13.9 13.9 0 1 0 27.8 0 27 27 0 0 1 26.9-26.9 26.8 26.8 0 0 1 2.8 53.6l-2.7.1-2.2-.1c-7-.6-13.3 4.2-14.7 11l-.1.5a263.5 263.5 0 0 1-4.8 21.1c-1.6 4.6-.6 9.3 2.4 13l28.6 35.3c-42.3 14.3-68.5 54.1-68.5 107.1 0 27.3 6.9 55.8 18.8 80.4l-4.8-.7c-20.6-22-33.5-51-36.5-81.7l-.1-1.6-.2-3.1-.2-3.2-.1-1.4-.1-4.4.1-5.9.1-1.8.3-4.2.2-1.9.5-4.6.2-1.3.9-5.8.2-.9 1-4.9.4-1.6 1-4.1.4-1.6 1.4-4.8.2-.8 1.9-5.4.6-1.7 1.4-3.6.9-2.1 1.5-3.2 1-2.1 1.9-3.7 1.5-2.7 1.9-3.2 1.4-2.2a133 133 0 0 1 14-18.8 14 14 0 0 0 .4-18 119.6 119.6 0 0 1 92.4-195.3 119.6 119.6 0 0 1 92.4 195.3 13.8 13.8 0 0 0 .4 18 135 135 0 0 1 14 18.8l1.4 2.2 1.9 3.2 1.5 2.7 1.9 3.7 1 2.1 1.5 3.2.9 2.1 1.4 3.6.6 1.7 1.9 5.4.2.8 1.4 4.8.4 1.6 1 4.1.4 1.6 1 4.9.2.9.9 5.8.2 1.3.5 4.6.2 1.9.3 4.2.1 1.8.1 5.9c0 13.5-1.9 26.8-5.5 39.6-.5 1.9-.7 3.8-.4 5.8l.6 4c.6 4.1 3 7.7 6.5 9.9a13.8 13.8 0 0 0 11.7 1.2l57.1-19.8a14 14 0 0 0 9.3-12.3c-.3-1.9-.1-13.7-8.2-43.9zm-99.4 138.4a38.2 38.2 0 0 1 36.7 27.7H319a38.3 38.3 0 0 1 36.7-27.7zM218.9 188.6h.2l1.8-.3 1-.2 2.2-.5.5-.1 2.7-.8.9-.3 1.7-.6 1-.4 1.5-.6 1.1-.5 1.4-.7 1.1-.6 1.3-.7 1.1-.6 1.3-.8 1.1-.7 1.2-.8 1-.7 1.2-.9 1-.8 1.1-.9 1-.8 1.1-1 .9-.9 1-1 .9-.9 1-1.1.8-.9 1-1.2.7-.9.9-1.3.5-.8.5.8.9 1.3.7.9 1 1.2.8.9 1 1.1.9.9 1 1 .9.9 1.1 1 1 .8 1.1.9 1 .8 1.2.9 1 .7 1.2.8 1.1.7 1.3.8 1.1.6 1.3.7 1.1.6 1.4.7 1.1.5 1.5.6 1 .4 1.7.6.9.3 2.7.8.5.1 2.2.5 1 .2 1.8.3h.2l1.4 6.3-38.2 47.1-.3.4-38.6-47.5 1.3-6.3zM102.8 360.5l-25-8.7a261 261 0 0 1 5.9-26.6 88.3 88.3 0 0 1 24-39.6v.1l-.2.7-1.5 5.6-.4 1.9-1 4.5-.4 2.2-.8 4.2-.4 2.4-.6 4.1-.3 2.5-.4 4.2-.2 2.4-.3 4.5-.1 2.1-.1 6.6a116.1 116.1 0 0 0 .2 7.5l.3 5.2.2 2.6.2 2.5c.1 3.2.5 6.2.9 9.1zm19.5 123.8a38.2 38.2 0 0 1 36.7-27.7h1.1c1.5 0 3 .2 4.4.4h.4l2.2.4.5.1 2.2.6.5.1 2.2.8.3.1 2.2 1 .2.1c3 1.4 5.8 3.2 8.3 5.4l.6.5 1.1 1.1 1 1 .9 1 1.1 1.2.7.9 1.1 1.4.6.9 1 1.5.6 1 .8 1.6.5 1.1c.8 1.8 1.5 3.6 2 5.5h-73.2zm286.9-123.8a171 171 0 0 0 2.1-26.8l-.1-6.6-.1-2.1-.3-4.5-.2-2.4-.4-4.2-.3-2.5-.6-4.1-.4-2.5-.8-4.1-.5-2.3-1-4.3-.5-2-1.4-5.1-.3-1.2-.1-.2a88.4 88.4 0 0 1 24 39.7 261 261 0 0 1 5.9 26.6l-25 8.6z" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 512 512" class="icons">
<path fill="none" stroke="#507c5c" stroke-miterlimit="10" d="M431.7 366.9a78 78 0 0 1-29.3-24.6 76.2 76.2 0 0 1-13.5-57.4 79.3 79.3 0 0 1 33-51.6c2.2-1.6 9.1-6.5 10.2-15.3 1.1-8.7-4.2-15-5.9-17.1-23.7-28.4-55.7-42.6-95-42.1-21.6.2-40.1 8-58 15.5-10.4 4.4-18.4 4.6-26.9.6l-4.1-1.8 5.5-22.4a15.4 15.4 0 0 0 18.3-15.2c0-46.4 11.4-67.6 48.5-90.7 6.6-4 13.7-7.4 21.4-10-2.6 19.5-6.7 35.5-15.4 48.4a15.6 15.6 0 0 0 4.3 21.5 15.6 15.6 0 0 0 21.5-4.3c14.8-22 19.3-48.9 21.9-74.5l.2-1 .5-3.6c.4-6.1-2.2-12-7-16.2a20.2 20.2 0 0 0-17-4.7 143 143 0 0 0-46.7 18.1c-46.6 29-63.2 59.6-63.2 117 0 7.3 5 13.4 11.8 15h-.1l-5.1 22.4-5.7-2.2-4.3-1.7a108.1 108.1 0 0 0-40-9.2h-1.8a116 116 0 0 0-92.7 47.3c-19 24.6-28.4 54.4-29.3 93.5v.6A273 273 0 0 0 88 399.6a271 271 0 0 0 59 90.9 66.3 66.3 0 0 0 74 16.5c4.3-1.6 8.5-3.3 12.5-5l3.1-1.3a69.3 69.3 0 0 1 37.7-5.4c7.4 1.1 14.8 4.2 22.6 7.4l6.1 2.5a82.5 82.5 0 0 0 30.6 6.3c19.2 0 36.4-7.8 51.1-23.3a268.9 268.9 0 0 0 58-94.9c4-11.2-.1-21.1-11-26.4zm-69.4 99.7a38.9 38.9 0 0 1-28.7 13.7c-5.8 0-12.3-1.4-19.1-4.1l-5.7-2.3c-9.2-3.8-18.7-7.7-29.9-9.4a103.2 103.2 0 0 0-54.2 7.4l-3.1 1.3-11.6 4.7a42 42 0 0 1-14.9 3 36 36 0 0 1-26-12.3 239.4 239.4 0 0 1-52.3-80.6 240.9 240.9 0 0 1-18-87c.8-32 8-55.9 22.7-75.3a85.5 85.5 0 0 1 69-35.3c9.8-.3 20 3.2 29.6 7l4.9 1.9c2.9 1.1 5.7 2.1 8.2 3.3a59 59 0 0 0 25.2 5.7 69 69 0 0 0 26.8-5.8c15.8-6.6 30.8-12.9 46.4-13.1h1.7c25.8 0 46.5 7.9 63 24.2a109.5 109.5 0 0 0-37.9 65.8 108 108 0 0 0 52.2 111 237.2 237.2 0 0 1-48.3 76.2z" />
</svg>
</div>
<div id="main">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 300 350" width="100%" height="100%" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="0.5">
<g class="introAnimDevice">
<path class="adShape1" fill="rgba(255,255,255,0.4)" stroke="none" d="M104,122H74v-7h30V122z" />
<path class="adShape2" fill="none" stroke="none" d="M125,95H53V77h72V95z" />
<path class="adShape3" fill="rgba(255,255,255,0.6)" stroke="none" d="M144,137.32h-27.33V114H144V137.32z" />
<path class="adShape4" fill="none" stroke="none" d="M144,105.67H36V91h108V105.67z" />
<path class="adShape5" fill="none" stroke="none" d="M160.33,141.67H133V88h27.33V141.67z" />
<path class="adShape6" fill="none" stroke="none" d="M160.33,75.67H19V61h141.33V75.67z" />
<path class="adShape7" fill="none" stroke="none" d="M141,182H39V28h102V182z" />
<path class="adShape8" fill="none" stroke="none" d="M141,26H39V11h102V26z" />
<path class="phone phone1" d="M75,86h28c2.76,0,5,2.24,5,5v60c0,2.76-2.24,5-5,5H75 c-2.76,0-5-2.24-5-5V91C70,88.24,72.24,86,75,86z" />
<path class="phone phone2" d="M72.71,94.2h32.57v53.59H72.71V94.2z" />
<path class="phone phone3" d="M87.2,149.44h3.6c1.1,0,2,0.9,2,2v0.37c0,1.1-0.9,2-2,2h-3.6 c-1.1,0-2-0.9-2-2v-0.37C85.2,150.34,86.1,149.44,87.2,149.44z" />
<path class="phone phone4" d="M86.2,88.73h5.6c0.55,0,1,0.31,1,0.69l0,0c0,0.38-0.45,0.69-1,0.69 h-5.6c-0.55,0-1-0.31-1-0.69l0,0C85.2,89.04,85.65,88.73,86.2,88.73z" />
<path class="phone phone5" d="M75.69,87.09L75.69,87.09c0.75,0,1.35,0.61,1.35,1.37l0,0 c0,0.75-0.61,1.36-1.35,1.36l0,0c-0.75,0-1.35-0.61-1.35-1.36l0,0C74.34,87.7,74.95,87.09,75.69,87.09z" />
<path class="phone phone6" d="M78.96,87.64L78.96,87.64c0.45,0,0.81,0.37,0.81,0.82l0,0 c0,0.45-0.36,0.82-0.81,0.82l0,0c-0.45,0-0.81-0.37-0.81-0.82l0,0C78.14,88.01,78.5,87.64,78.96,87.64z" />
<path class="tablet tablet1" d="M51,64h75.63c2.76,0,5,2.24,5,5v102.99c0,2.76-2.24,5-5,5H51c-2.76,0-5-2.24-5-5V69C46,66.24,48.24,64,51,64z" />
<path class="tablet tablet2" d="M50.41,73.71h76.8v93.57h-76.8V73.71z" />
<path class="tablet tablet3" d="M88.61,169.05h1.3c1.1,0,2,0.9,2,2v1.3c0,1.1-0.9,2-2,2h-1.3c-1.1,0-2-0.9-2-2v-1.3 C86.61,169.95,87.51,169.05,88.61,169.05z" />
<path class="tablet tablet4" d="M89.37,67.53h0.21c0.55,0,1,0.45,1,1v0.21c0,0.55-0.45,1-1,1h-0.21c-0.55,0-1-0.45-1-1v-0.21 C88.37,67.98,88.82,67.53,89.37,67.53z" />
<path class="tablet tablet5" d="M53.06,65.32L53.06,65.32L53.06,65.32L53.06,65.32z" />
<path class="tablet tablet6" d="M59.24,66.21L59.24,66.21L59.24,66.21L59.24,66.21z" />
<path class="laptop laptop1" d="M20.4,75h138.65c0.55,0,1,0.45,1,1v94h-1H20.4h-1V76C19.4,75.45,19.85,75,20.4,75z" />
<path class="laptop laptop2" d="M23.21,78.8h133.04v84.89H23.21V78.8z" />
<path class="laptop laptop3" d="M89.09,170.03L89.09,170.03L89.09,170.03L89.09,170.03z" />
<path class="laptop laptop4" d="M90,75.7L90,75.7c0.55,0,1,0.45,1,1l0,0c0,0.55-0.45,1-1,1l0,0c-0.55,0-1-0.45-1-1l0,0C89,76.15,89.45,75.7,90,75.7z" />
<path class="laptop laptop5" d="M165.12,178.11c-5.53,0-148.92,0-152.96,0 S8,172.56,8,172.56h64.62l2.53,2.53h27.88l2.53-2.53h64.62C170.19,172.56,170.64,178.11,165.12,178.11z" />
<path class="laptop laptop6" d="" />
<path class="desktop desktop1" d="M2,50h173.62c1.1,0,2,0.9,2,2v101.46c0,1.1-0.9,2-2,2H2c-1.1,0-2-0.9-2-2V52C0,50.9,0.9,50,2,50z" />
<path class="desktop desktop2" d="M4.16,54.16h169.29v92.97H4.16V54.16z" />
<path class="desktop desktop3" d="M90.2,50.69L90.2,50.69c0.77,0,1.39,0.62,1.39,1.39l0,0c0,0.77-0.62,1.39-1.39,1.39l0,0c-0.77,0-1.39-0.62-1.39-1.39l0,0 C88.81,51.31,89.43,50.69,90.2,50.69z" />
<path class="desktop desktop4" d="M109.12,178.11c-5.53,0-39.08,0-43.12,0s0.92-3.26,3.67-9.78 C72.33,162,72.62,155,72.62,155h2.53h25.88h2.53c0,0,1.1,10.04,3.31,14.12C110.42,175.67,114.64,178.11,109.12,178.11z" />
<path class="ooh ooh1" d="M152.9,193.77H27V0h125.9V193.77z" />
<path class="ooh ooh2" d="M143.43,184.47H36.47V7.75h106.96V184.47z" />
<path class="ooh ooh3" d="M129,229H53l-0.23-2.97L50.15,194h2.53h76.88h2.53l-2.84,33.18 L129,229z" />
</g>
</svg>
</div>
</section>
<section>
<h1>section 3</h1>
</section>
<section>
<h1>section 4</h1>
</section>
</div>
#main {
width: 100%;
height: 400px;
}
section {
min-height: 400px;
}
#main {
background: radial-gradient(#222 10%, #000 90%);
position: relative;
}
.icons {
height: 50px;
}
gsap.set(".introAnimDevice", { x: 65, y: 65 });
gsap.set(".tablet, .laptop, .desktop, .ooh", { opacity: 0 });
// const tl = gsap.timeline({ repeat: -1, repeatDelay: 1, yoyo: true });
// tl.to(".typed span", {
// duration: 4,
// text: " is so much fun you should try it some time!"
// });
let tl2 = gsap
.timeline({
defaults: { duration: 0.67, ease: "expo.inOut" },
scrollTrigger: {
trigger: "#animation",
start: "top top",
end: "+=1000",
scrub: 0.5,
pin: "#animation"
}
})
.fromTo(
".icons path",
{
drawSVG: 0,
strokeWidth: "4px"
},
{
drawSVG: "100%"
// fill: "black"
}
)
.to(".typed span", {
duration: 4,
text: "is so much fun you should try it some time!"
})
.add("tablet", 0.1)
.to(".phone", { morphSVG: (i) => ".tablet" + (i + 1) }, "tablet")
.to(".phone5, .phone6", { opacity: 0, morphSVG: ".tablet5" }, "tablet")
.to(".adShape1", { morphSVG: ".adShape2" }, "tablet")
.add("laptop", 1.5)
.to(".phone", { morphSVG: (i) => ".laptop" + (i + 1) }, "laptop")
.to(".phone3", { opacity: 0, y: -4 }, "laptop")
.fromTo(
".laptop5",
{ scale: 0, transformOrigin: "50% 50%" },
{ scale: 1, opacity: 1 },
"laptop"
)
.to(".adShape1", { morphSVG: ".adShape4" }, "laptop")
.from(".adShape3", { scale: 0, opacity: 0 }, "laptop")
.add("desktop", 3)
.to(".phone1", { morphSVG: ".desktop1" }, "desktop")
.to(".phone2", { morphSVG: ".desktop2" }, "desktop")
.to(".phone4", { morphSVG: ".desktop3" }, "desktop")
.to(
".laptop5",
{ morphSVG: { shape: ".desktop4", shapeIndex: 0 }, y: 0.5 },
"desktop"
)
.to(".adShape1", { morphSVG: ".adShape6" }, "desktop")
.to(".adShape3", { morphSVG: ".adShape5" }, "desktop")
.add("ooh", 4.5)
.to(".phone1", { morphSVG: ".ooh1" }, "ooh")
.to(".phone2", { morphSVG: ".ooh2" }, "ooh")
.to(".phone4", { scale: 0, y: -48 }, "ooh")
.to(".laptop5", { morphSVG: ".ooh3", y: 0 }, "ooh")
.to(".adShape1", { morphSVG: ".adShape8" }, "ooh")
.to(".adShape3", { morphSVG: ".adShape7", ease: "back.inOut(0.6)" }, "ooh")
.add("end");
Also see: Tab Triggers