Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ 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

Auto Save

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

              
                <!--==========================================-->
<!--Margus Lillemägi | codepen.io/VisualAngle/-->
<!--==========================================-->

<!--One of the most interesting and useful features of SVG is the capability of using paths for positioning shapes and text. This example demonstrates how to place text along a Bézier curve and animating it with JavaScript.-->

<!--Have fun with SVG! :)-->

<div id="container">
  
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMin slice" viewBox="0 0 728 400">
<!--Background-->  
<path d="M0 0h728v400H0z" fill="white"/> 

<g transform="translate(160,130)">
<!--Curve path-->  
<defs>
<path id="curve" d="M 0,100 C 100,150 100,50 200,50 C 300,50 300,150 400,100" />
</defs>
  
<!--Text & link to path-->  
<text font-family="monospace" font-size="22" fill="black">
<textPath id="text" xlink:href="#curve">Text here</textPath>
</text>
</g>
  
</svg>
  
</div>

              
            
!

CSS

              
                body{
  background-color:#1d1f20;
}
body, html {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Demo container*/
#container{
  max-width:900px;
  width:100%;
  overflow:hidden; 
  position: absolute;
  top: 50%;
  left: 50%;
  margin-right: -50%;
  transform: translate(-50%, -50%);
}

/* Bottom hack for IE*/
svg{
  width:100%;
  padding-bottom: 55.55%;
  height: 1px;
  overflow: visible;
 }
      

              
            
!

JS

              
                document.addEventListener('DOMContentLoaded',function(event){
  window.onload = function() { 
    
// array with text to type
  var dataText = [ "Text typing along a Bézier curve."];
  //text input caret
  var caret = "\u258B";
  
  // type a text
  // keep calling itself until the text is finished
  function type(text, i, fnCallback) {
    // chekc if text isn't finished yet
    if (i < (text.length)) {
      // add next character to text + caret
      document.querySelector("#text").textContent = text.substring(0, i+1) + caret;

      // delay and call this function again for next character
      setTimeout(function() {
        type(text, i + 1, fnCallback)
      }, 70);
    }
    // text finished, call callback if there is a callback function
    else if (typeof fnCallback == 'function') {
      // call callback after timeout
      setTimeout(fnCallback, 1500);
    }
  }
  // start animation for a text in the dataText array
   function StartAnimation(i) {
     if (typeof dataText[i] == 'undefined'){
        setTimeout(function() {
          StartAnimation(0);
        }, 1000);
     }
     // check if dataText[i] exists
    if (i < dataText[i].length) {
      // text exists! start typewriter animation
      type(dataText[i], 0, function(){
      // after callback (and whole text has been animated), start next text
      StartAnimation(i + 1);
     });
    }
  }
  // start the text animation
  StartAnimation(0);
  }
});


              
            
!
999px

Console