Your browser does not support the CSS View Transition API 😢

Welcome to Page 2

This is the CSS used to acheive our animation.

Note: as of this writing, view transitions don't seem to support the use of the translate property; it only works with the original transform syntax.


main {
    view-transition-name: main;
  }

  @keyframes slideUp {
    from {
      opacity: 0;
      scale: 0.9;
      transform: translate(0, -100%);
    }

    to {
      opacity: 1;
      scale: 1;
      transform: translate(0);
    }
  }

  @keyframes slideDown {
    from {
      opacity: 1;
      scale: 1;
      transform: translate(0);
    }

    to {
      opacity: 0;
      scale: 0.9;
      transform: translate(0, 100%);
    }
  }

  /* New stuff coming in */
  :root::view-transition-new(main) {
    animation: slideUp 0.3s ease-in forwards;
    width: fit-content;
    z-index: 1;
  }

  /* Old stuff coming out */
  :root::view-transition-old(main) {
    animation: slideDown 0.2s ease-out forwards;
    width: fit-content;
    z-index: 1;
  }