<div class="stage">
    <div class="hero">
        <div class="hero__inner">
            <div class="hero__cuboid hero__cuboid--1">
                <div class="face face--front"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-mandalorian.jpg" alt=""></div>
                <div class="face face--back"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-hulk.jpg" alt=""></div>
                <div class="face face--left"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-iron-man-2.jpg" alt=""></div>
                <div class="face face--right"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-black-panther.jpg" alt=""></div>
                <div class="face face--top"></div>
                <div class="face face--bottom"></div>
            </div>
            <div class="hero__cuboid hero__cuboid--2">
                <div class="face face--front"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-gamora.jpg" alt=""></div>
                <div class="face face--back"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-iron-man.jpg" alt=""></div>
                <div class="face face--left"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-chewbacca.jpg" alt=""></div>
                <div class="face face--right"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-jyn.jpg" alt=""></div>
                <div class="face face--top"></div>
                <div class="face face--bottom"></div>
            </div>
            <div class="hero__cuboid hero__cuboid--3">
                <div class="face face--front"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-iron-man.jpg" alt=""></div>
                <div class="face face--back"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-incredibles.jpg" alt=""></div>
                <div class="face face--left"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-cpt-america.jpg" alt=""></div>
                <div class="face face--right"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-gamora.jpg" alt=""></div>
                <div class="face face--top"></div>
                <div class="face face--bottom"></div>
            </div>
            <div class="hero__cuboid hero__cuboid--4">
                <div class="face face--front"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-incredibles.jpg" alt=""></div>
                <div class="face face--back"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-mandalorian.jpg" alt=""></div>
                <div class="face face--left"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-rey.jpg" alt=""></div>
                <div class="face face--right"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/disney-iron-man.jpg" alt=""></div>
                <div class="face face--top"></div>
                <div class="face face--bottom"></div>
            </div>
        </div>
    </div> 
    <div class="overlay"></div>
    <div class="logo__wrap">
        <svg class="logo" viewBox="0 0 1382 750" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <title>Disney+ Logo</title>
            <defs>
                <radialGradient cx="98.3037758%" cy="99.8200643%" fx="98.3037758%" fy="99.8200643%" r="271.376044%" gradientTransform="translate(0.983038,0.998201),scale(0.362305,1.000000),translate(-0.983038,-0.998201)" id="radialGradient-1">
                    <stop stop-color="#FFFFFF" offset="0.7086212%"></stop>
                    <stop stop-color="#CBFFFF" offset="3.009906%"></stop>
                    <stop stop-color="#96FFFF" offset="5.700687%"></stop>
                    <stop stop-color="#68FFFF" offset="8.427694%"></stop>
                    <stop stop-color="#43FFFF" offset="11.13%"></stop>
                    <stop stop-color="#25FFFF" offset="13.82%"></stop>
                    <stop stop-color="#11FFFF" offset="16.47%"></stop>
                    <stop stop-color="#04FFFF" offset="19.08%"></stop>
                    <stop stop-color="#00FFFF" offset="21.59%"></stop>
                    <stop stop-color="#0000FF" stop-opacity="0" offset="100%"></stop>
                </radialGradient>
                <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="47.6209616%" id="radialGradient-2">
                    <stop stop-color="#0861A7" offset="0%"></stop>
                    <stop stop-color="#0961A2" stop-opacity="0" offset="100%"></stop>
                </radialGradient>
                <radialGradient cx="50%" cy="50.5002413%" fx="50%" fy="50.5002413%" r="47.1207203%" id="radialGradient-3">
                    <stop stop-color="#268FBA" offset="0%"></stop>
                    <stop stop-color="#0961A2" stop-opacity="0" offset="100%"></stop>
                </radialGradient>
                <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="37.7958401%" id="radialGradient-4">
                    <stop stop-color="#FFFFFF" offset="0%"></stop>
                    <stop stop-color="#EDF7FF" offset="28.9352829%"></stop>
                    <stop stop-color="#000000" stop-opacity="0" offset="100%"></stop>
                </radialGradient>
                <mask id="mask-arc">
                    <path class="mask-arc" d="M945.309075,284.637106 C887.681743,126.13962 731.334648,12.5 547.5,12.5 C392.751787,12.5 257.481048,93.0241819 184.176268,213.045705" stroke="white" fill="none" stroke-width="30" />
                </mask>
                <g id="glow">
                    <circle id="Oval" fill="url(#radialGradient-2)" style="mix-blend-mode: screen;" cx="106.5" cy="106.5" r="106.5"></circle>
                    <circle id="Oval-Copy" fill="url(#radialGradient-3)" style="mix-blend-mode: screen;" cx="106.5" cy="106.5" r="53.5"></circle>
                    <circle id="Oval-Copy-2" fill="url(#radialGradient-4)" style="mix-blend-mode: screen;" cx="106.5" cy="106.5" r="62.5"></circle>
                </g>
            </defs>
            <g class="disney" transform="translate(171.000000, 93.000000)">
                <use class="plus-glow" xlink:href="#glow" transform="translate(855, 274)"/>
                <path id="disney" d="M735.8,365.7 C721.4,369 683.5,370.9 683.5,370.9 L678.7,385.9 C678.7,385.9 697.6,384.3 711.4,385.7 C711.4,385.7 715.9,385.2 716.4,390.8 C716.6,396 716,401.6 716,401.6 C716,401.6 715.7,405 710.9,405.8 C705.7,406.7 670.1,408 670.1,408 L664.3,427.5 C664.3,427.5 662.2,432 667,430.7 C671.5,429.5 708.8,422.5 713.7,423.5 C718.9,424.8 724.7,431.7 723,438.1 C721,445.9 683.8,469.7 661.1,468 C661.1,468 649.2,468.8 639.1,452.7 C629.7,437.4 642.7,408.3 642.7,408.3 C642.7,408.3 636.8,394.7 641.1,390.2 C641.1,390.2 643.7,387.9 651.1,387.3 L660.2,368.4 C660.2,368.4 649.8,369.1 643.6,361.5 C637.8,354.2 637.4,350.9 641.8,348.9 C646.5,346.6 689.8,338.7 719.6,339.7 C719.6,339.7 730,338.7 738.9,356.7 C738.8,356.7 743.2,364 735.8,365.7 L735.8,365.7 Z M623.7,438.3 C619.9,447.3 609.8,456.9 597.3,450.9 C584.9,444.9 565.2,404.6 565.2,404.6 C565.2,404.6 557.7,389.6 556.3,389.9 C556.3,389.9 554.7,387 553.7,403.4 C552.7,419.8 553.9,451.7 547.4,456.7 C541.2,461.7 533.7,459.7 529.8,453.8 C526.3,448 524.8,434.2 526.7,410 C529,385.8 534.6,360 541.8,351.9 C549,343.9 554.8,349.7 557,351.8 C557,351.8 566.6,360.5 582.5,386.1 L585.3,390.8 C585.3,390.8 599.7,415 601.2,414.9 C601.2,414.9 602.4,416 603.4,415.2 C604.9,414.8 604.3,407 604.3,407 C604.3,407 601.3,380.7 588.2,336.1 C588.2,336.1 586.2,330.5 587.6,325.3 C588.9,320 594.2,322.5 594.2,322.5 C594.2,322.5 614.6,332.7 624.4,365.9 C634.1,399.4 627.5,429.3 623.7,438.3 L623.7,438.3 Z M523.5,353 C521.8,356.4 520.8,361.3 512.2,362.6 C512.2,362.6 429.9,368.2 426,374 C426,374 423.1,377.4 427.6,378.4 C432.1,379.3 450.7,381.8 459.7,382.3 C469.3,382.4 501.7,382.7 513.3,397.2 C513.3,397.2 520.2,404.1 519.9,419.7 C519.6,435.7 516.8,441.3 510.6,447.1 C504.1,452.5 448.3,477.5 412.3,439.1 C412.3,439.1 395.7,420.6 418,406.6 C418,406.6 434.1,396.9 475,408.3 C475,408.3 487.4,412.8 486.8,417.3 C486.1,422.1 476.6,427.2 462.8,426.9 C449.4,426.5 439.6,420.1 441.5,421.1 C443.3,421.8 427.1,413.3 422.1,419.1 C417.1,424.4 418.3,427.7 423.2,431 C435.7,438.1 484,435.6 498.4,419.6 C498.4,419.6 504.1,413.1 495.4,407.8 C486.7,402.8 461.8,399.8 452.1,399.3 C442.8,398.8 408.2,399.4 403.2,390.2 C403.2,390.2 398.2,384 403.7,366.4 C409.5,348 449.8,340.9 467.2,339.3 C467.2,339.3 515.1,337.6 523.9,347.4 C523.8,347.4 525,349.7 523.5,353 L523.5,353 Z M387.5,460.9 C381.7,465.2 369.4,463.3 365.9,458.5 C362.4,454.2 361.2,437.1 361.9,410.3 C362.6,383.2 363.2,349.6 369,344.3 C375.2,338.9 379,343.6 381.4,347.3 C384,350.9 387.1,354.9 387.8,363.4 C388.4,371.9 390.4,416.5 390.4,416.5 C390.4,416.5 393,456.7 387.5,460.9 L387.5,460.9 Z M400,317.1 C383.1,322.7 371.5,320.8 361.7,316.6 C357.4,324.1 354.9,326.4 351.6,326.9 C346.8,327.4 342.5,319.7 341.7,317.2 C340.9,315.3 338.6,312.1 341.4,304.5 C331.8,295.9 331.1,284.3 332.7,276.5 C335.1,267.5 351.3,233.3 400.6,229.3 C400.6,229.3 424.7,227.5 428.8,240.4 L429.5,240.4 C429.5,240.4 452.9,240.5 452.4,261.3 C452.1,282.2 426.4,308.2 400,317.1 L400,317.1 Z M354,270.8 C349,278.8 348.8,283.6 351.1,286.9 C356.8,278.2 367.2,264.5 382.5,254.1 C370.7,255.1 360.8,260.2 354,270.8 L354,270.8 Z M422.1,257.4 C406.6,259.7 382.6,280.5 371.2,297.5 C388.7,300.7 419.6,299.5 433.3,271.6 C433.2,271.6 439.8,254.3 422.1,257.4 L422.1,257.4 Z M842.9,418.5 C833.6,434.7 807.5,468.5 772.7,460.6 C761.2,488.5 751.6,516.6 746.1,558.8 C746.1,558.8 744.9,567 738.1,564.1 C731.4,561.7 720.2,550.5 718,535 C715.6,514.6 724.7,480.1 743.2,440.6 C737.8,431.8 734.1,419.2 737.3,401.3 C737.3,401.3 742,368.1 775.3,338.1 C775.3,338.1 779.3,334.6 781.6,335.7 C784.2,336.8 783,347.6 780.9,352.8 C778.8,358 763.9,383.8 763.9,383.8 C763.9,383.8 754.6,401.2 757.2,414.9 C774.7,388 814.5,333.7 839.2,350.8 C847.5,356.7 851.3,369.6 851.3,383.5 C851.2,395.8 848.3,408.8 842.9,418.5 L842.9,418.5 Z M835.7,375.9 C835.7,375.9 834.3,365.2 823.9,377 C814.9,386.9 798.7,405.6 785.6,430.9 C799.3,429.4 812.5,421.9 816.5,418.1 C823,412.3 838.1,396.7 835.7,375.9 L835.7,375.9 Z M350.2,389.5 C348.3,413.7 339,454.4 273.1,474.5 C229.6,487.6 188.5,481.3 166.1,475.6 C165.6,484.5 164.6,488.3 163.2,489.8 C161.3,491.7 147.1,499.9 139.3,488.3 C135.8,482.8 134,472.8 133,463.9 C82.6,440.7 59.4,407.3 58.5,405.8 C57.4,404.7 45.9,392.7 57.4,378 C68.2,364.7 103.5,351.4 135.3,346 C136.4,318.8 139.6,298.3 143.4,288.9 C148,278 153.8,287.8 158.8,295.2 C163,300.7 165.5,324.4 165.7,343.3 C186.5,342.3 198.8,343.8 222,348 C252.2,353.5 272.4,368.9 270.6,386.4 C269.3,403.6 253.5,410.7 247.5,411.2 C241.2,411.7 231.4,407.2 231.4,407.2 C224.7,404 230.9,401.2 239,397.7 C247.8,393.4 245.8,389 245.8,389 C242.5,379.4 203.3,372.7 164.3,372.7 C164.1,394.2 165.2,429.9 165.7,450.7 C193,455.9 213.4,454.9 213.4,454.9 C213.4,454.9 313,452.1 316,388.5 C319.1,324.8 216.7,263.7 141,244.3 C65.4,224.5 22.6,238.3 18.9,240.2 C14.9,242.2 18.6,242.8 18.6,242.8 C18.6,242.8 22.7,243.4 29.8,245.8 C37.3,248.2 31.5,252.1 31.5,252.1 C18.6,256.2 4.1,253.6 1.3,247.7 C-1.5,241.8 3.2,236.5 8.6,228.9 C14,220.9 19.9,221.2 19.9,221.2 C113.4,188.8 227.3,247.4 227.3,247.4 C334,301.5 352.2,364.9 350.2,389.5 L350.2,389.5 Z M68,386.2 C57.4,391.4 64.7,398.9 64.7,398.9 C84.6,420.3 109.1,433.7 132.4,442 C135.1,405.1 134.7,392.1 135,373.5 C98.6,376 77.6,381.8 68,386.2 L68,386.2 Z" fill="#FFFFFF" fill-rule="nonzero"></path>
                <g class="sparks" transform="translate(855, 274)">
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                    <use class="spark" xlink:href="#glow"/>
                </g>
                <path class="plus" d="M1040.9,378.6 L1040.9,391.8 C1040.9,394.7 1038.6,397 1035.7,397 L972.8,397 C972.8,400.3 972.9,403.2 972.9,405.9 C972.9,425.4 972.1,441.3 970.2,459.2 C969.9,461.9 967.7,463.9 965.1,463.9 L951.5,463.9 C950.1,463.9 948.8,463.3 947.9,462.3 C947,461.3 946.5,459.9 946.7,458.5 C948.6,440.7 949.5,425 949.5,405.9 C949.5,403.1 949.5,400.2 949.4,397 L887.2,397 C884.3,397 882,394.7 882,391.8 L882,378.6 C882,375.7 884.3,373.4 887.2,373.4 L948.5,373.4 C947.2,351.9 944.6,331.2 940.4,310.2 C940.2,308.9 940.5,307.6 941.3,306.6 C942.1,305.6 943.3,305 944.6,305 L959.3,305 C961.6,305 963.5,306.6 964,308.9 C968.1,330.6 970.7,351.7 972,373.4 L1035.7,373.4 C1038.5,373.4 1040.9,375.8 1040.9,378.6 Z" fill="#FFFFFF" fill-rule="nonzero"></path>
                <path class="arc" mask="url(#mask-arc)" d="M955.3,273.9 C922.8,194 867.9,125.9 796.5,76.9 C723.4,26.8 637.7,0.3 548.7,0.3 C401.5,0.3 264.9,73.4 183.4,195.9 C182.5,197.2 182.3,198.9 182.8,200.4 C183.3,202 184.5,203.1 186,203.6 L197.4,207.5 C198.1,207.7 198.8,207.8 199.4,207.8 C201.5,207.8 203.5,206.7 204.7,205 C242.1,150 292.7,104.3 351.1,72.7 C411.4,40.1 479.7,22.8 548.6,22.8 C631.9,22.8 712.2,47.4 781,93.8 C848.1,139.1 900.2,202.4 931.7,276.7 C932.6,278.9 934.8,280.4 937.2,280.4 L950.8,280.4 C952.4,280.4 953.9,279.6 954.7,278.3 C955.7,277 955.9,275.4 955.3,273.9 Z" fill="url(#radialGradient-1)" fill-rule="nonzero"></path>
                <use class="glow" xlink:href="#glow" transform="translate(835, 164)"/>
                <path class="glow-path" d="M945.309075,284.637106 C887.681743,126.13962 731.334648,12.5 547.5,12.5 C392.751787,12.5 257.481048,93.0241819 184.176268,213.045705" stroke="none" fill="none" />

            </g>
        </svg>  
    </div>
