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

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

              
                <svg id="Robot_master" class="c-robot" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 120">
  <ellipse id="Shadow" class="c-robot__shadow" cx="49.88" cy="118" rx="18" ry="2" />
  <g id="Robot">
    <g id="Torso">
      <path id="Arm-right" d="M96.33,63.36a1.5,1.5,0,0,0-2-.54,5.17,5.17,0,0,1-3.41.67,2.95,2.95,0,0,1-2.38-4.13,5.15,5.15,0,0,1,2.29-2.61,1.5,1.5,0,1,0-1.5-2.59,8,8,0,0,0-3.6,4.17,6.25,6.25,0,0,0-.3,3.48c-6.79,2.82-13.8,2.22-19.71.51A20.56,20.56,0,0,1,67.93,66a35.74,35.74,0,0,0,7.3.79,29.15,29.15,0,0,0,11.5-2.29,6.24,6.24,0,0,0,3.63,2,7.77,7.77,0,0,0,1.27.1,8.35,8.35,0,0,0,4.15-1.14A1.51,1.51,0,0,0,96.33,63.36Z" transform="translate(0 0)" />
      <g id="Body">
        <g id="Rocket">
          <path id="Fire" d="M44.88,100.45c-2,2-3,6-3,6l4-2,4,10,4-10,4,2s-1-4-3-6a7.26,7.26,0,0,0-10,0Z" transform="translate(0 0)" />
          <path id="Pipe" d="M41.06,94.55a3,3,0,0,0,2.82,2h12a3,3,0,0,0,2.81-2Z" transform="translate(0 0)" />
        </g>
        <path id="Belly" d="M52.88,56.82V54.55h-6v2.27a18,18,0,0,0-15,17.73v14a4,4,0,0,0,4,4h28a4,4,0,0,0,4-4v-14A18,18,0,0,0,52.88,56.82Zm-.27,26.29-1.64,1a2.2,2.2,0,0,1-2.19,0l-1.63-1V80l2.73,1.51L52.61,80Zm5.27-4.3a2.18,2.18,0,0,1-1.1,1.89l-1,.59V72.47a.47.47,0,0,0-.71-.41L49.88,75l-5.19-2.92a.47.47,0,0,0-.71.41v8.82l-1-.59a2.17,2.17,0,0,1-1.09-1.89V72.1A2.18,2.18,0,0,1,43,70.2l5.81-3.36a2.2,2.2,0,0,1,2.19,0l5.81,3.36a2.18,2.18,0,0,1,1.1,1.9Z" transform="translate(0 0)" />
      </g>
      <path id="Arm-left" d="M35.35,60.58C26.41,64.33,20,70.15,16.78,77.47c-3.08-.27-6.17,2-7.24,5.5a1.5,1.5,0,1,0,2.87.87c.72-2.37,2.81-3.84,4.66-3.28s2.76,3,2,5.33a1.5,1.5,0,0,0,1,1.87,1.31,1.31,0,0,0,.44.07A1.51,1.51,0,0,0,22,86.77a7.43,7.43,0,0,0-2.37-8.25A28.65,28.65,0,0,1,32,65.58a20,20,0,0,1,3.71-5.16Z" transform="translate(0 0)" />
    </g>
    <g id="Head">
      <path id="Face" d="M72.91,20.5h-44a4,4,0,0,0-4,4v24a4,4,0,0,0,4,4h44a4,4,0,0,0,4-4v-24A4,4,0,0,0,72.91,20.5Zm-29,26h-2v-2h2Zm4,0h-2v-2h2Zm4,0h-2v-2h2Zm-15-8a6,6,0,0,1,0-12h19l-4,12Zm19,8h-2v-2h2Zm4,0h-2v-2h2Zm-4-8h-2l4-12h2Zm13.24-1.76a5.94,5.94,0,0,1-4.24,1.76h-4l4-12a6,6,0,0,1,6,6A5.94,5.94,0,0,1,69.15,36.74Z" transform="translate(0 0)" />
      <path id="Ear-right" d="M78.91,32.62h0a4,4,0,0,1,4,4h0a4,4,0,0,1-4,4h0v-8Z" transform="translate(0 0)" />
      <path id="Ear-left" d="M22.91,32.53h0v8h0a4,4,0,0,1-4-4h0A4,4,0,0,1,22.91,32.53Z" transform="translate(0 0)" />
      <g id="Top">
        <path id="Antenna-left" d="M40.91,10.5a4,4,0,1,0-5,3.86V18.5h2V14.36A4,4,0,0,0,40.91,10.5Z" transform="translate(0 0)" />
        <path id="Antenna-right" d="M68.91,10.5a4,4,0,1,0-5,3.86V18.5h2V14.36A4,4,0,0,0,68.91,10.5Z" transform="translate(0 0)" />
        <path id="Signal" d="M52.91,15.5A1,1,0,0,1,52,15l-3.1-6.21L47.8,11a1,1,0,0,1-.89.55h-2a1,1,0,0,1,0-2h1.38L48,6.05a1,1,0,0,1,1.79,0l3.11,6.22L54,10.05a1,1,0,0,1,.9-.55h2a1,1,0,0,1,0,2H55.53L53.8,15A1,1,0,0,1,52.91,15.5Z" transform="translate(0 0)" />
      </g>
    </g>
  </g>
