// Sandbox just for fun
.big-circles
  .big-circle
  .big-circle
  .big-circle
section#home
  .slide-wrapper
    .smallcircles
      .small-circle
      .small-circle
      .small-circle
      .small-circle
      .small-circle
      .small-circle
    .cover-wrapper.text-center#home-content
      .cover-wrapper__inner
        .cover-wrapper__container
           h1 Maciej Siwanowicz
           p 
             button.btn.btn-cta.btn-cta__green.text-uppercase.trigger(data-toggle='closed') View portfolio
             
 
  section#portfolio.portfolio-wrapper   
    .cover-wrapper.text-center#home
      .cover-wrapper__inner
        .cover-wrapper__container
          .container
            .row
              .col-sm-12
                h1.test-uppercase Portfolio
                p 
                 button.btn.btn-cta.btn-cta__green.text-uppercase.trigger(data-toggle='opened') Back home
                
               
View Compiled
@import url('https://fonts.googleapis.com/css?family=Montserrat');

html, body {
  font-family: 'Montserrat', sans-serif;
  height: 100%;
  width: 100%;
  color: white;
  background-color: #3b1b8b;
  overflow: hidden;
}

section {
  opacity: 1;
  height:100%;
  width: 100%;
}
.active section {
  opacity: 1;
  transition: opacity 0.5s;
}
.btn-cta {
  border: 5px solid;
  border-radius: 0;  
}
.btn-cta__green {
  border-color:#76FF03;
  background-color: transparent;
  color: #76FF03;
}
.btn-cta__gray {
  border:#ccc;
  background-color: transparent;
  color: #ccc;
}
.slide-wrapper {
    position: relative;
    overflow: hidden;
    height: 90%;
    width: 90%;
    top: 5%;
    bottom: 5%;
    left: 5%;
    right: 5%;
    z-index:3;
}
h1, h2, h3, h4, h5, h6 {
  color: #fff;
}

.navbar-default .navbar-nav > li > a {
    color: #fff;
}
.cover-wrapper {
    display: table;
    width: 100%;
    height: 100%;
    min-height: 100%;
}


.cover-wrapper__inner {
  display: table-cell;
  vertical-align: middle;
}
.cover-wrapper__container {
    margin-right: auto;
    margin-left: auto;
}
section#nav {
  height: 50px;
}
#home {
    .slide-wrapper {
      background-color: #623ebd;
    }
  
}
#home-content {
  z-index: 5;
}
#box1 {
  display: block;
  width: 20px;
  height: 20px;
  background-color: red;
}
#portfolio {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 1;
    bottom: -100%;
    background: black;
}
#aboutme {
  background: #E9E9E9;
}
.preload {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  z-index: 1032;
  background-color: #7752d5;
}

.circle {
  border-radius: 190px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  position: absolute;
  top: 50%;
  left: 50%;
  opacity: 0;
}

.circle1 {
  background-color: #7752d5;
  width: 240px;
  height: 240px;
  margin-top: -120px;
  margin-left: -120px;
}

.circle2 {
  background-color: #8362d9;
  width: 170px;
  height: 170px;
  margin-top: -85px;
  margin-left: -85px;
}

.circle3 {
  background-color: #9f88d6;
  width: 100px;
  height: 100px;
  margin-top: -50px;
  margin-left: -50px;
}
.spammer-container {
  display: none;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right:0;
  background-color: green;
  
  .spammer__content {
    position: inherit;
    width:100%;
    height:100%;
    display: block;
    animation: spamcolor 0.1s infinite;
    -webkit-animation: spamcolor 0.1s infinite;
  }
  
}

.smallcircles {   
  position: absolute;
  z-index: -2;
  width: 100%;
  height: 100%;
  animation: infinite-rotation 150s infinite;
  
}
.small-circle {
  position: inherit;
  display:block;
  width: 250px;
  height: 250px;
  background: #3b1b8b;
  margin-top: -125px;
  margin-left: -125px;
  border-radius: 125px;
  -webkit-animation: smallcircle 0.8s ease-in-out alternate;
  -moz-animation: smallcircle 0.8s ease-in-out alternate;
  animation: smallcircle 0.8s ease-in-out alternate;
}

.small-circle:nth-child(1) {  
  top: 12%;
  left: 24%;
}
.small-circle:nth-child(2) {
  display:block;
  top: 18%;
  left: 44%;
}
.small-circle:nth-child(3) {
  display:block;
  top: 78%;
  left: 5%;
}
.small-circle:nth-child(4) {
  display:block;
  top: 78%;
  left: 56%;
}
.small-circle:nth-child(4) {
  display:block;
  top: 78%;
  left: 56%;
}
.small-circle:nth-child(5) {
  display:block;
  top: 38%;
  left: 86%;
}
.small-circle:nth-child(6) {
  display:block;
  top: 86%;
  left: 96%;
}

.big-circles {   
  position: absolute;
  width: 100%;
  height: 100%;
  animation: infinite-rotation 125s infinite;
  
}
.big-circle {
  position: inherit;
  display:block;
  width: 500px;
  height: 500px;
  background: #1f0a55;
  margin-top: -250px;
  margin-left: -250px;
  border-radius: 250px;
  -webkit-animation: bigcircle 1.6s ease-in-out alternate;
  -moz-animation: bigcircle 1.6s ease-in-out alternatee;
  animation: bigcircle 1.6s ease-in-out alternate;
}

