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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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 class="container">
<svg viewBox="0 0 446 540" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" class="illustration">
<defs>
<path id="wave-segment" d="M78.238,447.196C99.161,447.224 102.365,433.986 117.183,433.986C132.006,433.986 138.546,447.165 154.302,447.165C170.057,447.165 179.54,433.877 192.035,433.877C204.53,433.877 212.069,447.271 228.234,447.2L228.238,447.2L228.238,456.742L174.344,456.758L78.238,456.773L78.238,447.196Z" style="fill:rgb(186,228,240);" />
<path id="fish-path" d="M13.805,497.326C13.805,497.384 14.676,454.6 14.676,454.6C15.117,447.421 27.398,371.652 61.333,371.652C95.268,371.652 105.059,451.758 105.059,454.992C105.059,458.227 106.846,496.252 106.846,496.252" />
</defs>
<g id="scene">
<mask id="fish-mask">
<rect x="0" y="291" width="230" height="122" style="fill:white;" />
</mask>
<mask id="leaves">
<path id="leaf3" d="M240.331,175.61C249.784,176.339 250.158,149.143 251.971,143.795C253.784,138.446 265.447,112.749 300.347,88.992C309.312,82.889 273.249,84.744 262.701,95.4C262.408,95.697 299.949,59.14 306.273,31.167C307.299,26.628 249.717,36.275 232.63,81.142C222.01,109.028 230.879,174.881 240.331,175.61Z" style="fill:white;" />
<path id="leaf4" d="M235.235,178.598C230.936,186.776 266.297,154.023 318.903,172.056C323.277,173.556 316.664,157.916 303.38,150.707C300.853,149.335 357.48,165.86 365.744,172.947C369.234,175.941 366.977,149.035 343.343,139.012C342.972,138.854 395.083,146.153 405.989,149.98C402.419,131.963 371.178,102.148 331.289,103.467C302.148,104.431 250.238,129.248 235.235,178.598Z" style="fill:white;" />
<path id="leaf5" d="M225.34,183.401C242.089,183.539 293.669,185.304 293.267,235.202C301.036,226.747 302.632,218.437 301.053,208.836C307.555,214.258 316.799,229.731 326.228,250.463C335.015,247.135 333.311,224.064 332.455,221.081C331.599,218.098 353.49,248.751 367.144,253.999C374.306,246.977 367.541,201.115 334.573,182.932C301.604,164.749 252.16,164.232 222.521,178.152C219.051,180.584 208.59,183.263 225.34,183.401Z" style="fill:white;" />
<path id="leaf2" d="M258.286,187.293C240.185,184.835 213.891,161.373 191.899,150.057C181.762,144.841 155.131,147.377 152.51,147.063C149.889,146.749 160.892,131.003 174.394,130.585C148.357,121.905 126.027,133.793 123.824,131.978C121.622,130.162 125.177,116.202 149.97,106.951C148.994,105.186 114.646,110.911 94.891,95.692C89.271,91.895 124.581,66.427 144.554,68.645C164.527,70.862 192.389,70.409 230.889,143.333C236.093,156.138 252.386,169.599 252.386,169.599C259.636,174.413 265.589,189.696 258.286,187.293Z" style="fill:white;" />
<path id="leaf1" d="M258.286,187.293C240.185,184.835 210.105,169.378 185.032,211.545C181.648,215.311 177.193,210.024 179.458,194.986C169.272,211.871 150.363,232.47 145.605,231.801C140.847,231.132 144.651,202.538 148.831,194.882C141.881,190.227 118.57,237.947 114.874,238.097C104.523,239.756 100.911,141.41 191.899,150.057C234.088,154.067 252.386,169.599 252.386,169.599C259.636,174.413 265.589,189.696 258.286,187.293Z" style="fill:white;" />
</mask>
<mask id="water-mask">
<path id="water-mask" d="M357.315,457.852C357.437,447.646 336.649,432.68 329.793,430.146C322.936,427.612 314.374,428.513 238.56,428.513C162.746,428.513 145.106,431.336 137.885,433.152C120.949,437.411 109.195,447.259 109.195,458.368C109.195,465.163 130.018,472.394 230.463,472.394C330.908,472.394 357.193,468.059 357.315,457.852Z" style="fill:white;" />
</mask>
<ellipse id="water-circle1" cx="232.22" cy="476.77" rx="98.92" ry="27.85" fill="#12b2da" />
<ellipse id="water-circle2" cx="258.15" cy="505.32" rx="73.8" ry="18.22" fill="#12b2da" />
<g mask="url(#fish-mask)">
<path mask="url(#fish-mask)" id="fish" d="M50.84 379.73a.82.82 0 001.19 1.08c4.62-3.66 8.38-6.75 12.4-6.27 4.93.6 7.64 4.13 11.17 7.58 3.54 3.46 12.51 5.33 15.32 1.09 2.81-4.25.94-12.5-3.43-15.8-4.1-3.11-15.71-5.28-23.96-.09a40.6 40.6 0 00-12.7 12.41z" fill="#0793b8" />
</g>
<g id="tri-wave2" fill="#2ec3ec">
<path d="M32.73 413.4a1.27 1.27 0 012.05.01l21.54 29.41a1.27 1.27 0 01-1.02 2.02H12.03a1.27 1.27 0 01-1.02-2.02l21.72-29.41z" />
<path d="M76.46 413.4a1.27 1.27 0 012.04.01l21.55 29.41a1.27 1.27 0 01-1.02 2.02H55.76a1.27 1.27 0 01-1.02-2.02l21.72-29.41z" />
<path d="M120.35 413.4a1.27 1.27 0 012.04.01l21.55 29.41a1.27 1.27 0 01-1.03 2.02H99.66a1.27 1.27 0 01-1.02-2.02l21.72-29.41z" />
</g>
<g id="whole-island">
<g id="tree">
<g id="trunk">
<path d="M213.22 300.79c5.11-16.37 25.14-63.35 19.41-78.67-2.73-6.27-5.74 4.48-7.08 6.09-1.33 1.61-9.85-17.34-13.5-17.37-3.66-.02-2.22 4.79-6.04 3.71-3.82-1.07-11.66-5.68-6.03-12.13 3.44-4.26-.36-7.98-7.01-8.9-6.66-.9 3.72-18.2 10.99-20.22 7.26-2 48.02-11.76 69.87 9.27 13.25 12.6 10.28 12.74 6.7 13.47-3.58.72-8.31-1.49-9.12.87-.81 2.36-.34 7.25-4.09 10.01s-13.19 6.65-12.11 8.26c1.08 1.6 15.9 56.5 2.36 89.27-18.8-.05-47.45 1.59-44.35-3.66z" fill="#e5b13b" />
<path d="M255.2 215.18c.68 1-3.42-2-9.85-1.73-3.92.16-11.38 3.5-12.72 8.68-2.73-6.28-5.74 4.47-7.08 6.08-1.33 1.61-9.85-17.34-13.5-17.37-3.66-.02-7.84-13.08-14.36-16.05-4.95-2.25 16.2-13.42 28.46-12.84 7.91.37 33.58 2.68 42.53 8.4 4.54 2.9 3.46 5.03 1.77 12.55-1.34 5.94-16.32 10.67-15.24 12.28zM261.06 242.04c.85 5.74 1.55 12.04 1.92 18.54l-4.57 4.63-4.45-10.34-9.79 11.7-6.07-9.77-6.5 10.4-5.44-3.51c1.88-5.83 3.61-11.7 4.93-17.21l6.36-6.74 7.26 6.83 9.3-8.82 7.05 4.3z" fill="#f2e390" />
<path d="M224.3 199.7c9.25-4.05 13.24 13.88 4.94 17.24-8.3 3.36-12.8-13.8-4.93-17.25zM247.78 186.94c5.3-8.59 18.79 3.88 13.88 11.37-4.91 7.5-18.4-4.05-13.88-11.37z" fill="#e5b13b" />
</g>
<g id="leaf-bg" mask="url(#leaves)">
<path fill="#ABD25E" d="M52.91 2.99h386.67V280.6H52.91z" />
<ellipse cx="236.41" cy="137.75" rx="125.06" ry="80.87" fill="#8cc751" />
</g>
</g>
<g id="island">
<path id="island-dirt" d="M344.8 381.58c-3.22-6.65-224.38-19.67-224.1 12.27v9.44c0 23 7.75 44.2 20.79 61.13 2.87 4.2 177.12 3.56 182.8.64a99.87 99.87 0 0021.3-61.77c0-18.04.38-19.29-.78-21.7z" fill="#fed09d" />
<path id="island-dirt1" d="M283.82 374.64c33.92 1.72 59.9 4.7 60.99 6.94 1.16 2.42.77 3.67.77 21.71a99.87 99.87 0 01-21.28 61.77c-1.62.83-16.96 1.48-38.1 1.88a340.61 340.61 0 002.05-37.63 333.1 333.1 0 00-4.43-54.67z" fill="#fbb381" fill-opacity=".97" />
<path d="M258.9 393.96s-5.6 48.68-12 63.21c-6.39 14.53.83-57.2-7.37-76.36-8.21-19.16 19.36 13.15 19.36 13.15zM132.09 380.06s7.16 63.86 33.56 86.93c7.92.12 16.42.15 16.42.15s-29.56-66.88-25.57-83.3c-9.14-3.15-24.41-3.78-24.41-3.78z" fill="#fbb381" />
<path id="Grass" d="M207.31 296.89c1.53-5.52 4.13-14.63 5.08-15.86 1.37-1.8 11.24 11.8 13 12.45 1.77.66 10.36-9.54 12.57-10.46 2.2-.92 13.4 10.9 15 11.69 1.6.79 15.09-13.1 16.87-12.77 1.2.22 1.9 10.6 2.47 17.92 60.25 15.2 73 64.26 73.43 88.25-3.87-.2-8.18 8.96-12.77 10.35-4.6 1.39-16.02-4.5-20.17-3.32-4.16 1.19-14.83 10.42-19.82 10.7-4.99.28-11.34-6.23-16-5.48-4.67.74-12.37 8.56-18.45 8.5-6.08-.08-9.08-6.6-15.72-6.59-6.65.03-16.76 8.65-20.3 9-3.54.37-12.63-10.06-17.24-9.74-4.62.32-13.67 8.36-18.57 8.2-4.91-.16-12.44-9.97-16.59-9.58-4.14.4-15.47 7.5-19.98 5.96-4.5-1.55-7.6-10.46-14.42-11.45-6.78-1-8.81 1.85-15.6 1.53.9-30.06 12.28-88.8 87.21-99.3z" fill="#8cc751" />
<g id="grass-shapes">
<path d="M187.54 351.45a1.26 1.26 0 011.9-.61l23.64 15.98a1.26 1.26 0 01-.31 2.24c-6.9 2.24-26.46 8.6-33.37 10.86a1.26 1.26 0 01-1.57-1.63l9.71-26.84zM246.08 320.07a1.26 1.26 0 011.97.2l15.04 24.27a1.26 1.26 0 01-1.2 1.91l-34.9-3.75a1.26 1.26 0 01-.76-2.12l19.85-20.51zM278.82 342.07c.04-.37.25-.72.58-.93.32-.22.72-.27 1.08-.15l26.67 8.65c.45.15.77.54.82 1 .06.47-.16.93-.57 1.2l-29.33 19.25c-.4.27-.91.28-1.32.05a1.2 1.2 0 01-.6-1.15l2.68-27.92z" fill="#bbd86a" />
<path d="M295.38 308.3A90 90 0 01323.55 330l-43.68-5.05a1.63 1.63 0 01-1.32-.92c-.21-.49-.08-1.03.33-1.39l16.5-14.33z" fill="#78bb4d" />
<path d="M164.06 311.45l6.7 5.53c.43.34.57.88.37 1.38-.2.5-.7.86-1.3.95l-19.9 2.83a85.74 85.74 0 0114.13-10.7z" fill="#bbd86a" />
<path id="Grass1" d="M134.1 342.3l26.84-.64c.51-.02.99.2 1.22.55.23.35.19.77-.12 1.09l-18.3 18.9c-.24.25-.63.4-1.04.42-.42 0-.81-.13-1.07-.38l-11.92-11.2a94.53 94.53 0 014.4-8.75z" fill="#78bb4d" />
<path d="M198.96 298.3l2.04 9.27c.09.39-.06.79-.37 1.03s-.74.29-1.1.11l-14.2-6.87c4.26-1.38 8.8-2.56 13.63-3.53z" fill="#bbd86a" />
<path d="M331.63 375.4a.9.9 0 01-.56.38.9.9 0 01-.67-.1l-13.5-8.62a.54.54 0 01-.23-.64.84.84 0 01.62-.52l21.78-5.07c.3-.07.6 0 .79.19.18.18.2.44.06.67l-8.29 13.7zM208.4 334.54a.81.81 0 01-.69.12.81.81 0 01-.54-.44c-1.36-2.99-6.69-13.48-8.36-17.14a.74.74 0 01.12-.8.8.8 0 01.8-.24l21.68 5.65c.3.08.52.31.59.6a.74.74 0 01-.3.76c-3.23 2.38-10.65 9.55-13.3 11.49z" fill="#78bb4d" />
</g>
</g>
</g>
<path id="front-water" d="M357.31 457.85c-.49-8.02-19.23-9.86-34.35-8.83-7.3.5-11.12 5.67-86.93 5.67-75.82 0-101.03-6.83-109.88-6.76-7.44.06-16.96 3.64-16.96 10.44 0 6.8 20.83 14.02 121.27 14.02 100.45 0 127.48-4.35 126.85-14.54z" fill="#bae4f0" />
<g id="tri-wave1" fill="#2ec3ec">
<path d="M366.29 502.93a1.27 1.27 0 012.04 0l21.55 29.42a1.27 1.27 0 01-1.03 2.02h-43.27a1.27 1.27 0 01-1.01-2.02l21.72-29.42z" />
<path d="M322.56 502.93a1.27 1.27 0 012.04 0l21.55 29.42a1.27 1.27 0 01-1.02 2.02h-43.27a1.27 1.27 0 01-1.02-2.02l21.72-29.42zM410.18 502.93a1.27 1.27 0 012.04 0l21.54 29.42a1.27 1.27 0 01-1.02 2.02h-43.27a1.27 1.27 0 01-1.02-2.02l21.73-29.42z" />
</g>
<g mask="url(#water-mask)" id="sine-wave-group">
<use href="#wave-segment" id="wave-segment-0" x="-150" />
<use href="#wave-segment" id="wave-segment-1" />
<use href="#wave-segment" id="wave-segment-2" x="150" />
<use href="#wave-segment" id="wave-segment-3" x="3000" />
</g>
</g>
</svg>
</div>
* {
box-sizing: border-box;
}
body {
background: black;
cursor: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1385231/hand-cursor.png"),
pointer;
}
.container {
height: 99vh;
width: 100vw;
display: flex;
align-items: flex-end;
justify-content: flex-end;
padding-right: 1rem;
}
.illustration {
max-height: 99vh;
max-width: 100vw;
width: 100%;
max-height: 240px;
max-width: 220px;
}
// Whole Island
gsap.to("#whole-island", {
transformOrigin: "bottom center",
y: -15,
rotation: 1,
duration: 1,
ease: "sine.inOut",
yoyo: true,
repeat: -1
});
// Tree
gsap.fromTo(
"#tree",
{ transformOrigin: "bottom center", rotation: -6 },
{
transformOrigin: "bottom center",
rotation: 5,
duration: 2,
ease: "sine.inOut",
yoyo: true,
repeat: -1
}
);
// Leaves
gsap.to("#leaf1", {
transformOrigin: "center right",
y: -3,
duration: 1,
ease: "sine.inOut",
yoyo: true,
repeat: -1
});
gsap.fromTo(
"#leaf2",
{ transformOrigin: "bottom right", rotation: 3 },
{
transformOrigin: "bottom right",
rotation: -4,
x: -3,
y: -3,
duration: 1,
ease: "sine.inOut",
yoyo: true,
repeat: -1
}
);
gsap.to("#leaf3", {
transformOrigin: "bottom center",
rotation: -6,
duration: 1,
ease: "sine.inOut",
yoyo: true,
repeat: -1
});
gsap.to("#leaf4", {
transformOrigin: "bottom left",
rotation: -6,
y: -3,
duration: 1,
ease: "sine.inOut",
yoyo: true,
repeat: -1
});
gsap.to("#leaf5", {
transformOrigin: "top left",
y: -3,
duration: 1,
ease: "sine.inOut",
yoyo: true,
repeat: -1
});
// Water Circles
gsap.to("#water-circle1", {
transformOrigin: "center center",
scaleX: 1.2,
duration: 1,
ease: "sine.inOut",
yoyo: true,
repeat: -1
});
gsap.to("#water-circle2", {
transformOrigin: "center center",
scaleX: 0.8,
duration: 1,
ease: "sine.inOut",
yoyo: true,
repeat: -1,
delay: -0.5
});
// Triangle Waves
// Front Wave
gsap.fromTo(
"#tri-wave1",
{ x: -60 },
{ x: 20, duration: 6, repeat: -1, ease: "none" }
);
// Back Wave
gsap.fromTo(
"#tri-wave2",
{ x: -10 },
{ x: 50, duration: 6, repeat: -1, ease: "none" }
);
gsap.fromTo(
"#tri-wave1>path, #tri-wave2>path",
{ scaleY: 0 },
{
scaleY: 1,
duration: 1,
repeat: -1,
yoyo: true,
transformOrigin: "bottom center"
}
);
//Sine Wa
gsap.fromTo(
"#sine-wave-group *",
{ x: 0 },
{ x: 75, repeat: -1, duration: 2, ease: "none" }
);
gsap.fromTo(
"#sine-wave-group *",
{ scaleY: 0.8, transformOrigin: "bottom center" },
{
scaleY: 1.2,
transformOrigin: "bottom center",
repeat: -1,
duration: 1,
yoyo: true,
ease: "sine.inOut"
}
);
// Fish
gsap.registerPlugin(MotionPathPlugin);
gsap.set("#fish-path", {
scaleY: 1.3,
scaleX: 1.3,
transformOrigin: "bottom left"
});
gsap.to("#fish", {
duration: 3,
repeat: -1,
repeatDelay: 4,
ease: "slow(0.3, 0.7, false)",
immediateRender: true,
motionPath: {
path: "#fish-path",
align: "#fish-path",
alignOrigin: [0.5, 0.5],
autoRotate: true,
start: 0,
end: 1
}
});
Also see: Tab Triggers