</div>
:root {
    --w: 1080;
    --h: 777;
    --gap: 0;
}

/*  ==========================================================
  MIXINS
  ========================================================== */
  
@mixin cuboid() {
  position: relative;
  transform-style: preserve-3d;
    height: 100%;
    width: 100%;
  
  .face {
    position: absolute;
    left: 0;
    top: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
    max-height: 100%;
    background-color: black;
        
        // &:after {
        //     position: absolute;
        //     top: 0;
        //     left: 0;
        //     display: block;
        //     content: '';
        //     padding-top: 100%;
        // }
  }
  
  .face--front {
        transform: rotateY(90deg) translateX(-50%) rotateY(-90deg);
  }

  .face--back {
    transform: rotateY(90deg) translateX(50%) rotateY(90deg);
  }

  .face--left {
    transform: translateX(-50%) rotateY(-90deg);
  }

  .face--right {
    transform: translateX(50%) rotateY(90deg);
  }

  .face--top {
        display: none;
  }

  .face--bottom {
        display: none;
  }
}

html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: black;
    color: white;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

.stage {
  position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto;
  width: 100%;
  height: 100%;
    // background: red;
  visibility: hidden;
    perspective: 2000px;
}

.hero {
    cursor: pointer;
}

.hero, .logo__wrap {
    position: relative;
  width: 100%;
  max-width: 1080px;
    margin: 30px;
    transform-style: preserve-3d;
    
    &:before {
        content: '';
        display: block;
        padding-top: calc(var(--h) / var(--w) * 100%); // determine aspect ratio height 1080x777
        // background: green;
    }
}

