Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>Click Maze to Play / Pause the Animation</h1>
<svg id="maze" width="324" height="324" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <title>20 by 20 orthogonal maze</title>
  <desc>20 by 20 orthogonal maze generated by The Maze Generator Website (http://www.mazegenerator.net/).</desc>
  <g fill="none" stroke="#000000" stroke-width="2" stroke-linecap="square">
    <line x1="2" y1="2" x2="146" y2="2" />
    <line x1="162" y1="2" x2="322" y2="2" />
    <line x1="2" y1="18" x2="18" y2="18" />
    <line x1="34" y1="18" x2="98" y2="18" />
    <line x1="114" y1="18" x2="178" y2="18" />
    <line x1="194" y1="18" x2="210" y2="18" />
    <line x1="258" y1="18" x2="274" y2="18" />
    <line x1="290" y1="18" x2="306" y2="18" />
    <line x1="18" y1="34" x2="34" y2="34" />
    <line x1="82" y1="34" x2="98" y2="34" />
    <line x1="130" y1="34" x2="162" y2="34" />
    <line x1="226" y1="34" x2="258" y2="34" />
    <line x1="274" y1="34" x2="306" y2="34" />
    <line x1="18" y1="50" x2="50" y2="50" />
    <line x1="66" y1="50" x2="82" y2="50" />
    <line x1="98" y1="50" x2="162" y2="50" />
    <line x1="210" y1="50" x2="242" y2="50" />
    <line x1="274" y1="50" x2="306" y2="50" />
    <line x1="2" y1="66" x2="66" y2="66" />
    <line x1="98" y1="66" x2="114" y2="66" />
    <line x1="130" y1="66" x2="146" y2="66" />
    <line x1="162" y1="66" x2="178" y2="66" />
    <line x1="258" y1="66" x2="322" y2="66" />
    <line x1="18" y1="82" x2="50" y2="82" />
    <line x1="66" y1="82" x2="82" y2="82" />
    <line x1="114" y1="82" x2="130" y2="82" />
    <line x1="178" y1="82" x2="194" y2="82" />
    <line x1="242" y1="82" x2="290" y2="82" />
    <line x1="2" y1="98" x2="18" y2="98" />
    <line x1="66" y1="98" x2="114" y2="98" />
    <line x1="130" y1="98" x2="146" y2="98" />
    <line x1="162" y1="98" x2="178" y2="98" />
    <line x1="210" y1="98" x2="226" y2="98" />
    <line x1="242" y1="98" x2="258" y2="98" />
    <line x1="290" y1="98" x2="306" y2="98" />
    <line x1="18" y1="114" x2="82" y2="114" />
    <line x1="114" y1="114" x2="130" y2="114" />
    <line x1="146" y1="114" x2="162" y2="114" />
    <line x1="210" y1="114" x2="242" y2="114" />
    <line x1="258" y1="114" x2="290" y2="114" />
    <line x1="2" y1="130" x2="34" y2="130" />
    <line x1="66" y1="130" x2="82" y2="130" />
    <line x1="178" y1="130" x2="210" y2="130" />
    <line x1="242" y1="130" x2="258" y2="130" />
    <line x1="274" y1="130" x2="306" y2="130" />
    <line x1="18" y1="146" x2="50" y2="146" />
    <line x1="82" y1="146" x2="98" y2="146" />
    <line x1="114" y1="146" x2="146" y2="146" />
    <line x1="162" y1="146" x2="178" y2="146" />
    <line x1="210" y1="146" x2="226" y2="146" />
    <line x1="306" y1="146" x2="322" y2="146" />
    <line x1="2" y1="162" x2="34" y2="162" />
    <line x1="98" y1="162" x2="130" y2="162" />
    <line x1="194" y1="162" x2="210" y2="162" />
    <line x1="226" y1="162" x2="258" y2="162" />
    <line x1="290" y1="162" x2="306" y2="162" />
    <line x1="34" y1="178" x2="50" y2="178" />
    <line x1="82" y1="178" x2="98" y2="178" />
    <line x1="114" y1="178" x2="130" y2="178" />
    <line x1="210" y1="178" x2="242" y2="178" />
    <line x1="258" y1="178" x2="290" y2="178" />
    <line x1="50" y1="194" x2="66" y2="194" />
    <line x1="98" y1="194" x2="178" y2="194" />
    <line x1="194" y1="194" x2="226" y2="194" />
    <line x1="258" y1="194" x2="306" y2="194" />
    <line x1="50" y1="210" x2="66" y2="210" />
    <line x1="82" y1="210" x2="98" y2="210" />
    <line x1="210" y1="210" x2="274" y2="210" />
    <line x1="2" y1="226" x2="34" y2="226" />
    <line x1="114" y1="226" x2="130" y2="226" />
    <line x1="162" y1="226" x2="194" y2="226" />
    <line x1="226" y1="226" x2="242" y2="226" />
    <line x1="274" y1="226" x2="290" y2="226" />
    <line x1="66" y1="242" x2="130" y2="242" />
    <line x1="178" y1="242" x2="226" y2="242" />
    <line x1="242" y1="242" x2="274" y2="242" />
    <line x1="290" y1="242" x2="306" y2="242" />
    <line x1="34" y1="258" x2="50" y2="258" />
    <line x1="146" y1="258" x2="162" y2="258" />
    <line x1="194" y1="258" x2="210" y2="258" />
    <line x1="258" y1="258" x2="290" y2="258" />
    <line x1="306" y1="258" x2="322" y2="258" />
    <line x1="18" y1="274" x2="34" y2="274" />
    <line x1="50" y1="274" x2="146" y2="274" />
    <line x1="226" y1="274" x2="242" y2="274" />
    <line x1="290" y1="274" x2="306" y2="274" />
    <line x1="2" y1="290" x2="18" y2="290" />
    <line x1="66" y1="290" x2="114" y2="290" />
    <line x1="130" y1="290" x2="146" y2="290" />
    <line x1="162" y1="290" x2="178" y2="290" />
    <line x1="194" y1="290" x2="226" y2="290" />
    <line x1="242" y1="290" x2="274" y2="290" />
    <line x1="306" y1="290" x2="322" y2="290" />
    <line x1="18" y1="306" x2="50" y2="306" />
    <line x1="66" y1="306" x2="98" y2="306" />
    <line x1="162" y1="306" x2="194" y2="306" />
    <line x1="226" y1="306" x2="242" y2="306" />
    <line x1="290" y1="306" x2="306" y2="306" />
    <line x1="2" y1="322" x2="162" y2="322" />
    <line x1="178" y1="322" x2="322" y2="322" />
    <line x1="2" y1="2" x2="2" y2="322" />
    <line x1="18" y1="34" x2="18" y2="50" />
    <line x1="18" y1="162" x2="18" y2="210" />
    <line x1="18" y1="242" x2="18" y2="274" />
    <line x1="34" y1="18" x2="34" y2="34" />
    <line x1="34" y1="98" x2="34" y2="114" />
    <line x1="34" y1="178" x2="34" y2="242" />
    <line x1="34" y1="274" x2="34" y2="306" />
    <line x1="50" y1="34" x2="50" y2="50" />
    <line x1="50" y1="82" x2="50" y2="178" />
    <line x1="50" y1="226" x2="50" y2="290" />
    <line x1="50" y1="306" x2="50" y2="322" />
    <line x1="66" y1="18" x2="66" y2="50" />
    <line x1="66" y1="130" x2="66" y2="258" />
    <line x1="66" y1="290" x2="66" y2="306" />
    <line x1="82" y1="50" x2="82" y2="82" />
    <line x1="82" y1="114" x2="82" y2="130" />
    <line x1="82" y1="162" x2="82" y2="226" />
    <line x1="82" y1="258" x2="82" y2="274" />
    <line x1="98" y1="2" x2="98" y2="18" />
    <line x1="98" y1="34" x2="98" y2="50" />
    <line x1="98" y1="66" x2="98" y2="162" />
    <line x1="98" y1="194" x2="98" y2="210" />
    <line x1="98" y1="226" x2="98" y2="258" />
    <line x1="114" y1="18" x2="114" y2="34" />
    <line x1="114" y1="50" x2="114" y2="66" />
    <line x1="114" y1="98" x2="114" y2="114" />
    <line x1="114" y1="130" x2="114" y2="146" />
    <line x1="114" y1="178" x2="114" y2="194" />
    <line x1="114" y1="210" x2="114" y2="226" />
    <line x1="114" y1="258" x2="114" y2="274" />
    <line x1="114" y1="290" x2="114" y2="322" />
    <line x1="130" y1="34" x2="130" y2="50" />
    <line x1="130" y1="66" x2="130" y2="82" />
    <line x1="130" y1="114" x2="130" y2="146" />
    <line x1="130" y1="194" x2="130" y2="210" />
    <line x1="130" y1="226" x2="130" y2="274" />
    <line x1="130" y1="290" x2="130" y2="306" />
    <line x1="146" y1="66" x2="146" y2="130" />
    <line x1="146" y1="146" x2="146" y2="242" />
    <line x1="146" y1="274" x2="146" y2="290" />
    <line x1="146" y1="306" x2="146" y2="322" />
    <line x1="162" y1="50" x2="162" y2="82" />
    <line x1="162" y1="114" x2="162" y2="178" />
    <line x1="162" y1="210" x2="162" y2="274" />
    <line x1="162" y1="306" x2="162" y2="322" />
    <line x1="178" y1="2" x2="178" y2="66" />
    <line x1="178" y1="82" x2="178" y2="130" />
    <line x1="178" y1="146" x2="178" y2="210" />
    <line x1="178" y1="242" x2="178" y2="306" />
    <line x1="194" y1="18" x2="194" y2="82" />
    <line x1="194" y1="98" x2="194" y2="194" />
    <line x1="194" y1="210" x2="194" y2="242" />
    <line x1="194" y1="258" x2="194" y2="290" />
    <line x1="210" y1="18" x2="210" y2="82" />
    <line x1="210" y1="98" x2="210" y2="114" />
    <line x1="210" y1="194" x2="210" y2="226" />
    <line x1="210" y1="274" x2="210" y2="322" />
    <line x1="226" y1="18" x2="226" y2="34" />
    <line x1="226" y1="66" x2="226" y2="98" />
    <line x1="226" y1="114" x2="226" y2="162" />
    <line x1="226" y1="226" x2="226" y2="274" />
    <line x1="242" y1="2" x2="242" y2="18" />
    <line x1="242" y1="50" x2="242" y2="66" />
    <line x1="242" y1="98" x2="242" y2="114" />
    <line x1="242" y1="130" x2="242" y2="146" />
    <line x1="242" y1="162" x2="242" y2="210" />
    <line x1="242" y1="258" x2="242" y2="306" />
    <line x1="258" y1="18" x2="258" y2="66" />
    <line x1="258" y1="82" x2="258" y2="98" />
    <line x1="258" y1="114" x2="258" y2="162" />
    <line x1="258" y1="178" x2="258" y2="194" />
    <line x1="258" y1="210" x2="258" y2="226" />
    <line x1="258" y1="242" x2="258" y2="274" />
    <line x1="258" y1="306" x2="258" y2="322" />
    <line x1="274" y1="18" x2="274" y2="34" />
    <line x1="274" y1="98" x2="274" y2="114" />
    <line x1="274" y1="130" x2="274" y2="178" />
    <line x1="274" y1="226" x2="274" y2="242" />
    <line x1="274" y1="274" x2="274" y2="306" />
    <line x1="290" y1="2" x2="290" y2="18" />
    <line x1="290" y1="82" x2="290" y2="98" />
    <line x1="290" y1="146" x2="290" y2="162" />
    <line x1="290" y1="194" x2="290" y2="226" />
    <line x1="290" y1="258" x2="290" y2="274" />
    <line x1="290" y1="290" x2="290" y2="322" />
    <line x1="306" y1="34" x2="306" y2="50" />
    <line x1="306" y1="66" x2="306" y2="82" />
    <line x1="306" y1="98" x2="306" y2="130" />
    <line x1="306" y1="162" x2="306" y2="226" />
    <line x1="306" y1="242" x2="306" y2="258" />
    <line x1="306" y1="274" x2="306" y2="290" />
    <line x1="322" y1="2" x2="322" y2="322" />
  </g>
  <polyline id="template" fill="none" stroke="#630" stroke-width="5" stroke-linecap="square" stroke-linejoin="round" points="154,2 154,10 106,10 106,26 74,26 74,42 90,42 90,90 58,90 58,106 90,106 90,138 74,138 74,234 90,234 90,218 106,218 106,202 122,202 122,218 138,218 138,250 154,250 154,202 170,202 170,218 186,218 186,202 202,202 202,234 218,234 218,218 250,218 250,234 234,234 234,250 250,250 250,282 266,282 266,266 282,266 282,314 266,314 266,298 250,298 250,314 218,314 218,298 234,298 234,282 218,282 218,250 186,250 186,298 202,298 202,314 170,314 170,322" />
  <polyline id="solution" fill="none" stroke="#ff0000" stroke-width="2" stroke-linecap="square" stroke-linejoin="round" points="154,2 154,10 106,10 106,26 74,26 74,42 90,42 90,90 58,90 58,106 90,106 90,138 74,138 74,234 90,234 90,218 106,218 106,202 122,202 122,218 138,218 138,250 154,250 154,202 170,202 170,218 186,218 186,202 202,202 202,234 218,234 218,218 250,218 250,234 234,234 234,250 250,250 250,282 266,282 266,266 282,266 282,314 266,314 266,298 250,298 250,314 218,314 218,298 234,298 234,282 218,282 218,250 186,250 186,298 202,298 202,314 170,314 170,322" />
  
</svg>
<br><br>
<span id="showPath">show path</span>
<link href='https://fonts.googleapis.com/css?family=Signika+Negative:300,400,700' rel='stylesheet' type='text/css'>

              
            
!

CSS

              
                body{
  background:#121212;
  text-align:center;
  color:#6f6f6f;
  font-family:'Signika Negative', Asap, sans-serif;
}
h1{
  
  color:#6f6f6f;
  font-weight:300;
  font-size:16px;
}
line{
  stroke:#3C560C;
  stroke-width:5;
}

#solution{
  stroke:#88CE02;
  stroke-width:5;
}

