mixin promo(text, cta, color, src)
  .promo(style=`--overlay-color: ${color}`)
    .image-wrapper
      img(src=src)
    h2.title(data-cta=cta)= text

+promo('Nightlife', 'Get out there →', 'hotpink', 'https://images.unsplash.com/photo-1554620121-59e7f3f6e3a4?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=800&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ')

+promo('Quiet Time', 'Find yours →', 'yellow', 'https://images.unsplash.com/photo-1523806762236-1d3a6b7eb3fd?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=800&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ')

+promo('Surf\'s Up!', 'Grab a board →', 'dodgerblue', 'https://images.unsplash.com/photo-1548008116-bcfec1f4c812?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=800&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ')

+promo('Day Hikes', 'Take a walk →', 'darkgreen', 'https://images.unsplash.com/photo-1569335048491-5fb94951e885?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=800&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ')
View Compiled
@import url("https://fonts.googleapis.com/css2?family=Sura:wght@400;700&display=swap");

:root {
  --src: url(https://images.unsplash.com/photo-1554620121-59e7f3f6e3a4?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy);
  --size: 60vmin;
  --space: 8vmin;
  --duration: 300ms;
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --bounce-out: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
}

body {
  display: grid;
  place-items: center;
  grid-gap: var(--space);
  margin: 0 auto;
  padding: var(--space);
  font-family: "Sura", sans-serif;
  color: white;
  background-color: rgb(29, 30, 34);
}

.promo {
  position: relative;
  cursor: pointer;
  width: var(--size);
  height: var(--size);
}

.title {
  --font-size: calc(var(--size) / 8);

  display: flex;
  align-items: center;
  position: absolute;
  left: 0;
  bottom: 0;
  font-size: var(--font-size);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transform: translate(-10%, -50%);
  transition: transform var(--duration) var(--ease-out);
  pointer-events: none;
}

.title::after {
  content: attr(data-cta);
  display: inline-block;
  margin-left: 1.5vmin;
  font-size: calc(var(--font-size) / 3.25);
  font-weight: 400;
  letter-spacing: 0.125vmin;
  opacity: 0;
  transform: translateX(-25%);
  transition: transform var(--duration) var(--ease-out),
    opacity var(--duration) var(--ease-out);
}

.image-wrapper {
  width: var(--size);
  height: var(--size);
  overflow: hidden;
  clip-path: polygon(100% 0, 100% 50%, 100% 100%, 0% 100%, 0 50%, 0% 0%);
  transition: transform var(--duration) var(--ease-out),
    clip-path var(--duration) var(--ease-out);
}

.image-wrapper img {
  position: relative;
  width: 120%;
  height: 100%;
  object-fit: cover;
  transform: translateX(-10%);
  transition: transform var(--duration) var(--ease-out);
}

.image-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-color);
  mix-blend-mode: multiply;
  opacity: 0;
  transform: translateZ(0);
  transition: opacity var(--duration) var(--ease-out);
}

.promo:hover img {
  transform: translateX(0);
}

.promo:hover .image-wrapper {
  clip-path: polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%, 0% 0%);
  transform: translateX(25%);
  transition-timing-function: var(--bounce-out);
}

.promo:hover .title {
  transform: translate(5%, -50%);
  transition-timing-function: var(--bounce-out);
}

.promo:hover .title::after {
  opacity: 1;
  transform: translateX(0);
  transition-timing-function: var(--bounce-out);
}

.promo:hover .image-wrapper::after {
  opacity: 1;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.