<label class="debug">
  <input id="debug" type="checkbox">
  Debug
</label>
<div class="grid">
  <div class="menu cross menu--1">
    <label>
      <input type="checkbox">
      <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
        <circle cx="50" cy="50" r="30" />
        <path class="line--1" d="M0 40h62c13 0 6 28-4 18L35 35" />
        <path class="line--2" d="M0 50h70" />
        <path class="line--3" d="M0 60h62c13 0 6-28-4-18L35 65" />
      </svg>
    </label>
  </div>
  <div class="menu cross menu--2">
    <label>
      <input type="checkbox">
      <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
        <circle cx="50" cy="50" r="30" />
        <path class="line--1" d="M0 70l28-28c2-2 2-2 7-2h64" />
        <path class="line--2" d="M0 50h99" />
        <path class="line--3" d="M0 30l28 28c2 2 2 2 7 2h64" />
      </svg>
    </label>
  </div>
  <div class="menu back menu--3">
    <label>
      <input type="checkbox">
      <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
        <circle cx="50" cy="50" r="30" />
        <path class="line--1" d="M0 40h62c18 0 18-20-17 5L31 55" />
        <path class="line--2" d="M0 50h80" />
        <path class="line--3" d="M0 60h62c18 0 18 20-17-5L31 45" />
      </svg>
    </label>
  </div>
  <div class="menu back menu--4">
    <label>
      <input type="checkbox">
      <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
        <circle cx="50" cy="50" r="30" />
        <path class="line--1" d="M0 55l14-10c4.7-3.3 9-5 13-5h72" />
        <path class="line--2" d="M0 50h99" />
        <path class="line--3" d="M0 45l14 10c4.7 3.3 9 5 13 5h72" />
      </svg>
    </label>
  </div>
</div>


<!-- dribbble - twitter -->
<a class="dribbble" href="https://dribbble.com/TaminoMartinius" target="_blank">
  <img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""/>
</a>
<a class="twitter" target="_top" href="https://twitter.com/TaminoMartinius">
  <svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72">
    <path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"/>
  </svg>    
</a>
@use postcss-nested;
html,
body {
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  background-color: #121314;
}

input {
  display: none;
}

.grid {
  display: grid;
  grid-template-rows: 1fr 1fr;
  grid-template-columns: 1fr 1fr;
  width: 100vw;
  height: 100vh;
  position: absolute;
}

.grid>* {
  position: relative;
}

label {
  display: block;
  cursor: pointer;
  position: absolute;
  width: 50vw;
  height: 50vw;
  max-width: 150px;
  max-height: 150px;
}

@media (min-aspect-ratio: 1/1) {
  label {
    width: 50vh;
    height: 50vh;
  }
}

.menu--1 label,
.menu--2 label {
  bottom: 0;
}

.menu--3 label,
.menu--4 label {
  top: 0;
}

.menu--1 label,
.menu--3 label {
  right: 0;
}

.menu--2 label,
.menu--4 label {
  left: 0;
}

path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  --length: 24;
  --offset: -38;
  stroke-dasharray: var(--length) var(--total-length);
  stroke-dashoffset: var(--offset);
  transition: all .8s cubic-bezier(.645, .045, .355, 1);
}

circle {
  fill: #fff3;
  opacity: 0;
}

label:hover circle {
  opacity: 1;
}

.cross input:checked+svg {
  .line--1,
  .line--3 {
    --length: 22.627416998;
  }
  .line--2 {
    --length: 0;
  }
}

.back input:checked+svg {
  .line--1,
  .line--3 {
    --length: 8.602325267;
  }
}

.menu--1 {
  background-color: #3f77e9;
  .line--1,
  .line--3 {
    --total-length: 126.64183044433594;
  }
  .line--2 {
    --total-length: 70;
  }
  input:checked+svg {
    .line--1,
    .line--3 {
      --offset: -94.1149185097;
    }
    .line--2 {
      --offset: -50;
    }
  }
}

.menu--2 {
  background-color: #0095f9;
  .line--1,
  .line--3 {
    --total-length: 111.22813415527344;
    --offset: -50.22813415527344;
  }
  .line--2 {
    --total-length: 99;
  }
  input:checked+svg {
    path {
      transform: translateX(30px);
    }
    .line--1,
    .line--3 {
      --offset: -16.9705627485;
    }
    .line--2 {
      --offset: -20;
    }
  }
}

.menu--3 {
  background-color: #00aef6;
  .line--1,
  .line--3 {
    --total-length: 126.38166809082031;
  }
  .line--2 {
    --total-length: 80;
  }
  input:checked+svg {
    .line--1,
    .line--3 {
      --offset: -109.1770175568;
    }
  }
}

.menu--4 {
  background-color: #18bee5;
  .line--1,
  .line--3 {
    --total-length: 103.35061645507812;
    --offset: -42.35061645507812;
  }
  .line--2 {
    --total-length: 99;
  }
  input:checked+svg {
    path {
      transform: translateX(31px);
    }
    .line--1,
    .line--3 {
      --offset: -8.602325267;
    }
    .line--2 {
      --offset: -7;
    }
  }
}

.debug {
  display: none;
}

.line--debug {
  opacity: 0;
  stroke-dasharray: none;
}

@media screen and (min-width: 800px) {
  .debug {
    opacity: 0.8;
    display: block;
    position: absolute;
    z-index: 1;
    font-family: sans-serif;
    transform: rotate(-45deg);
    transform-origin: 0% 100%;
    background: #000;
    color: #fff;
    width: 150px;
    height: 100px;
    line-height: 150px;
    text-align: center;
    user-select: none;
    &:hover {
      opacity: 1;
    }
    &.active {
      background: #fff;
      color: #000;
    }
  }

  .debug.active+.grid path.line--debug {
    opacity: .2;
  }
}


/* dribbble - twitter */
.dribbble {
  position: fixed;
  display: block;
  right: 20px;
  bottom: 20px;
  img {
    display: block;
    height: 28px;
  }
}
.twitter {
  position: fixed;
  display: block;
  right: 64px;
  bottom: 14px;
  svg {
    width: 32px;
    height: 32px;
    path {    
      fill: #1da1f2;
      stroke: none;
    }
  }
}
View Compiled
Array.from(document.getElementsByTagName('path')).map(path => {
  console.log(path.getTotalLength());
  const debugPath = path.cloneNode();
  debugPath.classList.add('line--debug');
  if (path.parentNode) path.parentNode.insertBefore(debugPath.cloneNode(), path);
});
const debugCheckbox = document.getElementById('debug');
debugCheckbox.addEventListener('change', () => {
  if (debugCheckbox.checked) {
    debugCheckbox.parentElement.classList.add('active');
  } else {
    debugCheckbox.parentElement.classList.remove('active');
  }
});
let currentActive = 0;
const checkboxes = document.querySelectorAll('.grid input');
const autoShow = setInterval(() => {
  checkboxes[currentActive % 4].checked = !checkboxes[currentActive % 4].checked;
  if (!checkboxes[currentActive % 4].checked) currentActive += 1;
}, 1000);
document.querySelector('.grid').addEventListener('click', () => {
  clearInterval(autoShow);
})
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.