.square
  .sword
    .blade
    .handle
View Compiled
:root {
  --size: 45vmin;
  --dur: 4.2s;
  --ease: cubic-bezier(0.165, 0.84, 0.44, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  animation: bg-color var(--dur) var(--ease) infinite;
}

.sword {
  position: absolute;
  bottom: 25%;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotate(-5deg);
  z-index: 2;
  transform-origin: 0 100%;
  animation: chop var(--dur) var(--ease) infinite;
}

.blade {
  --color-1: #e7e7e7;
  --color-2: #f3f3f3;
  
  width: calc(var(--size) / 5);
  height: calc(var(--size) / 1.25);
  position: relative;
  background-image: linear-gradient(
    to right,
    var(--color-1), var(--color-1) 50%,
    var(--color-2) 50%, var(--color-2) 100%
  );
  box-shadow: inset -1vmin 0 4vmin rgba(black, 0.075);
  clip-path: polygon(50% 0%, 100% 15%, 100% 100%, 0 100%, 0% 15%);
  animation: blade-glow var(--dur) var(--ease) infinite;
}

.handle {
  position: relative;
  width: calc(var(--size) / 8);
  height: calc(var(--size) / 3);
  background-color: #363636;
  border-radius: 0 0 0.5vmin 0.5vmin;
  box-shadow: 
    inset 0 5vmin 2vmin rgba(black, 0.35),
    inset 2.5vmin 0 3vmin rgba(black, 0.35);
  
  &:after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: calc(var(--size) / 2.75);
    height: calc(var(--size) / 20);
    background-color: inherit;
    transform: translateX(-50%);
    box-shadow: inset 1vmin -1vmin 2.5vmin rgba(black, 0.35);
    clip-path: polygon(0 0, 100% 0, 95% 100%, 5% 100%);
  }
}

.square {  
  position: relative;
  width: var(--size);
  height: var(--size);
  perspective: 100vw;
  animation: shake var(--dur) linear infinite;
  
  &:before,
  &:after {
    content: '';
    position: absolute;
    top: 0;
    background-color: dodgerblue;
    width: 100%;
    height: 100%;
    transform: translateX(100vw);
    transform-origin: 0 100%;
  }
  
  &:before {
    clip-path: polygon(26% 0, 76% 100%, 0 100%, 0 0);
    z-index: 1;
    animation: 
      square-left var(--dur) var(--ease) infinite,
      square-color var(--dur) var(--ease) infinite,
      fade-out var(--dur) var(--ease) infinite;
  }
  
  &:after {
    clip-path: polygon(100% 0, 100% 100%, 75% 100%, 25% 0);
    z-index: 3;
    animation:
      square-right var(--dur) var(--ease) infinite,
      square-color var(--dur) var(--ease) infinite,
      fade-out var(--dur) var(--ease) infinite;
  }
}

@keyframes square-left {
  26% { transform: translateX(0); }
  100% { transform: translate(-5%, -5%) rotate(-1deg); }
}

@keyframes square-right {
  26% { transform: translateX(0); }
  100% { transform: translate(5%, 5%) rotate(2deg); }
}

@keyframes fade-out {
  88% { opacity: 1; }
  94%, 100% { opacity: 0; }
}

@keyframes chop {
  25% {
    transform: translate(-10%, -20%) rotate(-15deg);
  }
  26%, 30% {
    transform: translate(5%, 6%) rotate(125deg);
    z-index: 2;
  }
  42%, 80% {
    transform: translate(10%, 5%) rotate(120deg);
    z-index: 4;
  }
  100% {
    z-index: 4;
  }
}

@keyframes bg-color {
  25.25% { background-color: white; }
  25.251%, 88% { background-color: black; }
}

@keyframes square-color {
  25.25% { background-color: dodgerblue; }
  25.251%, 100% { background-color: crimson; }
}

@keyframes shake {
  0%, 25% { filter: blur(0); }
  25.5% { filter: blur(1vmin); }
  26% {
    transform: translateX(-2%);
    filter: blur(0);
  }
  28% { transform: translateX(2%) scale(0.98); }
  29% { transform: translateX(-3%); }
  30% { transform: translateX(1%); }
  31% { transform: translateX(0); }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.