SVG line animation
How do I make an svg line animation?
A trick using an animated dashed stroke to make it look like the SVG is drawing itself.See it in action https://roland.codes/. What is a svg line animation? How do you make a svg line animation? This script and codes were developed by Roland Warmerdam on 23 September 2022, Friday.
SVG line animation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>SVG line animation</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <ul class="icons"> <li class="icon"> <svg xmlns="http://www.w3.org/2000/svg" width="48" height="55" viewBox="0 0 48 55"> <title>HTML</title> <path fill="none" d="M35.437 12.205H11.953l1.054 12.75h21.828l-.753 13.575-10.086 3.225-9.935-3.225-.335-4.284m10.273 19.66l-18.817-6L.964.656h46.064l-4.215 47.25-18.817 6"/> </svg> </li> <li class="icon"> <svg xmlns="http://www.w3.org/2000/svg" width="48" height="55" viewBox="0 0 48 55"> <title>CSS</title> <path fill="none" d="M19.09 24.657h14.905m-22.882-12.75h23.6m-11.18 41.998l-18.818-6L.5.655h46.065l-4.216 47.25-18.82 6m11.18-41.998l-1.47 26.325-10.086 3.225-9.936-3.225-.338-4.284"/> </svg> </li> <li class="icon"> <svg xmlns="http://www.w3.org/2000/svg" width="53" height="61" viewBox="0 0 53 61"> <title>Node.js</title> <path fill="none" d="M16.76 20.738s.055 17.7.055 24.57c-.173 6.28-6.278 5.748-9.53 3.87C4.033 47.302.5 44.954.5 44.954V16.357L26.294 1.465l25.794 14.892v28.596L26.294 59.845l-7.927-4.577M41.44 25.162c-.118-6.752-17.114-7.217-17.347 0-.233 7.218 18.51 2.91 18.51 10.478 0 7.567-18.743 8.032-19.44.465"/> </svg> </li> <li class="icon"> <svg xmlns="http://www.w3.org/2000/svg" width="49" height="61" viewBox="0 0 49 61"> <title>Linux</title> <path fill="none" d="M43.156 43.45c.68.024 1.353.296 1.643.89.34.696.02 1.548.23 2.296.39 1.427 2.39 1.805 3.03 3.14.62 1.302-.36 2.86-1.6 3.61-1.24.75-2.71 1.03-3.94 1.79-1.6.99-2.62 2.687-4.05 3.91-1.43 1.222-3.76 1.863-5.1.538-.79-.787-.95-2.004-.92-3.12m.104.993c-.64-2.01.37-4.124.755-6.198.335-1.81.19-3.67.246-5.51.02-.69.08-1.4.416-1.99.337-.6 1.03-1.05 1.697-.89M17.54 57.19c.72-1.09.843-2.55.315-3.745-.288-.65-.744-1.206-1.18-1.766-1.63-2.1-3.05-4.36-4.226-6.74-.49-.99-.96-2.02-1.77-2.76-.26-.23-.55-.43-.88-.51-.88-.21-1.71.48-2.21 1.22-.51.74-.87 1.62-1.58 2.16-1.23.93-3.16.62-4.2 1.74-1.3 1.4-.2 3.72-.76 5.54-.17.523-.47 1.01-.54 1.553-.18 1.25.94 2.364 2.14 2.723 1.2.36 1.32.01 3.76.16 2.43.145 6.02 2.58 7.8 2.164 1.78-.414 2.6-.666 3.32-1.756zm9.71-39.647c.07.037.145.08.185.15.073.135-.014.3-.1.426-.644.95-1.4 1.86-2.4 2.41s-2.295.7-3.283.12c-.348-.21-.643-.49-.935-.77l-.98-.94c-.07-.07-.145-.15-.142-.25.004-.076.054-.14.103-.2.335-.41.67-.817 1.006-1.225.305-.37.94-.91 2.51-.96 1.57-.05 3.504.936 4.035 1.22zm-9.513 38.97c2.028-.396 6.098-1.124 7.25-1.242 2.244-.23 5.484.73 7.615 1.47M7.598 42.91c-.975-3.87.42-8.3 1.042-9.59.726-1.5 1.56-2.95 2.494-4.32 1.665-2.45 3.674-4.74 4.673-7.53 1.44-4.02.585-8.44.525-12.71-.02-1.44.065-2.93.702-4.22.8-1.62 2.408-2.74 4.146-3.22 1.737-.48 3.593-.38 5.357-.01.984.208 1.963.504 2.814 1.04 1.39.873 2.34 2.33 2.9 3.87.57 1.54.79 3.182 1.03 4.81.51 3.49 1.09 7.013 2.53 10.23 2.25 5.03 6.54 9.162 7.66 14.555.37 1.74.46 6.052-.04 7.02-.5.97-.96 1.53-1.69 2.067-1.06.785-2.52 1.1-3.73.585-1.25-.534-2.04-1.836-2.34-3.164-.3-1.325-.21-2.71-.2-4.07.02-1.79-.1-3.58-.35-5.35-.08-.56-.175-1.125-.38-1.654-.226-.59-.58-1.12-.905-1.66-1.854-3.07-2.85-6.56-3.824-10m-13.69 5.64c-.093.84-.306 1.67-.635 2.46-.46 1.09-1.14 2.09-1.72 3.13-1.78 3.17-2.34 8.97-2.256 12.61m12.8-28.247c-.615-2.496-.33-6.58 2.99-5.446 3.32 1.137 2.41 5.985 1.274 6.567m-7.488-1.46c.91-3.515-1.355-6.12-3.07-4.536-1.716 1.58-.447 5.072.46 5.995"/> </svg> </li> <li class="icon"> <svg xmlns="http://www.w3.org/2000/svg" width="62" height="62" viewBox="0 0 62 62"> <title>Git</title> <path fill="none" d="M22.902 7.546l6.847 6.874c1.59-.54 3.41-.178 4.68 1.095 1.272 1.282 1.63 3.13 1.08 4.732l6.6 6.624c1.595-.55 3.44-.19 4.712 1.09 1.782 1.79 1.782 4.69 0 6.48-1.783 1.79-4.67 1.79-6.453 0-1.34-1.346-1.67-3.322-.993-4.98l-6.154-6.18v16.26c.433.217.844.505 1.205.867 1.782 1.79 1.782 4.688 0 6.48-1.78 1.787-4.67 1.787-6.45 0-1.784-1.79-1.784-4.69 0-6.48.44-.44.95-.774 1.492-1V22.99c-.544-.222-1.053-.554-1.494-.998-1.35-1.354-1.674-3.343-.98-5.007l-6.75-6.777L2.426 28.1c-1.5 1.504-1.5 3.94 0 5.444L28.42 59.638c1.497 1.503 3.924 1.503 5.423 0l25.872-25.972c1.498-1.504 1.498-3.943 0-5.446L33.72 2.127c-1.494-1.503-3.923-1.503-5.42 0l-2.846 2.857"/> </svg> </li> <li class="icon"> <svg xmlns="http://www.w3.org/2000/svg" width="67" height="45" viewBox="0 0 67 45"> <title>Tetris</title> <path fill="none" d="M45.142 44.043h20.394v-21.52H44.66l-.802.716v20.8h-21.68V23.32l.884-.798h19.993l.803-.638V1h-21.68v20.565l-.882.957H.5V1h20.715"/> </svg> </li>
</div>
</body>
</html>
SVG line animation - Script Codes CSS Codes
.icons { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; height: 100%; padding: 0; margin: 0; list-style: none; text-align: center;
}
.icon { -ms-flex-preferred-size: 130px; flex-basis: 130px;
}
.icon svg { stroke: #fff; stroke-width: 1px; stroke-dasharray: 300; stroke-dashoffset: 300; -webkit-animation: line 2s linear forwards; animation: line 2s linear forwards;
}
@media (max-width: 640px) { .icon svg { max-width: 10vw; max-height: 9vw; }
}
@media (max-width: 450px) { .icon svg { max-width: 30px; max-height: 24px; stroke-width: 2px; }
}
@-webkit-keyframes line { to { stroke-dashoffset: 0; }
}
@keyframes line { to { stroke-dashoffset: 0; }
}
.icon:nth-child(2) svg { -webkit-animation-delay: 0.6s; animation-delay: 0.6s;
}
.icon:nth-child(3) svg { -webkit-animation-delay: 1.2s; animation-delay: 1.2s;
}
.icon:nth-child(4) svg { -webkit-animation-delay: 1.8s; animation-delay: 1.8s;
}
.icon:nth-child(5) svg { -webkit-animation-delay: 2.4s; animation-delay: 2.4s;
}
.icon:nth-child(6) svg { -webkit-animation-delay: 3s; animation-delay: 3s;
}
html { box-sizing: border-box;
}
*,
*:before,
*:after { box-sizing: inherit;
}
html,
body { height: 100%;
}
body { min-width: 260px; padding: 40px; background: #74C390;
}
@media (max-width: 450px) { body { padding: 20px; }
}
Developer | Roland Warmerdam |
Username | Rowno |
Uploaded | September 23, 2022 |
Rating | 3.5 |
Size | 4,485 Kb |
Views | 30,360 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Chameleon background | 2,314 Kb |
Legacy flexbox invisible float bug fix | 2,625 Kb |
IE flex collapse bug fix | 2,678 Kb |
Bootstrap Carousel Fade Transition | 2,484 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
BlueBox Fork | Huskynation | 12,675 Kb |
TweenMax transformOrigin Bubble | Nicolund | 2,209 Kb |
Break Out | AzazelN28 | 12,431 Kb |
Navcube | Wbarlow | 4,775 Kb |
Project Euler Problem 17 | Bfillmer | 2,739 Kb |
Resize image | Happyhj | 1,892 Kb |
Brian The CSS Bee | Jonitrythall | 3,922 Kb |
Flex layout example | Mofny | 1,663 Kb |
Simple Login Form Template | Banunn | 3,571 Kb |
Knockout Lists | Marinru | 2,531 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!