.hero__inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    // display: grid;
  // grid-template-columns: repeat(4, 1fr);
    // gap: calc((var(--gap)/var(--w)) * 100%); // first number is gap in pixels (max scale) to percentage
    transform-style: preserve-3d;
}

.hero__cuboid {
    @include cuboid();
    transform-style: preserve-3d;
    
    .face {
        transform-style: preserve-3d;
        backface-visibility: hidden;
        overflow: hidden;
        
        img { 
            object-fit: cover;
            width: 100%;
            height: 100%;
            // object-position: 50% 50%; // default
        }
    }
}

.overlay {
    position: absolute;
    z_index: 1;
    width: 100%;
    height: 100%;
    content: '';
    pointer-events: none;
    background-image: 
        linear-gradient(180deg, rgba(0,0,0, 0) 50%, #000 80%),
        radial-gradient(50vh at bottom, black, transparent);

}

.logo__wrap {
    position: absolute;
    margin: 0;
    pointer-events: none;
}

.logo {
    position: absolute;
    left: 50%;
    transform: translate(-50%);
    bottom: 0px;
    min-width: 150px;
    width: 20vw;
    max-width: 300px;
}

.spark, #glow {
    mix-blend-mode: screen;
}
View Compiled
console.clear();

select = e => document.querySelector(e);
selectAll = e => document.querySelectorAll(e);

