D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
sandravizz
Full window
Github gist
7.10 animated line plot | svg stroke dashoffset
Built with
blockbuilder.org
<!DOCTYPE html> <meta charset="utf-8"> <html> <head> <!-- Google fonts reference --> <link href="https://fonts.googleapis.com/css2?family=Montserrat+Alternates:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;1,100;1,300&display=swap" rel="stylesheet"> <!-- Connecting with D3 library--> <script src="https://d3js.org/d3.v4.min.js"></script> <!-- Google fonts Second Reference--> <link href="https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght@500&family=Poiret+One&display=swap" rel="stylesheet"> <!-- Creating the headlines --> <p id="h1"> SVG | ANIMATION </p> <div id="link">by <a href="https://slides.com/sandravizmad">SANDRA</a></div> <!-- Creating the chart--> <svg version="1.1" id="Layer_1" xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" x="0px" y="0px" width="340px" height="333px" viewBox="0 0 340 333" enable-background="new 0 0 340 333" xml:space="preserve"> <path class="path" stroke-miterlimit="10" d="M66.039,133.545c0,0-21-57,18-67s49-4,65,8 s30,41,53,27s66,4,58,32s-5,44,18,57s22,46,0,45s-54-40-68-16s-40,88-83,48s11-61-11-80s-79-7-70-41, C46.039,146.545,53.039,128.545,66.039,133.545z"/></svg> <style> /*Defining text stylings*/ #h1 { font-size:30px; margin:30px 0px 0px 20px; color:#f5fa91; font-family: 'Montserrat Alternates', sans-serif; font-weight:300; } #link { font-family:'Montserrat Alternates', sans-serif; font-weight:200; font-size:10px; margin:5px 0px 150px 22px; color:white; } a:link, a:visited, a:active { text-decoration: none; color:white; border-bottom:1.5px dotted white; } body { background-color:#011227; } /*Defining chart stylings*/ .path { stroke-dasharray:1000; stroke-dashoffset:1000; animation:dash 5s linear alternate infinite; fill:#f5fa91; fill-opacity:1; stroke:#85f6fa; stroke-opacity:1; stroke-width:10; } @keyframes dash {from {stroke-dashoffset: 1000;} to {stroke-dashoffset: 0;}} </style> </head> </html>
https://d3js.org/d3.v4.min.js