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.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<script src="js/anime.min.js" defer></script>
<script src="js/main.js" defer></script>
</head>
<body>
<div class="container">
<button type="button" class="btn btn-success" id="startAnimation">Start</button>
<div class="line-drawing-demo">
<svg version="1.1" id="logo" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 800 300" xml:space="preserve">
<g id="head">
<circle class="st0" cx="172.028" cy="176.62" r="7.873" />
<path class="st0"
d="M204.695 158.653c-1.85-2.643-5.682-8.061-9.911-10.043-4.229-1.982-9.054-1.709-11.629 0s-4.865 4.919-4.757 9.118c.092 3.555 2.43 6.482 5.726 8.564 2.77 1.75 6.891 5.771 7.441 11.18.41-.101.822-.197 1.236-.287 7.116-1.547 14.927-1.129 22.288-.146-3.439-8.466-8.674-15.928-10.394-18.386zm-16.315 1.627c-2.049 0-3.709-1.488-3.709-3.324s1.661-3.324 3.709-3.324c2.049 0 3.709 1.488 3.709 3.324s-1.661 3.324-3.709 3.324z" />
<path class="st0"
d="M196.727 122.224c8.125-4.225 24.701-12.025 27.301-13 2.6-.975 3.9.65 2.275 3.575s-11.05 26.346-12.35 29.576c-3.9-6.501-12.676-17.551-17.226-20.151z" />
<path class="st0"
d="M159.863 148.61c-2.575-1.709-7.4-1.982-11.629 0s-8.061 7.4-9.911 10.043c-1.85 2.643-6.825 10.409-10.365 18.104 8.276-1.289 15.525-1.161 23.702.616.308-4.463 4.31-9.234 7.234-11.081 3.297-2.082 5.635-5.009 5.726-8.564.109-4.199-2.182-7.409-4.757-9.118zm-5.225 11.67c-2.049 0-3.709-1.488-3.709-3.324s1.661-3.324 3.709-3.324c2.049 0 3.709 1.488 3.709 3.324s-1.66 3.324-3.709 3.324z" />
<path class="st0"
d="M147.413 122.307c-8.125-4.225-24.701-12.025-27.301-13s-3.9.65-2.275 3.575 11.05 26.346 12.35 29.576c3.9-6.501 12.676-17.551 17.226-20.151z" />
</g>
<path class="st0"
d="M244.401 136.637l-.076 6.134c1.993-4.371 4.983-6.978 9.2-6.978.768 0 1.612.076 2.302.23l-.921 11.656c-.688-.076-1.303-.154-1.993-.154-6.364 0-7.822 7.592-7.822 15.108v13.112h-12.039v-39.108h11.349z"
id="text-01" />
<path class="st0"
d="M260.886 141.391c3.989-4.295 9.355-5.597 15.643-5.597 11.043 0 16.257 3.988 16.257 15.029v24.923h-10.199l-.076-4.985c-2.837 4.141-6.902 5.982-11.348 5.982-3.682 0-6.595-1.227-8.589-3.068-2.302-2.146-3.451-5.061-3.451-9.048 0-4.754 1.688-7.975 4.831-10.122 3.375-2.302 8.434-3.144 13.648-3.144h4.141v-.997c0-4.295-1.456-5.599-5.751-5.599-3.756 0-6.671.997-9.2 3.451l-5.906-6.825zm16.18 17.637c-4.215 0-6.671.537-6.671 5.061 0 2.454.69 3.912 2.761 3.912 3.221 0 8.282-3.529 8.819-8.972l-4.909-.001z"
id="text-02" />
<path class="st0"
d="M332.203 170.301c-3.76 4.217-8.819 6.212-14.877 6.212-5.751 0-9.663-1.841-12.271-4.678-3.373-3.682-4.6-8.743-4.6-15.184 0-6.365 1.227-12.346 5.214-16.333 2.838-2.761 6.902-4.602 13.038-4.602 4.83 0 9.661 1.151 12.958 4.524l-6.748 8.129c-1.763-1.534-3.834-2.146-6.058-2.146-4.907 0-5.829 2.99-5.829 9.892s.921 10.122 4.909 10.122c2.607 0 5.061-1.303 7.131-3.527l7.133 7.591z"
id="text-03" />
<path class="st0"
d="M368.933 170.301c-3.76 4.217-8.819 6.212-14.877 6.212-5.751 0-9.663-1.841-12.272-4.678-3.373-3.682-4.6-8.743-4.6-15.184 0-6.365 1.227-12.346 5.214-16.333 2.838-2.761 6.902-4.602 13.038-4.602 4.83 0 9.661 1.151 12.958 4.524l-6.748 8.129c-1.763-1.534-3.834-2.146-6.058-2.146-4.907 0-5.829 2.99-5.829 9.892s.921 10.122 4.909 10.122c2.607 0 5.061-1.303 7.131-3.527l7.134 7.591z"
id="text-04" />
<path class="st0"
d="M405.049 172.294c-3.221 3.068-7.287 4.602-13.189 4.602-5.751 0-9.74-1.458-12.73-4.217-3.988-3.604-5.214-8.436-5.214-15.952 0-7.897 1.38-12.729 5.292-16.563 3.22-3.144 7.361-4.755 13.265-4.755 5.675 0 9.816 1.458 12.806 4.219 3.912 3.604 5.137 8.588 5.137 16.104-.001 7.743-1.303 12.652-5.367 16.562zm-8.741-25.382c-.768-.92-1.995-1.38-3.836-1.38-2.222 0-3.603.69-4.295 1.534-1.38 1.61-1.917 5.214-1.917 9.431 0 4.448.614 7.746 1.765 8.972.766.844 2.147 1.38 3.986 1.38 2.072 0 3.375-.69 4.141-1.61 1.38-1.612 1.995-4.909 1.995-9.433 0-4.216-.536-7.36-1.839-8.894z"
id="text-05" />
<path class="st0"
d="M447.991 172.294c-3.221 3.068-7.285 4.602-13.191 4.602-5.751 0-9.737-1.458-12.729-4.217-3.988-3.604-5.214-8.436-5.214-15.952 0-7.897 1.38-12.729 5.29-16.563 3.221-3.144 7.363-4.755 13.267-4.755 5.675 0 9.816 1.458 12.806 4.219 3.91 3.604 5.138 8.588 5.138 16.104.001 7.743-1.303 12.652-5.367 16.562zm-8.743-25.382c-.766-.92-1.993-1.38-3.834-1.38-2.224 0-3.605.69-4.293 1.534-1.38 1.61-1.917 5.214-1.917 9.431 0 4.448.613 7.746 1.762 8.972.768.844 2.148 1.38 3.989 1.38 2.069 0 3.373-.69 4.141-1.61 1.38-1.612 1.993-4.909 1.993-9.433 0-4.216-.536-7.36-1.841-8.894z"
id="text-06" />
<path class="st0"
d="M473.987 136.637v5.98c2.378-4.371 6.289-6.978 11.656-6.978 7.592 0 11.502 5.061 11.502 13.956v26.15h-12.116v-24.232c0-3.144-.613-4.754-2.913-4.754-3.834 0-7.285 4.295-7.285 13.267v15.719h-12.04v-39.108h11.196z"
id="text-07" />
<path class="st0"
d="M514.133 116.545c4.065 0 7.055 3.066 7.055 7.207s-2.99 7.131-7.055 7.131c-3.988 0-7.055-3.066-7.055-7.131 0-4.063 3.067-7.207 7.055-7.207zm6.058 20.092v39.108h-12.04v-39.108h12.04z"
id="text-08" />
<path class="st0"
d="M561.641 170.301c-3.758 4.217-8.819 6.212-14.877 6.212-5.751 0-9.663-1.841-12.27-4.678-3.373-3.682-4.602-8.743-4.602-15.184 0-6.365 1.228-12.346 5.214-16.333 2.838-2.761 6.902-4.602 13.038-4.602 4.831 0 9.663 1.151 12.96 4.524l-6.748 8.129c-1.763-1.534-3.836-2.146-6.058-2.146-4.909 0-5.829 2.99-5.829 9.892s.92 10.122 4.909 10.122c2.606 0 5.059-1.303 7.131-3.527l7.132 7.591z"
id="text-09" />
<path class="st0"
d="M597.757 172.294c-3.22 3.068-7.285 4.602-13.19 4.602-5.751 0-9.739-1.458-12.731-4.217-3.986-3.604-5.214-8.436-5.214-15.952 0-7.897 1.38-12.729 5.292-16.563 3.22-3.144 7.361-4.755 13.267-4.755 5.673 0 9.815 1.458 12.805 4.219 3.912 3.604 5.138 8.588 5.138 16.104.001 7.743-1.303 12.652-5.367 16.562zm-8.741-25.382c-.766-.92-1.995-1.38-3.834-1.38-2.224 0-3.604.69-4.295 1.534-1.38 1.61-1.917 5.214-1.917 9.431 0 4.448.613 7.746 1.763 8.972.766.844 2.146 1.38 3.988 1.38 2.071 0 3.373-.69 4.141-1.61 1.38-1.612 1.993-4.909 1.993-9.433 0-4.216-.536-7.36-1.839-8.894z"
id="text-10" />
<g id="tail">
<path class="st0"
d="M646.657 133.291c-9.106-3.406-23.457.155-23.266.3 2.252 1.71 5.97 5.66 4.517 10.488 3.948-4.94 11.471-9.078 18.749-10.788zM630.026 149.406c7.414 4.143 14.179 13.234 14.911 21.471.799 8.987-.35 15.378-2.501 20.183 5.593-.306 11.511-1.327 16.896-2.938 3.222-9.407 2.211-18.311-3.087-26.577-5.371-8.377-16.188-13.883-26.219-12.139z" />
<path class="st0"
d="M682.838 159.787c-.175-6.245-5.482-19.735-14.436-21.745-12.193-2.737-19.37.183-27.68 3.474 12.429 1.526 19.44 6.928 24.251 14.434 5.423 8.46 7.505 17.529 6.265 26.883 7.902-5.295 12.113-14.128 11.6-23.046zM634.61 171.796c-.713-8.025-3.141-16.206-15.407-16.515-2.873 2.279-5.041 5.641-5.475 9.545-.875 7.877.147 15.632 8.811 22.44 1.956 1.537 4.789 2.587 8.146 3.207 3.129-3.618 4.808-8.746 3.925-18.677z" />
</g>
</svg>
</div>
</div>
</body>
</html>
body{
background-color: #efefef;
margin: 0;
}
.container{
width: 100%;
min-height: 100vh;
max-width: 1280px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
}
.button{
width: 30%;
height: 2rem;
margin: 0 auto;
}
#logo .st0
{
fill: transparent;
stroke-width: 1px;
stroke: black;
}
"use strict";
const logo = document.getElementById('logo');
const startAnimation = document.getElementById('startAnimation');
startAnimation.onclick = function () {
let timeline = anime.timeline({
targets: '.st0',
direction: 'normal',
loop: false
})
timeline.add({
strokeDashoffset: [anime.setDashoffset, 0],
easing: 'easeInOutSine',
fill: ['transparent', 'transparent'],
duration: 300,
delay: function (el, i) { return i * 150 }
})
timeline.add({
easing: 'easeInOutSine',
fill: ['transparent', '#000000'],
duration: 500
},'-=200')
};
Also see: Tab Triggers