const stage = select('.stage');
const hero = select('.hero');
let gltl = gsap.timeline({ delay: 1 });
let sparks = gsap.utils.toArray('.spark');
let xDist = "100vw";
let tapped = false;

function animInCuboids() {
    let tl = gsap.timeline( {
        delay: 0
    });
    
    tl.from('.hero__cuboid', {
        rotateY: 270,
        duration: 5,
        ease: 'power4', 
        stagger: 0.2,
        transformOrigin: "center center"
    }, 0)
    .from('.hero__cuboid', {
        // y: function(i) {
        //     if(i%2 == 0) {
        //         return "-50vh";
        //     }
        //     return "50vh";
        // },
        x: xDist,
        duration: 4,
        stagger: 0.4,
        ease: 'power4'
    }, 0)
    .from('.hero__cuboid', {
        rotationZ: 90,
        stagger: 0.2,
        duration: 6,
        ease: 'power4'
    }, 0)
    .from('.hero', {
        scale: 2.5,
        duration: 9,
        ease: 'power4',
    }, 0)
    .to('.face--right img', {
        opacity: 0,
        duration: 1.5,
        ease: 'power4', 
        stagger: 0.4
    }, 0)
    .to('.face--back img', {
        opacity: 0,
        duration: 5,
        ease: 'power4', 
        stagger: 0.4
    }, 0)
    .to('.face--left img', {
        opacity: 0,
        duration: 5,
        ease: 'power4', 
        stagger: 0.4,
        onComplete: initEvents
    }, 0.5)
    .from('.face--front img', {
        // x: "-25px", // doesn't work with object-fit
        // css: { objectPosition: "50% 50%" }, // too janky
        scale: 1.5,
        transformOrigin: "right top",
        duration: 9,
        ease: 'power3.out', 
        // stagger: 0.4
    }, 1.5);
    
    return tl;
}