svg, #showPath{
  cursor:pointer;
}

#template {
  visibility:hidden;
}
              
            
!

JS

              
                var solutionPath = document.getElementById("solution");
var templatePath = document.getElementById("template");
var showPath = document.getElementById("showPath")
var tl = new TimelineMax({repeat:-1, yoyo:true, repeatDelay:0.2});

tl.fromTo(solutionPath, 0.3, {drawSVG:"0"}, {drawSVG:"0% 4%", ease:Power1.easeIn})// enter top
  .to(solutionPath, 3, {drawSVG:"96% 100%", ease:Linear.easeNone}) // through the maze as a 4% segment
  .to(solutionPath, 0.3, {drawSVG:"100% 100%"}) //exit bottom

document.getElementById("maze").onclick = function() {
  tl.paused(!tl.paused())
}

showPath.onmouseenter = function() {
  TweenLite.to(templatePath, 0.2, {autoAlpha:1})
}

showPath.onmouseleave = function() {
  TweenLite.to(templatePath, 0.2, {autoAlpha:0})
}

/* this pen uses GreenSock's TimelineMax and DrawSVGPlugin

-- more info on how to use DrawSVGPlugin: https://greensock.com/drawSVG


*** full attribution ***

-- Maze originally created by Ryan O'Meara and features css animation

-- https://codepen.io/helloryano/details/zxwXdo/

*/
              
            
!
999px

Console