Pen Settings



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


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


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.


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.


                <div class="container">
  <div class="markSpot"></div>
  <div id="emitter"></div>
<button id="play">CLICK HERE & PLAY PATH 1<br/>Red Square</button> 



                html, body {
  background: #666666;

.container {
  background:  url('');
  height: 1059px;
  width: 1000px;
  margin: 0;
  padding: 0;
  overflow: hidden;

#emitter {
  background-color: green;
  width: 30px;
  height: 30px; 
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 180px; /**because the bezier path is off somehow...**/
.dot {
  background-color: #ffff66;
  border-radius: 50%;
  position: absolute;
  display: none;

p {
  color: #ccc;

.markSpot {
  top: 525px;
  width: 50px;
	height: 50px;
	background: red;

button {
  text-align: center;
  color: #000;
  background: #ADD8E6;
  width: 250px;
  position: absolute;
  font-family: Arial, sans-serif;



                //Path 1

var bezierTween,
    play = document.getElementById("play"),

//grabbing container of particle animation and setting it to a bexier path
bezierTween = new TweenMax("#emitter", 10, {
      values:[{x:335, y:118},{x:270, y:-184},{x:285, y:-535},{x:631, y:-555},{x:686, y:-217},{x:420, y:-468},{x:612, y:-490},{x:710, y:-312},{x:458, y:-476},{x:656, y:-430},{x:597, y:-308},{x:534, y:-446},{x:788, y:-708}],
  //reverse it 

  ease:Linear.easeNone, repeat:0});

play.onclick = function(){
  $(".dot").show();, 7, {timeScale:2.5, onComplete:fadeSparkles});

//particle animation with dots defined by css .dot
var emitter = document.getElementById("emitter"),
    //the following variables make things configurable. Play around.
    emitterSize = 45,
    dotPool = [],
    dotIndex = 0,
    dotQuantity = 1250,
    dotSizeMax = 8,
    dotSizeMin = 1,
    speed = -1,
    gravity = 0;

//emitter's size dynamic and set xPercent/yPercent to -50 to accurately center it.
TweenLite.set(emitter, { width:emitterSize, height:emitterSize, xPercent:-50, yPercent:-50 });

for (var i = dotQuantity - 1; i >= 0; i--) {
  dot = document.createElement("div");
  dot.className = "dot";
  TweenLite.set(dot, { xPercent:-50, yPercent:-50, force3D:true });
  dotPool[i] = dot;

var explosion = new TimelineMax({ repeat: -1 }).call(shootDot, [emitter], null, 2 / dotQuantity);

function shootDot(emitter) {
  var angle, length, dot, i, size, bounds = emitter.getBoundingClientRect();;
  //create all the dots
  dot = dotPool[dotIndex++];
  if (dotIndex === dotQuantity) dotIndex = 0;
  size = getRandom(dotSizeMin, dotSizeMax);
  angle = Math.random() * Math.PI * 2; //random angle
  //figure out the maximum distance from the center, factoring in the size of the dot (it must never go outside the circle), and then pick a random spot along that length where we'll plot the point. 
  length = Math.random() * (emitterSize / 2 - size / 2); 
  //place the dot at a random spot within the emitter, and set its size.
  TweenLite.set(dot, {
    x:Math.cos(angle) * length + bounds.left + bounds.width / 2,
    y:Math.sin(angle) * length + + bounds.height / 2,
  //this is where we do the animation..., 1 + Math.random(), {


    //if you'd rather not do physics, you could just animate out directly by using the following 2 lines instead of the physics2D:
    //x:Math.cos(angle) * length * 6, 
    //y:Math.sin(angle) * length * 6
  }, 0);

function getRandom(min, max) {
  return min + Math.random() * (max - min);

//fade sparkles at end of animation
function fadeSparkles() {