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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <body class="is-home">
  <div class="gravitons">
    <div class="is-wrapper"></div>
    <div class="is-mass bg-innovation"></div>
  </div>
  <svg height="0" width="0" border="0" style="position:absolute" version="1.1">
    <defs>
      <filter id="home_gooey">
        <feGaussianBlur in="SourceGraphic" stdDeviation="5" result="blur"></feGaussianBlur>
        <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 20 -10" result="home_gooey"></feColorMatrix>
        <feComposite in="SourceGraphic" in2="home_gooey" operator="atop"></feComposite>
      </filter>
    </defs>
  </svg>

  <div class="app-wrapper">
    <div class="app-content">
      <header class="header" style="">

        <div class="container is-full">
          <div class="row">
            <div class="header-impact">
              <h1>Hello World !</h1>
            </div>
          </div>
        </div>

      </header>
    </div>
  </div>
</body>
              
            
!

CSS

              
                body {
  padding: 0;
  margin: 0;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-wrapper {
  position: relative;
  min-height: 100%;
}
.app-content {
  min-height: 100%;
}

.header {
  height: 460px;
  width: 100%;
  position: relative;
  background-image: linear-gradient(0deg, #5034FF 0%, #9F48FF 100%)
}

.header .header-impact {
  margin-top: 100px;
  position: relative;
  text-align: left;
  max-width: 710px;
  z-index: 10;
  color: #FFFFFF;
}

.bg-food {
  background-image: linear-gradient(133deg, #FF0090 0%, #E89721 100%) !important;
}
.bg-innovation {
  background-image: linear-gradient(133deg, #1300FF 0%, #002341 100%) !important;
}

.bg-retail {
  background-image: linear-gradient(45deg, #00B2FF 0%, #3DF58D 100%) !important;
}

.bg-fashion {
  background-image: linear-gradient(45deg, #4C00FF 0%, #8F006D 100%) !important;
}
.bg-sport {
  background-image: linear-gradient(45deg, #00E0E6 0%, #002B88 100%) !important;
}

.gravitons {
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
  z-index: 10;
  height: 500px;
  -webkit-filter: url("#home_gooey");
  filter: url("#home_gooey");
  overflow: hidden;
}

.gravitons.is-removing {
  -webkit-filter: none;
  filter: none;
}

.gravitons .is-wrapper {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 40px;
  background-color: #fff;
  z-index: 3;
}

.gravitons .is-mass,
.gravitons .is-atom {
  position: absolute;
  bottom: 10px;
  display: block;
  border-radius: 666px;
}

.gravitons .is-mass {
  z-index: 2;
  right: 15vw;
  width: 30px;
  height: 30px;
}

.gravitons .is-atom {
  z-index: 1;
  width: 15px;
  height: 15px;
  background-image: linear-gradient(0deg, #fff 0%, #fff 100%);
}
              
            
!

JS

              
                var isSafari = false;
/*
*   Gravity
*   Jquery Plugin to make some beautiful graviton
*   by peacepostman @ potion
 */
(function ( $ ) {

    $.fn.gravity = function( options ) {

        //  Options
        //
        //
        var settings = $.extend({
            particles: options.particles ? options.particles : 10,
            distance: options.distance ? options.distance : -300,
            massDuration: options.massDuration ? options.massDuration : 8,
            atomDuration: options.atomDuration ? options.atomDuration : 6,
            duration: options.duration ? options.duration : 10,
            types: options.types ? options.types : ['bg-primary'],
        }, options );

        var container = this,
            currentMassClass = 0,
            currentMassScale = 1,
            currentParticleNumber = 0,
            infiniteMassScale = false,
            realDuration = (settings.duration + settings.massDuration + settings.atomDuration),
            header = $('.header'),
            massDistance = settings.distance,
            massInstance,
            massFromLeft;


        //  Boot animation
        //
        function boot() {
          massInstance = $('<div class="is-mass"></div>').addClass(setMassClass());
          container.append(massInstance);
          moveMass(massInstance);
        }

        //  Reboot
        //
        function reboot () {
          infiniteMassScale = false;
          currentMassScale = 1;
          currentParticleNumber = 0;
          if (currentMassClass === (settings.types.length - 1)) {
            currentMassClass = 0;
          } else {
            currentMassClass++;
          }
          massDistance = settings.distance;
          massInstance.remove();
          container.removeClass('is-removing');
          boot();
        }

        //  Move mass and return final position
        //  Will trigger bootAtoms()
        //
        function moveMass(elem) {
          TweenLite.set(elem, {scale:1, force3D:false});
          TweenLite.to(elem, settings.massDuration, {
            ease: CustomEase.create("custom", "M0,0,C0.664,0.012,0.658,0.318,0.716,0.554,0.793,0.871,0.908,0.948,1,1"),
            y: settings.distance,
            force3D: false,
            x: 0,
            onComplete: function(){
              massFromLeft = parseFloat(elem.position().left + 5).toFixed(2);
              bootAtoms();
              setTimeout(function(){
                growMass();
              }, (settings.massDuration - 2.5) * 1000);
            }
          });
        }

        //  Return class for mass element
        //
        function setMassClass() {
          return 'bg-'+settings.types[currentMassClass];
        }

        //  Return class for mass element
        //
        function removeHeaderClass() {
          var classe = '';
          $.each(settings.types, function(i, item){
            classe = classe + ' bg-' + item;
          });
          return classe;
        }

        //  Will grow mass per fraction or infinitly
        //
        function growMass () {

          function killMassOnComplete(){
            this.kill();
            reboot();
          }

          var tl = new TimelineLite({onComplete:killMassOnComplete});
          tl.set(massInstance, {scale: 1, force3D:false, opacity:1})
            .to(massInstance, (realDuration - (settings.massDuration)), {scale: 30, force3D:false, ease: Power0.easeNone})
            .call(function(){
              container.addClass('is-removing');
            })
            .to(massInstance, ((realDuration - (settings.massDuration/2)) / 3), {scale: 100, force3D:false, ease: CustomEase.create("custom", "M0,0,C0.254,0.04,0.872,0.614,1,1")}, "-=2")
            .call(function(){
              header.removeClass(removeHeaderClass()).addClass(setMassClass());
            })
            .to(massInstance, 3, {opacity: 0, ease: Power1.easeIn, force3D:false});
        }

        //  Gradually boot atoms untils total total atom and time match
        //
        function bootAtoms () {
          for (var i = 0; i <= settings.particles; ++i) {
              setTimeout(function(){
                bootAtom();
              }, ((realDuration / (settings.particles * 1.5)) * (i * 1000)));
          }
        }

        //  Boot an atom and apply move()
        //
        function bootAtom() {
          currentParticleNumber++;
          massDistance = massDistance + (currentParticleNumber === 1 ? 0 : 5);
          var atomInstance = $('<div class="is-atom"></div>').attr('id', 'atom-'+currentParticleNumber).css(setPositionAtom());
          container.append(atomInstance);
          moveAtom(atomInstance);
        }

        //  Set a random position to an atom
        //
        function setPositionAtom () {

          function randomNumber(min,max){
            return Math.floor(Math.random()*(max-min+1)+min);
          }

          var value = parseFloat(massFromLeft) + randomNumber(-300, 300);
          return {'left': value};
        }

        //  Move atom to mass center
        //
        function moveAtom (elem) {
          TweenLite.to(elem, settings.atomDuration, {
            ease: CustomEase.create("custom", "M0,0,C0.682,0.018,0.751,0.501,0.8,0.672,0.89,0.986,0.91,1.024,1,1"),
            y: massDistance,
            left: massFromLeft,
            onComplete: function(){
              this.kill();
              elem.remove();
            }
          });
        }

        //  Execute
        //
        if (!isSafari) {
          return boot();
        }

    };

}(jQuery));

var gravityTypes = JSON.parse('["home","verticals","retail","sport","fashion","innovation","food"]').reverse();

$('.gravitons').gravity({
  particles: 60,
  duration: 16,
  distance: -385,
  massDuration: 8,
  atomDuration: 6,
  types: gravityTypes
});

              
            
!
999px

Console