</svg>
<div class="c-controls">
  <button class="o-button-reset c-controls__button c-controls__button--pause js-pause" aria-label="toggle play or pause">
    <svg class="c-play-icon c-play-icon--play" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path d="M4.5 12.5v-10l7 5-7 5z" stroke="currentColor" stroke-linejoin="round"></path>
    </svg>
    <svg class="c-play-icon c-play-icon--pause" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path d="M5.5 3v9m4-9v9" stroke="currentColor"></path>
    </svg>
  </button>

  <ul class="o-list-reset c-controls__list">
    <li>
      <input class="o-hide-accessible c-controls__radio js-fast" type="radio" id="speedFast" name="speed" />
      <label class="c-controls__button" for="speedFast">Fast</label>
    </li>
    <li>
      <input class="o-hide-accessible c-controls__radio js-normal" type="radio" id="speedNormal" name="speed" checked />
      <label class="c-controls__button" for="speedNormal">Normal</label>
    </li>
    <li>
      <input class="o-hide-accessible c-controls__radio js-slow" type="radio" id="speedSlow" name="speed" />
      <label class="c-controls__button" for="speedSlow">Slow</label>
    </li>
  </ul>
</div>
              
            
!

CSS

              
                /*------------------------------------*\
#FONTS
\*------------------------------------*/

/*------------------------------------*\
#Variables
\*------------------------------------*/

:root {
  /* Global colors */
  --global-color-back: #6dbedf;
  --global-color-front: white;

  /* global page settings */
  --global-html-color: var(--global-color-front);
  --global-html-backgroundColor: var(--global-color-back);
  --global-selection-backgroundColor: var(--global-color-front);
}

/*------------------------------------*\
#GENERIC
\*------------------------------------*/

/*
    Generic: Page
    ---
    Global page styles + universal box-sizing:
*/

html {
  background-color: var(--global-html-backgroundColor);
  color: var(--global-html-color);
  font-size: 16px;
  line-height: 1.5;
  font-family: sans-serif;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(auto, 350px);
  gap: 2rem;
  justify-content: center;
  align-content: center;
  padding: 2rem;
}

/*
* Remove text-shadow in selection highlight:
* https://twitter.com/miketaylr/status/12228805301
*
* Customize the background color to match your design.
*/

::selection {
  background: var(--global-selection-backgroundColor);
  color: white;
  text-shadow: none;
}

/*------------------------------------*\
#Elements
\*------------------------------------*/

/*------------------------------------*\
#OBJECTS
\*------------------------------------*/

/*
    Objects: List
    ---
    Small reusable object to remove default list styling from lists
*/

.o-list-reset {
  list-style: none;
  padding: 0;
  margin: 0;
}

/*
    Object: Button reset
    ---
    Small button reset object
*/

