cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


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.

              <div id="ln1trigger">Click to animate line1 via jQuery</div>

<div id="ln2trigger">Click to animate line2 via CSS (needs support for transition)</div>


<svg width="687px" height="200px">

	<path id="line1" fill="none" stroke="#0000FF" stroke-width="5" stroke-miterlimit="10" d="M23.15,54.827
	<path id="line2" fill="none" stroke="#FF0000" stroke-width="5" stroke-miterlimit="10" d="M23.15,111.198


<a href="http://www.frontendfrontline.com/2013/10/animating-line-being-drawn-with-svg.html">Check out my blog</a>
              //with jQuery
	var ln1 = document.querySelector('#line1');

	jQuery('#ln1trigger').click(function() {
		var ln1length = ln1.getTotalLength();
		ln1.style.strokeDasharray = ln1length;
		ln1.style.strokeDashoffset = ln1length;

	//with CSS
	var ln2 = document.querySelector('#line2');

	jQuery('#ln2trigger').click(function() {
		var ln2length = ln2.getTotalLength();
		ln2.style.strokeDasharray = ln2length;
		ln2.style.strokeDashoffset = ln2length;
		ln2.style.webkitTransition = 'all 1s';
		ln2.style.transition = 'all 1s';
		ln2.style.strokeDashoffset = 0;

		ln2.addEventListener('transitionend', function() {
			ln2.style.strokeDashoffset = 0;
			ln2.style.webkitTransition = 'all 0s';
			ln2.style.transition = 'all 0s';	
Loading ..................