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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


                <main id="app" class="helvetica fw3">
  <div class="w-80 center dark-gray ba pa4 mt4 mb4">
    <h1 class="f1 dark-gray fw2 bb">CSS Animation Loops</h1>
    <p>While creating a few animations, I realized there was no good way to add a delay in between infinite loops of animations. I found a solution <a class="b blue link" href="">[here]</a>, but it's cumbersome to do by hand each time. So in the spirit of computer science, I automated it.</p>
    <div id="input" class="mt4">
      <input type="number" class="w-10 h2" name="loop" v-model.number="loop"/>
      <label for="loop">animation length (in seconds)</label>
      <input type="number" class="w-10 h2" name="delay" v-model.number="delay"/>
      <label for="delay">delay (in seconds)</label>
      <div class="mt3">
        @keyframes <input type="text" class="h2" v-model="name"/> {
        <div class="db mt2" v-for="(item, i) in pcts" key="i">
                 class="w-10 h2"/>% {
                    class="w-50 h2 v-btm"
          </textarea> }
        <button class="br-pill mt2 db" @click="addRow">+</button>
    <div id="output" class="mt4">
      <h2 class="f2 fw2 bb mb4">Output</h2>
animation: {{name}} {{animationLength}}s ease infinite;

@keyframes {{name}} {




                const app = new Vue({
  el: '#app',
  data: {
    loop: 1,
    delay: 4,
    name: 'my-animation',
    pcts: [
      {pct: 50, props: 'opacity: 0;'},
      {pct: 100, props: 'opacity: 1;'}
  computed: {
    animationLength() {
      return this.loop + this.delay
    animationSquishFactor() {
      return this.loop / this.animationLength
    stringOutput() {
      let str = ''
      for(let i = 0; i < this.pcts.length; i++) {
        const row = this.pcts[i];
        str = str + `\n  ${this.squishTime(row.pct)}% {${row.props}}\n`
      return str
  methods: {
    addRow() {
      this.pcts.push({pct: 0, props:''})
    squishTime(pct) {
      const number = pct * this.animationSquishFactor
      return number.toFixed(2)
/** Possible enhancements:
  1. Parse copied keyframes
  2. Drag/reorder keyframe