function animateLogo() {
    
    gsap.set(sparks, {
        transformOrigin: 'center center',
        scale: 0.25,
        opacity: 0
    })
    
    tl = gsap.timeline();
    tl.from('.disney', {
        opacity: 0,
        ease: 'none',
        duration: 2
    })
    .fromTo('.mask-arc', {
        drawSVG: "100% 100%",
        
    }, {
        drawSVG: "100%",
        duration: 1,
        ease: 'power2.in'
    }, 0.5)
    .from('.glow', {
        scale: 0,
        duration: 0.7,
        ease: 'sine.in'
    }, 0.5)
    .from('.glow', {
        motionPath: {
            path: ".glow-path",
            align: ".glow-path",
            alignOrigin: [0.5, 0.5],
            autoRotate: true
        },
        duration: 1,
        ease: 'power2.in'
    }, 0.5)
    .set('.glow', {
        opacity: 0
    }, "-=0.5")
    .from('.plus', {
        scale: 0,
        duration: 0.7,
        ease: 'elastic(1, 0.7)',
        transformOrigin: "center center"
    }, "-=0.55")
    .fromTo('.plus-glow', {
        scale: 0,
        transformOrigin: "center center",
    },{
        scale: 3.0,
        opacity: 1,
        ease: 'sine.inOut',
        duration: 0.1
    }, "-=0.70")
    .to('.plus-glow', {
        // scale: 0,
        opacity: 0,
        duration: 1.3,
        ease: 'power2'
    }, "-=0.7")
    
    return tl;
}

