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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <div class="animation-object" id="js-animation-object"></div>

<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="1000px" height="1000px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">

<path id="js-animation-path" fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" d="M55.5,190c-8.836-76.768,46.232-146.164,123-155
	c61.414-7.069,116.931,36.986,124,98.4c5.655,49.131-29.589,93.545-78.72,99.2c-39.305,4.524-74.836-23.671-79.36-62.976
	c-3.619-31.444,18.937-59.869,50.381-63.488c25.155-2.896,47.895,15.149,50.791,40.304c2.316,20.125-12.12,38.316-32.244,40.632
	c-16.1,1.854-30.653-9.695-32.506-25.794c-1.482-12.88,7.756-24.522,20.636-26.005c10.304-1.186,19.618,6.205,20.804,16.509"/>
</svg>
              
            
!

CSS

              
                .animation-object{
  width: 0px;
  height: 0px;
  border: 10px solid transparent;
  border-left-color: #4ECDC4;
  position: absolute;
  margin-top: -10px;
  margin-left: -10px;
  background-image: 	linear-gradient(transparent 50%, rgba(255,255,255,.55) 50%);
	background-size:  10px;
	background-position: 0 10px
}
              
            
!

JS

              
                console.clear()

// get the animation path node
var $path = $('#js-animation-path'), path = $path[0];
// get the animation object node
var $obj = $('#js-animation-object');

// get path's length
var pathLength = path.getTotalLength();

// create new tween by initializing TWEEN.Tween object from 0 
var tween = new TWEEN.Tween({ length: 0  })
    // to path length
    // in 2000 milliseconds
    .to({ length: pathLength }, 4000)
    // on update callback fires on every tick
    .onUpdate(function(){
      // get current point
      var point = path.getPointAtLength(this.length);
      // get previous point
      var pointPrevious = path.getPointAtLength(this.length-1);
      // get x1
      var x1 = point.y - pointPrevious.y;
      // get x2
      var x2 = point.x - pointPrevious.x;
      //get angle in radians and convert it to degrees
      var angle = Math.atan(x1/x2)*(180/Math.PI);
      
      // fix to normalize object angle
      if (point.x-pointPrevious.x < 0){
        angle = 180 + angle;
      }
      
      $obj.css({
        'transform': 'translate('+ point.x + 'px,'+ point.y +'px) rotate('+angle+'deg)'
      });
    })
    .onStart(function(){
      console.clear();
    })
    .repeat(999999999).start();

// animate loop
animate = function(){
  requestAnimationFrame(animate)
	TWEEN.update()
}
 
//start the animation loop
animate()







              
            
!
999px

Console