<button class="button">
  <div class="loader button__loader"></div>
  <span>Click Me</span>
</button>

<div class="success-screen">
  <h1 class="success-screen__header">Boom.</h1>
  <div class="confetti-container"></div>
</div>
<div class="toast">
  <div class="toast__content">
    <div class="toast__header">Success!</div>
    <div class="toast__sub-header">You've clicked the button, hurray!</div>
  </div>
</div>
html {
  height: 100%;
}
body {
  height: 100%;
  width: 100%;
  margin: 0;
  color: #222;
  font-family: 'Montserrat', sans-serif;
  box-sizing: border-box;
  background: #f4f7f9;
}

.button {
  position: absolute;
  margin: 0 auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 0);
  background: #29d8d8;
  color: white;
  text-transform: uppercase;
  border: 0;
  padding: 20px 40px;
  z-index: 2;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  letter-spacing: 5px;
  transition: all .5s;
  overflow: hidden;
}

.button:hover {
  background: #27bdbd;
}

.button--hide {
  opacity: 0;
}

.button--loading {
  padding-left: 70px;
}

.button .button__loader {
  float: left;
  position: absolute;
  left: -50px;
  top: 15px;
  transition: all .2s;
 }

.button--loading .button__loader {
  left: 15px;
}

.success-screen {
  position: relative;
  background: #29d8d8;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  opacity: 0;
  transition: all 1s;
}

.success-screen--show {
  opacity: 1;
}

.success-screen__header {
  text-align: center;
  position: relative;
  z-index: 1;
  font-size: 50px;
  transition: all .4s;
  transform: translate3d(0, 25px, 0);
  opacity: 0;
}

.success-screen__header--show {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.toast {
  position: fixed;
  width: calc(100% - 40px);
  bottom: 0;
  padding: 20px;
  background: #f4f7f9;
  transform: translate3d(0, 150px, 0);
  transition: all 1s;
}

.toast--show {
  transform: translate3d(0, 0, 0)
}
.toast__content {
  max-width: 360px;
  margin: 0 auto;
}
.toast__header {
  text-transform: uppercase;
  font-size: 20px;
  margin: 0 0 20px;
  color: #29313d;
}

.toast__sub-header {
  color: #585858;
}

.toast__sub-sub-header {
  font-size: 10px;
  color: #ababab;
}

.confetti-container {
  perspective: 700px;
  position: absolute;
  overflow: hidden;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.confetti__particle {
  position: absolute;
  z-index: 1;
  top: -10px;
  border-radius: 50%;
  height: 30px;
  width: 30px;
  background: white;
}

.confetti__particle--round {
  opacity: .7;
}

.confetti__particle--rectangle {
  background: #1e2632;
  border-radius: 0;
  width: 40px;
  height: 14px;
}

.confetti__particle--animation-slow {
  animation: confetti--slow 10.25s linear 1 forwards;
}

.confetti__particle--animation-medium {
  animation: confetti--medium 8.75s linear 1 forwards;
}

.confetti__particle--animation-fast {
  animation: confetti--fast 7.25s linear 1 forwards;
}

@keyframes confetti--slow {
  0% { transform: translate3d(0, 0, 0) rotate(0) }
  100% { transform: translate3d(25px, 105vh, 0) rotate(200deg)}
}

@keyframes confetti--medium {
  0% { transform: translate3d(0, 0, 0) rotate(0) rotateY(0); }
  100% { transform: translate3d(100px, 105vh, 0) rotate(160deg)}
}

@keyframes confetti--fast {
  0% { transform: translate3d(0, 0, 0) rotate(0) rotateY(0); }
  100% { transform: translate3d(-50px, 105vh, 0) rotate(100deg)}
}

.loader, .loader:after {
  border-radius: 50%;
  width: 20px;
  height: 20px;
}
.loader {
  font-size: 10px;
  position: relative;
  text-indent: -9999em;
  border-top: 4px solid rgba(255, 255, 255, 0.2);
  border-right: 4px solid rgba(255, 255, 255, 0.2);
  border-bottom: 4px solid rgba(255, 255, 255, 0.2);
  border-left: 4px solid #ffffff;
  transform: translateZ(0);
  animation: loaderSpin 1.1s infinite linear;
}

@keyframes loaderSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
const successScreen = document.querySelector('.success-screen');
const header = document.querySelector('.success-screen__header');
const toast = document.querySelector('.toast');
const button = document.querySelector('.button');

button.addEventListener('click', simulateLoad);
button.addEventListener('touchend', simulateLoad);

function simulateLoad() {
  button.classList.add('button--loading');
  button.disabled = true;
  button.querySelector('span').innerHTML = 'Loading...';
  setTimeout(showSuccessScreen, 2000);
}

function showSuccessScreen() {
  button.classList.add('button--hide');
  successScreen.classList.add('success-screen--show');
  Confetti.render(); 

  setTimeout(() => {
    header.classList.add('success-screen__header--show');
  }, 500)

  setTimeout(() => {
    toast.classList.add('toast--show');
  }, 2000)
}

const Confetti = (function () {
  const confettiContainer = document.querySelector('.confetti-container');
  const animationSpeeds = ['slow', 'medium', 'fast'];
  const types = ['round', 'rectangle'];
  let renderInterval = null;

  function render() {
    renderInterval = setInterval(() => {
      const particle = document.createElement('div');
      
      const particleType = types[Math.floor(Math.random() * types.length)];
      const particleLeft = (Math.floor(Math.random() * confettiContainer.offsetWidth)) + 'px';
      const particleAnimation = animationSpeeds[Math.floor(Math.random() * animationSpeeds.length)];
      
      particle.classList.add(
        'confetti__particle', 
        `confetti__particle--animation-${particleAnimation}`,
        `confetti__particle--${particleType}`
      );
      particle.style.left = particleLeft;
      particle.style.webkitTransform = `rotate(${Math.floor(Math.random() * 360)}deg)`;
      
      particle.removeTimeout = setTimeout(function() {
        particle.parentNode.removeChild(particle);
      }, 15000);
      
      confettiContainer.appendChild(particle);
    }, 300);
  }

  return {
    render
  }
})();

External CSS

  1. https://fonts.googleapis.com/css?family=Montserrat:400,700

External JavaScript

This Pen doesn't use any external JavaScript resources.