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.


  <select id="iterations">
    <option selected>8</option>
  <select id="keyframes">
    <option value="0">Original</option>
    <option value="1">Alternate</option>
  <p>For full support, please try a browser that supports the <span id="waapi-supported">Web Animations API</span>, <span id="composite-supported"><code>composite</code> property</span>, <span id="iteration-composite-supported"><code>iterationComposite</code> property</span>, and <span id="set-keyframes-supported"><code>setKeyframes()</code> function</span>, 
              div {
  border: 1vmin solid hsl(var(--hue, 153), 90%, 54%);
  border-radius: 50%;
  width: 5vmin;
  height: 5vmin;
  transform: translateX(-5vmin);
  transform-origin: 0% 50%;

body {
  min-height: 100vh;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  overflow: hidden;
  background: #16161c;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
*, *::before, *::after {
  box-sizing: border-box;

form {
  position: absolute;
  padding: 1rem;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  color: #fafbff;
label {
  padding-right: .5rem;
  font-size: .875rem;
select:not(:last-of-type) {
  margin-right: 2rem;
form p {
  width: 100%;
  padding: 1rem;
  text-align: center;
  line-height: 1.44;
form p span {
  border-bottom: .2rem solid hsl(343, 100%, 56%);
.waapi-supported #waapi-supported,
.composite-supported #composite-supported,
.iteration-composite-supported #iteration-composite-supported,
.set-keyframes-supported #set-keyframes-supported {
  border-color: hsl(163, 100%, 56%);
              const div = document.querySelector('div');
const count = 8;
const iterationKeyframes = [
  { transform: 'translateY(0vh)' },
  { transform: 'translateY(0vh)' },
  { transform: 'translateY(-20vh)' },
  { transform: 'translateY(-9vh)' },
  { transform: 'translateY(-9vh)' },

if (div.animate) {
  var iterations = div.animate(iterationKeyframes, {
    duration: 1000,
    iterations: count,
    direction: 'normal',
    fill: 'both',
    easing: 'ease-in-out',
    composite: 'add', //take into account the transform applied in CSS
    iterationComposite: 'accumulate' //each iteration will build on the last
  var horizontal = div.animate({
    transform: [
      'translateX(calc(100vw + 5vmin))'
  }, {
    duration: 1000,
    iterations: count,
    fill: 'both',
    easing: 'linear',
    composite: 'add' //take into account `transform` supplied in CSS and previous WAAPI animation
  checkSupport(iterations, horizontal);
  iterations.onfinish = () => {

document.getElementById('iterations').addEventListener('change', e => {
  let value = parseFloat(e.currentTarget.value);
  if (iterations.effect.updateTiming) {
    iterations.effect.updateTiming({iterations: value});
    horizontal.effect.updateTiming({iterations: value});
  } else {
    iterations.effect.timing.iterations = value;
    horizontal.effect.timing.iterations = value;

const newBetterKeyframes = [
  { transform: 'translateY(0vh)' },
  { transform: 'translateY(0vh) scale(.5)' },
  { transform: 'translateY(10vh) scale(.5)' },
  { transform: 'translateY(-9vh) scale(.7)' },
  { transform: 'translateY(-9vh)' },
document.getElementById('keyframes').addEventListener('change', e => {
  let value = e.currentTarget.value;
  if (value == 1) {
  } else {

function checkSupport(anim1, anim2) {
  if (anim1 && anim1.effect && anim1.effect.composite === 'add') {
  if (anim1 && anim1.effect && anim1.effect.iterationComposite === 'accumulate') {
  if (anim1 && anim1.effect && typeof anim1.effect.setKeyframes === 'function') {
🕑 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 ..................