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 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              html, body {
  background: #222;
}

h1 {
  font-family: 'Montserrat', sans-serif;
  text-align: center;
  color: #555;
}
            
          
!
            
              
const dur = 1500,
      dur2 = dur - 500,
      posL = 0,
      posT = 0;

const pos_opts = {
  top: 0,
  left: 0
}

const burst1 = new mojs.Burst({
  ...pos_opts,
  radius:   { 0: 70 },
  count:    12,
  children: {
    shape:      'cross',
    stroke:     { 'cyan' : 'grey' },
    strokeWidth: { 4 : 1 },
    radius:     30,
    angle:      { 360: 0 },
    duration:   dur
  }
});

const burst2 = new mojs.Burst({
  ...pos_opts,
  radius:   { 0: 70 },
  count:    15,
  children: {
    shape:        'zigzag',
    points:       6, 
    fill:         'none',
    stroke:       { 'magenta' : 'grey' },
    strokeWidth:  { 3 : 1 },
    radius:       30,
    angle:        { '-360' : 0 },
    duration:     dur
  }
});

const burst3 = new mojs.Burst({
  ...pos_opts,
  radius:   { 0: 150 },
  count:    8,
  children: {
    shape:        'rect',
    fill:         { 'yellow' : 'grey' },
    radius:       20,
    radiusY:      { 5 : 1 },
    duration:     dur
  }
});

const burst4 = new mojs.Burst({
  ...pos_opts,
  radius:   { 0: 50 },
  angle:    { 70 : 0 },
  children: {
    oapcity:      { 1 : 0 },
    radius:       5,
    duration:     dur2
  }
});

const circ_opts = {
  ...pos_opts,
  shape:    'circle',
  fill:      'none',
  stroke:    { 'yellow' : 'black' },  
  strokeWidth: { 10 : 1},
  duration:  dur2
};

const circ = new mojs.Shape({
  ...pos_opts,
  ...circ_opts,
  radius:   { 0: 150 },
  opacity:    { 1 : 0 }
});

const circ2 = new mojs.Shape({
  ...pos_opts,
  ... circ_opts,
  opacity:    { 0.5 : 0 },
  radius:     { 0: 100 },
  delay: 300
});

const master = new mojs.Timeline()
.add( burst1, burst2, burst3, burst4, circ, circ2 );

var clickHandler = ('ontouchstart' in document.documentElement ? "touchstart" : "click");

document.addEventListener(clickHandler, function(e) {
  const coords = { x: e.pageX, y: e.pageY };
  
  burst1.tune(coords);
  burst2.tune(coords);
  burst3.tune(coords);
  burst4.tune(coords);
  circ.tune(coords);
  circ2.tune(coords);
  
  master.replay();
}, false);
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console