function sparkle() {
    
    stl = gsap.timeline();
    
    sparks.forEach((target, i ) => {

        let tl = gsap.timeline();

        tl.set(target, {
            opacity: 1
        })
        .to(target, {
            duration: 1.5,
            physics2D: {
                velocity: 'random(100, 400)',
                angle:'random(360, 0)',
                gravity: 100
            },
            scale: 0,
            opacity: 0,
            ease: 'sine'
        })
        
        stl.add(tl, 0);
    })
    
    return stl;
}

let roTL = gsap.timeline({
    defaults: {
        duration: 1,
        ease: 'sine.inOut'
    }
});

let rot = 90;

function addRotAnim() {
    roTL.to('.hero__cuboid--1', {
        keyframes: [
            {
                x: "-75%",
                ease: 'power4.inOut'
            },
            {
                rotationY: -rot,
                delay: -1,
                ease: 'power4.inOut'
            }
        ]
    })
    .to('.hero__cuboid--1 .face--front img', {
        opacity: 0,
        ease: 'power2.inOut'
    }, 0)
    .from('.hero__cuboid--1 .face--right img', {
        opacity: 0,
        ease: 'power2.inOut'
    }, 0.1)
    .fromTo('.hero__cuboid--1 .face--back img', {
            opacity: 0
        },{
            opacity: 0.2,
            ease: 'power2.inOut'
    }, 0)
    .to('.hero__cuboid--2', {
        keyframes: [
            {
                x: "-25%",
                ease: 'power4.inOut'
            },
            {
                rotationY: -rot,
                delay: -1,
                ease: 'power4.inOut'
            }
        ]
    }, 0)
    .to('.hero__cuboid--2 .face--front img', {
        opacity: 0,
        ease: 'power2.inOut'
    }, 0)
    .from('.hero__cuboid--2 .face--right img', {
        opacity: 0,
        ease: 'power2.inOut'
    }, 0.1)
    .fromTo('.hero__cuboid--2 .face--back img', {
            opacity: 0
        },{
            opacity: 0.2,
            ease: 'power2.inOut'
    }, 0.1)
    .to('.hero__cuboid--3', {
        keyframes: [
            {
                x: "25%",
                ease: 'power4.inOut'
            },
            {
                rotationY: rot,
                delay: -1,
                ease: 'power4.inOut'
            }
        ]
    }, 0)
    .to('.hero__cuboid--3 .face--front img', {
        opacity: 0,
        ease: 'power2.inOut'
    }, 0)
    .from('.hero__cuboid--3 .face--left img', {
        opacity: 0,
        ease: 'power2.inOut'
    }, 0.1)
    .fromTo('.hero__cuboid--3 .face--back img', {
            opacity: 0
        },{
            opacity: 0.2,
            ease: 'power2.inOut'
    }, 0.1)
    .to('.hero__cuboid--4', {
        keyframes: [
            {
                x: "75%",
                ease: 'power4.inOut'
            },
            {
                rotationY: rot,
                delay: -1,
                ease: 'power4.inOut'
            }
        ]
    }, 0)
    .to('.hero__cuboid--4 .face--front img', {
        opacity: 0,
        ease: 'power2.inOut'
    }, 0)
    .from('.hero__cuboid--4 .face--left img', {
        opacity: 0,
        ease: 'power2.inOut'
    }, 0.05)
    .fromTo('.hero__cuboid--4 .face--back img', {
            opacity: 0
        },{
            opacity: 0.2,
            ease: 'power2.inOut'
    }, 0.1)
    .pause();
}