.o-button-reset {
  border: none;
  margin: 0;
  padding: 0;
  width: auto;
  overflow: visible;
  background: transparent;

  /* inherit font & color from ancestor */
  color: inherit;
  font: inherit;

  /* Normalize `line-height`. Cannot be changed from `normal` in Firefox 4+. */
  line-height: normal;

  /* Corrects font smoothing for webkit */
  -webkit-font-smoothing: inherit;
  -moz-osx-font-smoothing: inherit;

  /* Corrects inability to style clickable `input` types in iOS */
  -webkit-appearance: none;
}

/*
    Object: Hide accessible
    ---
    Accessibly hide any element
*/

.o-hide-accessible {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/*------------------------------------*\
#COMPONENTS
\*------------------------------------*/

/*
    Component: Robot
*/

.c-robot {
  fill: var(--global-color-front);
}

.c-robot__shadow {
  fill: var(--c-robot__shadow-color, black);
  opacity: 0.1;
}

.c-controls {
  --c-controls-button-bgcolor: hsl(0 0% 0% / 0.1);
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.c-controls__list {
  display: flex;
}

.c-controls__button {
  display: inline-block;
  transition: all 0.1s ease-in-out;
  font-family: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono",
    "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro",
    "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
  font-size: 14px;
  line-height: 1rem;
  text-transform: uppercase;
  /* padding: 0.5rem 0.75rem; */
  padding: 0.5rem 1rem;
  /* border-radius: 0.25rem; */
  border-radius: 1rem;
}

.c-controls__button--pause {
  background-color: var(--c-controls-button-bgcolor);
  border-radius: 2em;
  padding: 0.5rem;
}

.c-play-icon {
  display: block;
  width: 1rem;
}

.c-controls__radio:active + .c-controls__button,
.c-controls__button:active {
  transform: scale(0.9);
}

.c-controls__radio:focus + .c-controls__button,
.c-controls__button:focus {
  outline: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.c-controls__radio:focus:not(:focus-visible) + .c-controls__button,
.c-controls__button:focus:not(:focus-visible) {
  box-shadow: none;
}

/* .c-controls__radio + .c-controls__button {
  opacity: 0.75;
} */

.c-controls__radio:checked + .c-controls__button {
  opacity: 1;
  background-color: var(--c-controls-button-bgcolor);
  transform: none;
}

.c-play-icon--play {
  display: none;
}

.is-paused .c-play-icon--play {
  display: block;
}

.is-paused .c-play-icon--pause {
  display: none;
}

              
            
!

JS

              
                let tl = gsap.timeline({
  defaults: {
    duration: 0.75,
    ease: "power2.inOut",
    yoyoEase: "sine.out"
  },
  repeat: -1,
  yoyo: true
});

tl.set("#Shadow", {
  transformOrigin: "50% 100%"
})
  .set("#Fire", {
    transformOrigin: "50% 0%"
  })
  .set("#Arm-left", {
    transformOrigin: "100% 0%"
  })
  .set("#Arm-right", {
    transformOrigin: "0% 0%"
  })
  .fromTo(
    "#Robot",
    {
      y: 2.5
    },
    {
      y: -5
    }
  )
  .to(
    "#Shadow",
    {
      scale: 0.75
    },
    "<"
  )
  .to(
    "#Head",
    {
      y: 1,
      yoyoEase: "power3.out"
    },
    "<"
  )
  .to(
    "#Arm-left",
    {
      rotate: -3,
      yoyoEase: "power3.out"
    },
    "<"
  )
  .to(
    "#Arm-right",
    {
      rotate: 3,
      yoyoEase: "power3.out"
    },
    "<"
  )
  .to(
    "#Fire",
    {
      scale: 1.15,
      ease: "power3.out",
      yoyoEase: "power3.out"
    },
    "<"
  );

var btnPause = document.querySelector(".js-pause");
var btnFast = document.querySelector(".js-fast");
var btnSlow = document.querySelector(".js-slow");
var btnNormal = document.querySelector(".js-normal");

btnPause.onclick = function () {
  tl.paused(!tl.paused());
  btnPause.classList.toggle("is-paused");
};

btnFast.onclick = () => tl.timeScale(2);
btnNormal.onclick = () => tl.timeScale(1);
btnSlow.onclick = () => tl.timeScale(0.5);

              
            
!
999px

Console