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

              
                
              
            
!

CSS

              
                body {
  background-color: black;
}
.dot{
	position: absolute;
	width: 2px;
	height: 2px;
	background-color: #91e600;
	
	visibility:hidden;
}
              
            
!

JS

              
                $(window).ready(function() {
		var quantity = 70, //number of dots
			duration = 3,  //duration (in seconds)
			path = [{x:62, y:47},{x:160, y:54},{x:333, y:173}], //points on the path (BezierPlugin will plot a Bezier through these). Adjust however you please.
       //* updated to support rotation
        position = {x:path[0].x, y:[path[0].y], rotation:0}, //tracks the current position, so we set it initially to the first node in the path. It's the target of the tween.
        
        //** updated to support rotation
        tween = TweenMax.to(position, quantity, {bezier:{values:path, autoRotate:true}, ease:Linear.easeNone}), //this does all the work of figuring out the positions over time.
			tl = new TimelineMax({ yoyo:true}), //we'll use a TimelineMax to schedule things. You can then have total control of playback. pause(), resume(), reverse(), whatever.
			i, dot;

		//we can remove the first point on the path because the position is already there and we want to draw the Bezier from there through the other points
		path.shift();

		for (i = 0; i < quantity; i++) {
			tween.time(i); //jumps to the appropriate time in the tween, causing position.x and position.y to be updated accordingly.
      dot = $("<div />", {id:"dot"+i}).addClass("dot").css({left:position.x+"px", top:position.y+"px"}).appendTo("body"); //create a new dot, add the .dot class, set the position, and add it to the body.
      
      //** updated to easily handle rotation cross-browser (no vendor prefixes)
      TweenLite.set(dot, {rotation:position.rotation});
			tl.set(dot, {visibility:"visible"}, i * (duration / quantity)); //toggle the visibility on at the appropriate time.
		}
	});
              
            
!
999px

Console