function initEvents() {
    gsap.set('.face img', { opacity: 1 });
    addRotAnim();
    hero.addEventListener("mouseenter", function( event ) {
        roTL.play();
    }, false);

    hero.addEventListener("mouseleave", function( event ) {
        roTL.reverse();
    }, false);
    hero.addEventListener('touchstart', function(event) {
        if(!tapped){
            tapped = true;
            roTL.play();
        }
        else {
            tapped = false;
            roTL.reverse();
        }
        
    });
}


function init() {
    gsap.set(stage, { autoAlpha: 1 });
    gsap.set('.hero__inner', { z: -135 });
    gltl.add(animInCuboids()).add(animateLogo(), '-=5.3').add(sparkle(), '-=3.85');
}

function resize() {
    let vw = window.innerWidth;
    let hw = hero.offsetWidth;
    
    // change the xDistance for the cuboids coming in depending 
    // on viewport width to avoid overlap on smaller devices
    if(vw/hw < 1.3) {
        xDist = "150vw";
    }
    else {
        xDist = "100vw";
    }
}

window.onresize = resize;

window.onload = () => {
    resize();
  init();
};

External CSS

  1. https://codepen.io/GreenSock/pen/JGaKdQ.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/gsap/3.2.6/gsap.min.js
  2. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/CSSRulePlugin3.min.js
  3. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/CustomBounce3.min.js
  4. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/CustomEase3.min.js
  5. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/CustomWiggle3.min.js
  6. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/DrawSVGPlugin3.min.js
  7. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/Draggable3.min.js
  8. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/EaselPlugin3.min.js
  9. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/EasePack3.min.js
  10. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/GSDevTools3.min.js
  11. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/InertiaPlugin.min.js
  12. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/MorphSVGPlugin3.min.js
  13. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/MotionPathPlugin.min.js
  14. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/MotionPathHelper.min.js
  15. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/Physics2DPlugin3.min.js
  16. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/PhysicsPropsPlugin3.min.js
  17. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/PixiPlugin3.min.js
  18. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/ScrambleTextPlugin3.min.js
  19. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/ScrollToPlugin3.min.js
  20. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/SplitText3.min.js
  21. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/TextPlugin3.min.js