.big-circle:nth-child(1) {
    top: 12%;
    left: 4%;
}
.big-circle:nth-child(2) {
    display: block;
    top: 98%;
    left: 84%;
}
.big-circle:nth-child(3) {
  display:block;
  top: 78%;
  left: 0%;
}
.big-circle:nth-child(4) {
  display:block;
  top: 78%;
  left: 56%;
}
.big-circle:nth-child(4) {
  display:block;
  top: 78%;
  left: 56%;
}
.big-circle:nth-child(5) {
  display:block;
  top: 38%;
  left: 86%;
}
.big-circle:nth-child(6) {
  display:block;
  top: 86%;
  left: 96%;
}
// animations

@keyframes spamcolor {
  0%   {background: red;}
  50%  {background: yellow;}
  100% {background: red;}
}

@-webkit-keyframes spamcolor {
  0%   {background: red;}
  50%  {background: yellow;}
  100% {background: red;}
}

@keyframes smallcircle {
  0% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0);
  }
  
  100% {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1);
  }
}

@keyframes bigcircle {
  0% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0);
  }
  50% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0);
  }
  100% {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1);
  }
}

@keyframes infinite-rotation {
  from {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  to {
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
View Compiled
/**
 * ITEManimate object is used to animate ease with bezier functions
 * example: TweenMax.to($('selector'), 1.5, {left:"80%", ease: ITEManimate.bezier(0.04,0.86,0.8,1)});
 *
 * Used: https://github.com/rdallasgray/bez
   Forked from: https://codepen.io/karlovidek/pen/qOxYjp
 */
var ITEManimate = ({
    start: 0,
    bezier: function(p0, p1, p2, p3) {
        return ITEManimate.polyBez([p0, p1], [p2, p3]);

    },
    polyBez: function(p1, p2) {
        var A = [null, null],
            B = [null, null],
            C = [null, null],
            bezCoOrd = function(t, ax) {
                C[ax] = 3 * p1[ax], B[ax] = 3 * (p2[ax] - p1[ax]) - C[ax], A[ax] = 1 - C[ax] - B[ax];
                return t * (C[ax] + t * (B[ax] + t * A[ax]));
            },
            xDeriv = function(t) {
                return C[0] + t * (2 * B[0] + 3 * A[0] * t);
            },
            xForT = function(t) {
                var x = t,
                    i = 0,
                    z;
                while (++i < 14) {
                    z = bezCoOrd(x, 0) - t;
                    if (Math.abs(z) < 1e-3) break;
                    x -= z / xDeriv(x);
                }
                return x;
            };
        return function(t) {
            return bezCoOrd(xForT(t), 1);
        }
    }
});


//CUSTOM JS CODE
(function($) {
    'use strict';

    //VIEWPORT
    var w = $(window);

    //ANIMATION
    var animationTrigger = $('.trigger');
    var sceneContainer = $('.slide-wrapper');
    var smallCircles = $('.small-circle');
    var portfolioContainer = $('.portfolio-wrapper');

    var main = {

        init: function() {
            var self = this;
            //GSAP ANIMATE
            main.animate();
        },

        //GSAP ANIMATION
        animate: function() {

            //OPEN
            function openAnimation() {
                TweenMax.to(sceneContainer, 0.8, {
                    height: "100%",
                    ease: ITEManimate.bezier(0.930, 0.035, 0.350, 0.815),
                    top: "0%",
                    ease: ITEManimate.bezier(0.930, 0.035, 0.350, 0.815),
                    width: "100%",
                    ease: ITEManimate.bezier(0.930, 0.035, 0.350, 0.815),
                    left: "0%",
                    ease: ITEManimate.bezier(0.930, 0.035, 0.350, 0.815),

                    onComplete: function() {
                      console.log(sceneContainer);
                        TweenMax.to(portfolioContainer, 1.8, {
                            width: "100%",
                            ease: ITEManimate.bezier(0.930, 0.035, 0.350, 0.815),
                            top: "30%",
                            ease: ITEManimate.bezier(0.930, 0.035, 0.350, 0.815)
                        })
                        TweenMax.to(sceneContainer, 0.8, {
                            top: "-70%",
                            ease: ITEManimate.bezier(0.930, 0.035, 0.350, 0.815),
                        })
                    }
                });

                TweenMax.to(smallCircles, 0.4, {
                    scale: "0",
                    ease: ITEManimate.bezier(0.930, 0.035, 0.350, 0.815),

                });

            }

            //CLOSE
            function closeAnimation() {
                TweenMax.to(portfolioContainer, 1.2, {
                    top: "100%",
                    ease: ITEManimate.bezier(0.815, 0.035, 0.350, 0.930),
                    width: "100%",
                    ease: ITEManimate.bezier(0.815, 0.035, 0.350, 0.930),

                    onComplete: function() {
                        TweenMax.to(sceneContainer, 0.8, {
                            height: "90%",
                            ease: ITEManimate.bezier(0.815, 0.035, 0.350, 0.930),
                            top: "5%",
                            ease: ITEManimate.bezier(0.815, 0.035, 0.350, 0.930),
                            width: "90%",
                            ease: ITEManimate.bezier(0.815, 0.035, 0.350, 0.930),
                            left: "5%",
                            ease: ITEManimate.bezier(0.815, 0.035, 0.350, 0.930),
                            onComplete: function() {
                                TweenMax.to(smallCircles, 0.4, {
                                    scale: "1",
                                    ease: ITEManimate.bezier(0.815, 0.035, 0.350, 0.930),

                                });

                            }

                        });
                    }

                })

            }

            animationTrigger.click(function() {
                if ($(this).attr('data-toggle') == 'closed') {
                    $(this).attr('data-toggle', 'opened');
                    openAnimation();
                } else if ($(this).attr('data-toggle', 'opened')) {
                    $(this).attr('data-toggle', 'closed');
                    closeAnimation();
                }
            });
        }
    };

    $(window).resize(function() {});
    return main.init();
}($));
Rerun