cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div id="m0">G</div>
<div id="m1">R</div>
<div id="m2">O</div>
<div id="m3">U</div>
<div id="m4">P</div>
<div id="m4">A</div>
<div>
  <div id="t0">G</div>
  <div id="t1">R</div>
  <div id="t2">O</div>
  <div id="t3">U</div>
  <div id="t4">P</div>
  <div id="t5">B</div>
</div>
<button id="player">Play</button>
            
          
!
            
              body {
  background: #3d6644;
  text-align: center;
}
[id^=m], [id^=t] {
  margin-top: 1rem;
  font-size: 2rem;
  color: #f9f7fb;
  display: inline-block;
}

#player {
  margin-top: 3rem;
  font-size: 1rem;
  appearance: none;
  background: transparent;
  border: 2px solid #f9f7fb;
  color: #f9f7fb;
  padding: .6rem;
  border-radius: .6rem;
  
  &:active {
    transform: scale(.9);
  }
  
  &:disabled {
    opacity: .2;
  }
}
            
          
!
            
              var ms = Array.prototype.slice.call(document.querySelectorAll('[id^=m]'));
var ts = Array.prototype.slice.call(document.querySelectorAll('[id^=t]'));
var keyframeEffects = [];
var keyframeEffects2 = [];

var effects = {
  scalers: [
    { transform: 'scale(1)', offset: 0 },
    { transform: 'scale(.5)', offset: .7 },
    { transform: 'scale(1)', offset: 1 }
  ],
  translations: [
    { transform: 'translateY(0)', offset: 0 },
    { transform: 'translateY(.5rem)', offset: .7 },
    { transform: 'translateY(0)', offset: 1 }
  ],
}
var timing = {
  duration: 1000,
  easing: 'ease-in',
  fill: 'both',
  iterations: 1
}

//Create a KeyframeEffect for each element (this will not kick off any animation)
ms.forEach(function(el, i, ra) {
  var effect = new KeyframeEffect(el, effects.scalers, timing);
  keyframeEffects.push(effect);
});
ts.forEach(function(el, i, ra) {
  effect = new KeyframeEffect(el, effects.translations, timing);
  keyframeEffects2.push(effect);
});

//add the six KeyframeEffects to a GroupEffect, and play it on the doucment timeline
var sEffectA = new SequenceEffect(keyframeEffects);
//var anim = document.timeline.play(groupEffectA);

var sEffectB = new SequenceEffect(keyframeEffects2);
//var anim2 = document.timeline.play(groupEffectB);

var gEffectC = new GroupEffect([sEffectA, sEffectB]);
var anim3 = document.timeline.play(gEffectC);


var btn = document.getElementById('player');

btn.addEventListener('click', function(e) {
  if (anim3.playState !== 'running') {
    anim3.play();
  }
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console