title: CSS Animation changing height is jittering
body: <p>I'm trying to make an animation for drawing a square border on hover.</p>
  <p>It's working fine but when drawing the left side of the border the bottom of the border is jittering</p>
  <p>Here's a link to the codepen <a href="https://codepen.io/Taggagii/pen/GRxYpXY" rel="nofollow noreferrer">https://codepen.io/Taggagii/pen/GRxYpXY</a> to see the code and the jittering that's happening.</p>
  <p>My approach is to just animate the <code>::before</code> element to render the top and right sides and the <code>::after</code> element to render the bottom and left sides. To animate both of them I'm just modifying their <code>width</code> and <code>height</code> attributes so it doesn't really make sense to me that only the bottom is jittery and not all the sides.</p>
  <p><strong>Note</strong>: This issue is present on Chrome but <strong>not</strong> on Firefox</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html {
    background: #f58442;
  }
  
  .center {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
  }
  
  .border-renderer {
    --border-size: 1px;
    --animation-duration: 4s;
    --border-z-index: -1;
    --border-color: black;
    --second-border-final-extent: calc(100% + 2 * var(--border-size));
    --first-border-final-extent: calc(100% + var(--border-size));
    --size: 200px;
    position: relative;
    display: inline-block;
    background: #ccba87;
    padding: 10px;
    font-size: 5em;
    margin-left: 35vw;
    margin-top: 40vh;
  }
  
  .border-renderer::before,
  .border-renderer::after {
    content: '';
    background: var(--border-color);
    position: absolute;
    z-index: var(--border-z-index);
  }
  
  .border-renderer::before {
    top: calc(-1 * var(--border-size));
    left: 0;
  }
  
  .border-renderer::after {
    top: var(--first-border-final-extent);
    right: calc(-1 * var(--border-size));
    transform: translateY(-100%);
  }
  
  .border-renderer:hover::before {
    animation-name: draw-box-top-right;
    animation-duration: calc(var(--animation-duration) / 2);
    animation-timing-function: ease;
    animation-fill-mode: forwards;
  }
  
  .border-renderer:hover::after {
    animation-name: draw-box-bottom-left;
    animation-duration: calc(var(--animation-duration) / 2);
    animation-delay: calc(var(--animation-duration) / 2);
    animation-timing-function: ease;
    animation-fill-mode: forwards;
  }
  
  @keyframes draw-box-top-right {
    0% {
      width: 0%;
      height: var(--border-size);
    }
    50% {
      width: var(--first-border-final-extent);
      height: var(--border-size);
    }
    100% {
      width: var(--first-border-final-extent);
      height: var(--first-border-final-extent);
    }
  }
  
  @keyframes draw-box-bottom-left {
    0% {
      width: var(--border-size);
      height: var(--border-size);
    }
    50% {
      width: var(--second-border-final-extent);
      height: var(--border-size);
    }
    100% {
      width: var(--second-border-final-extent);
      height: var(--second-border-final-extent);
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="holder"&gt;
    &lt;div class="border-renderer"&gt;
      &lt;div class="center"&gt;Mouse over me&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>