LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

Article 1

Article 1

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptas, eaque.

Article 2

Article 2

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil, molestias.

Article 3

Article 3

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sequi, facere.

Article 4

Article 4

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum, aliquid?

Article 5

Article 5

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Neque, inventore.

Article 6

Article 6

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque, maiores!

Article 1

Article 1

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem, animi!

Article 2

Article 2

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Neque, iste.

Article 3

Article 3

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt, culpa?

Article 4

Article 4

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam, voluptates.

Article 1

Article 1

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cum, totam!

Article 2

Article 2

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam, voluptate?

Article 3

Article 3

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eos, explicabo.

Article 4

Article 4

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quam, sint?

Article 5

Article 5

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eaque, eum!

Article 6

Article 6

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium, cum!

Article 7

Article 7

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis, eveniet.

Article 8

Article 8

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa, vitae!

Article 1

Article 1

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit, reprehenderit.

Article 2

Article 2

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas, veritatis.

Article 3

Article 3

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius, sed?

Article 4

Article 4

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Velit, animi?

Article 5

Article 5

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate, modi.

Article 1

Article 1

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus, esse.

Article 2

Article 2

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Molestiae, quod!

Article 3

Article 3

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Obcaecati, quaerat.

Article 4

Article 4

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minus, ad?

Article 5

Article 5

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eos, doloremque!

Article 6

Article 6

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error, animi?

Article 7

Article 7

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quam, quia.

Article 8

Article 8

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Harum, perspiciatis.

Article 9

Article 9

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempore, labore.

Article 10

Article 10

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores, sint.

CSS
@font-face {
  src: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/pirou.otf");
  font-family: pirou;
}
*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-size: 62.5%;
  overflow: hidden;
}
@media (max-width: 992px) {
  html, body {
    font-size: 50%;
  }
}

body {
  background: lightseagreen;
}

.shake {
  -webkit-animation: shake 0.5s infinite;
          animation: shake 0.5s infinite;
}

.instant-transition {
  -webkit-transition: 0s 0s !important;
  transition: 0s 0s !important;
}

.scene {
  z-index: 1;
  position: relative;
  height: 100%;
  -webkit-perspective: 200vw;
          perspective: 200vw;
}
.scene.content-visible {
  z-index: 11;
}

.level {
  z-index: 2;
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-transition: -webkit-transform 0.7s;
  transition: -webkit-transform 0.7s;
  transition: transform 0.7s;
  transition: transform 0.7s, -webkit-transform 0.7s;
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
}
.level.level-1 {
  top: 0%;
}
.level.level-2 {
  top: 150%;
}
.level.level-3 {
  top: 300%;
}
.level.level-4 {
  top: 450%;
}
.level.level-5 {
  top: 600%;
}

/*
originally .rotater was 80% width and 100% height and all was ok
until i checked demo in FF...
i even tried SO http://stackoverflow.com/questions/28751990/firefox-bug-with-multiple-nested-z-index-elements-and-preserve-3d
but then i came up with hack. I made .rotater 2px width/height and placed child element with vw/vh units and negative left/top. At least now it works in FF
*/
.rotater {
  z-index: 3;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  -webkit-transition: -webkit-transform 0.7s;
  transition: -webkit-transform 0.7s;
  transition: transform 0.7s;
  transition: transform 0.7s, -webkit-transform 0.7s;
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
}

.elem {
  z-index: 4;
  position: absolute;
  top: calc(-50vh - 1px);
  left: calc(-40vw - 1px);
  width: calc(80vw + 2px);
  height: calc(100vh + 2px);
  -webkit-transition: -webkit-transform 1s;
  transition: -webkit-transform 1s;
  transition: transform 1s;
  transition: transform 1s, -webkit-transform 1s;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
  font-size: 5rem;
  text-align: center;
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
}
.elem.full-screen {
  left: calc(-50vw - 1px);
  width: calc(100vw + 2px);
}
.elem.content-visible .inner {
  z-index: 20;
}
.elem.content-visible .inner .art-fullName {
  -webkit-transform: scale(1);
          transform: scale(1);
}
.elem.content-visible .inner .art-text {
  -webkit-transform: scale(1);
          transform: scale(1);
  opacity: 1;
  -webkit-transition: opacity 0.5s 0.2s, -webkit-transform 0.5s 0.2s;
  transition: opacity 0.5s 0.2s, -webkit-transform 0.5s 0.2s;
  transition: transform 0.5s 0.2s, opacity 0.5s 0.2s;
  transition: transform 0.5s 0.2s, opacity 0.5s 0.2s, -webkit-transform 0.5s 0.2s;
}
.elem.content-visible .inner .art-close {
  -webkit-transform: rotate(45deg);
          transform: rotate(45deg);
  -webkit-transition: opacity 0.3s, -webkit-transform 0.5s 0.4s;
  transition: opacity 0.3s, -webkit-transform 0.5s 0.4s;
  transition: transform 0.5s 0.4s, opacity 0.3s;
  transition: transform 0.5s 0.4s, opacity 0.3s, -webkit-transform 0.5s 0.4s;
}
.elem.content-visible .inner .art-btn,
.elem.content-visible .inner .art-heading {
  display: none;
}
.elem:not(.active):hover {
  cursor: pointer;
}
.elem:nth-child(1) {
  -webkit-transform: rotateY(0deg) translateZ(-90vw);
          transform: rotateY(0deg) translateZ(-90vw);
}
.elem:nth-child(2) {
  -webkit-transform: rotateY(-60deg) translateZ(-90vw);
          transform: rotateY(-60deg) translateZ(-90vw);
}
.elem:nth-child(3) {
  -webkit-transform: rotateY(-120deg) translateZ(-90vw);
          transform: rotateY(-120deg) translateZ(-90vw);
}
.elem:nth-child(4) {
  -webkit-transform: rotateY(-180deg) translateZ(-90vw);
          transform: rotateY(-180deg) translateZ(-90vw);
}
.elem:nth-child(5) {
  -webkit-transform: rotateY(-240deg) translateZ(-90vw);
          transform: rotateY(-240deg) translateZ(-90vw);
}
.elem:nth-child(6) {
  -webkit-transform: rotateY(-300deg) translateZ(-90vw);
          transform: rotateY(-300deg) translateZ(-90vw);
}

.inner {
  z-index: 5;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #EEEEEE;
  -webkit-transition: -webkit-transform 0.3s;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
  box-shadow: 1.2rem 2rem 2rem rgba(0, 0, 0, 0.3);
}
.inner.inner-1 {
  background: #e57373;
}
.inner.inner-2 {
  background: #ba68c8;
}
.inner.inner-3 {
  background: #eeeeee;
}
.inner.inner-4 {
  background: #42a5f5;
}
.inner.inner-5 {
  background: #26c6da;
}
.inner.inner-6 {
  background: #66bb6a;
}
.inner.inner-7 {
  background: #ffa726;
}
.inner.inner-8 {
  background: #607d8b;
}
.inner.inner-9 {
  background: #795548;
}
.inner.inner-10 {
  background: #673ab7;
}
.inner.clicked {
  -webkit-transform: translateZ(15vw);
          transform: translateZ(15vw);
}
.inner.clicked .art-heading {
  -webkit-transform: scale(0.01);
          transform: scale(0.01);
}
.inner.clicked .art-btn {
  -webkit-transform: translateX(-50%) translateY(-50%) scale(0.01);
          transform: translateX(-50%) translateY(-50%) scale(0.01);
}
.inner:not(.clicked):hover {
  -webkit-transform: translateZ(5vw);
          transform: translateZ(5vw);
}

.art-heading {
  margin-top: 1rem;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  text-transform: uppercase;
  font-size: 6rem;
  -webkit-transition: -webkit-transform 0.3s;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
}

.art-btn {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 10rem;
  overflow: hidden;
  -webkit-transform: translateX(-50%) translateY(-50%);
          transform: translateX(-50%) translateY(-50%);
  display: block;
  outline: none;
  border: 0.5rem solid;
  background: transparent;
  font-size: 5rem;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-transition: background-color 0.3s, color 0.3s, border-color 0.3s;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.art-btn:after {
  content: "";
  display: block;
  position: absolute;
  top: -0.5rem;
  left: -45%;
  width: 30%;
  height: calc(100% + 1rem);
  -webkit-transform: skewX(-30deg);
          transform: skewX(-30deg);
  background: -webkit-linear-gradient(left, rgba(229, 172, 142, 0), rgba(255, 255, 255, 0.5) 50%, rgba(229, 172, 142, 0));
  background: linear-gradient(to right, rgba(229, 172, 142, 0), rgba(255, 255, 255, 0.5) 50%, rgba(229, 172, 142, 0));
}
.art-btn:hover {
  background-color: #000;
  border-color: #000;
  color: #fff;
}
.art-btn:hover:after {
  -webkit-animation: shine 1.2s;
          animation: shine 1.2s;
}

.art-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  padding: 3rem;
  text-align: left;
}
.art-content.visible {
  display: block;
}

.art-fullName {
  font-size: 8rem;
  font-family: pirou, Helvetica, Arial, sans-serif;
  -webkit-transform: translateX(-150%) translateY(-150%) scale(0.5);
          transform: translateX(-150%) translateY(-150%) scale(0.5);
  -webkit-transition: -webkit-transform 0.3s;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
}

.art-text {
  font-size: 3rem;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  -webkit-transform: scale(0.1);
          transform: scale(0.1);
  opacity: 0;
  -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
  transition: opacity 0.3s, -webkit-transform 0.3s;
  transition: transform 0.3s, opacity 0.3s;
  transition: transform 0.3s, opacity 0.3s, -webkit-transform 0.3s;
  -webkit-transform-origin: 50% 100%;
          transform-origin: 50% 100%;
}

.art-close {
  position: absolute;
  top: -1.8rem;
  right: 0.5rem;
  -webkit-transform: translateX(150%) translateY(-150%) scale(0.5);
          transform: translateX(150%) translateY(-150%) scale(0.5);
  -webkit-transition: -webkit-transform 0.3s;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
}
.art-close:hover {
  opacity: 0.5;
}
.art-close:before {
  content: "+";
  font-size: 8rem;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  cursor: pointer;
}

.svg-matter {
  z-index: 10;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.svg-matter.above {
  z-index: 30;
}

.nav-top {
  z-index: 10;
  position: fixed;
  width: 100%;
  top: 1rem;
  left: 0;
  text-align: center;
}
@media (max-width: 992px) {
  .nav-top {
    top: 0.2rem;
  }
}
.nav-top__heading {
  font-size: 4rem;
  line-height: 4rem;
  font-family: pirou, Helvetica, Arial, sans-serif;
  text-transform: uppercase;
  color: #fff;
}
.nav-top__pagination {
  display: inline-block;
  vertical-align: top;
  overflow: hidden;
  height: 4rem;
}
.nav-top__pagination .level-pagi {
  -webkit-transition: -webkit-transform 0.3s;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
}
.nav-top__btn {
  display: inline-block;
  vertical-align: top;
  -webkit-transition: color 0.3s;
  transition: color 0.3s;
  cursor: pointer;
  line-height: 4rem;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
.nav-top__btn:hover {
  color: #F44336;
}
.nav-top__btn.up {
  font-size: 5rem;
}

.nav-bot {
  z-index: 10;
  position: fixed;
  width: 100%;
  bottom: 1rem;
  left: 0;
  -webkit-transition: -webkit-transform 0.2s cubic-bezier(0.72, 0.17, 0.68, 1.46);
  transition: -webkit-transform 0.2s cubic-bezier(0.72, 0.17, 0.68, 1.46);
  transition: transform 0.2s cubic-bezier(0.72, 0.17, 0.68, 1.46);
  transition: transform 0.2s cubic-bezier(0.72, 0.17, 0.68, 1.46), -webkit-transform 0.2s cubic-bezier(0.72, 0.17, 0.68, 1.46);
  text-align: center;
}
@media (max-width: 992px) {
  .nav-bot {
    bottom: 0.2rem;
  }
}
.nav-bot.inactive {
  -webkit-transform: scale(0.01);
          transform: scale(0.01);
}
.nav-bot span {
  display: inline-block;
}
.nav-bot__btn {
  width: 2rem;
  height: 2rem;
  border: 0.4rem solid #fff;
  border-left: none;
  border-bottom: none;
  -webkit-transition: border-color 0.3s;
  transition: border-color 0.3s;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
.nav-bot__btn.left {
  -webkit-transform: translateY(-0.2rem) rotate(-135deg);
          transform: translateY(-0.2rem) rotate(-135deg);
}
.nav-bot__btn.right {
  -webkit-transform: translateY(-0.2rem) rotate(45deg);
          transform: translateY(-0.2rem) rotate(45deg);
}
.nav-bot__btn:hover {
  border-color: #F44336;
}
.nav-bot__pagi {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border: 4px solid #fff;
  border-radius: 50%;
  margin: 0 0.2rem;
  -webkit-transition: border-color 0.3s, background-color 0.3s;
  transition: border-color 0.3s, background-color 0.3s;
  cursor: pointer;
}
.nav-bot__pagi:hover {
  border-color: #F44336;
}
.nav-bot__pagi.active {
  background: #fff;
}

@-webkit-keyframes shake {
  5% {
    -webkit-transform: translateX(-1%) translateY(1%);
            transform: translateX(-1%) translateY(1%);
  }
  15% {
    -webkit-transform: translateX(1%) translateY(-1%);
            transform: translateX(1%) translateY(-1%);
  }
  25% {
    -webkit-transform: translateX(-1%) translateY(-1%);
            transform: translateX(-1%) translateY(-1%);
  }
  35% {
    -webkit-transform: translateX(1%) translateY(1%);
            transform: translateX(1%) translateY(1%);
  }
  45% {
    -webkit-transform: translateX(-1%) translateY(1%);
            transform: translateX(-1%) translateY(1%);
  }
  55% {
    -webkit-transform: translateX(1%) translateY(-1%);
            transform: translateX(1%) translateY(-1%);
  }
  65% {
    -webkit-transform: translateX(-1%) translateY(-1%);
            transform: translateX(-1%) translateY(-1%);
  }
  75% {
    -webkit-transform: translateX(1%) translateY(1%);
            transform: translateX(1%) translateY(1%);
  }
  85% {
    -webkit-transform: translateX(-1%) translateY(1%);
            transform: translateX(-1%) translateY(1%);
  }
  95% {
    -webkit-transform: translateX(1%) translateY(-1%);
            transform: translateX(1%) translateY(-1%);
  }
}

@keyframes shake {
  5% {
    -webkit-transform: translateX(-1%) translateY(1%);
            transform: translateX(-1%) translateY(1%);
  }
  15% {
    -webkit-transform: translateX(1%) translateY(-1%);
            transform: translateX(1%) translateY(-1%);
  }
  25% {
    -webkit-transform: translateX(-1%) translateY(-1%);
            transform: translateX(-1%) translateY(-1%);
  }
  35% {
    -webkit-transform: translateX(1%) translateY(1%);
            transform: translateX(1%) translateY(1%);
  }
  45% {
    -webkit-transform: translateX(-1%) translateY(1%);
            transform: translateX(-1%) translateY(1%);
  }
  55% {
    -webkit-transform: translateX(1%) translateY(-1%);
            transform: translateX(1%) translateY(-1%);
  }
  65% {
    -webkit-transform: translateX(-1%) translateY(-1%);
            transform: translateX(-1%) translateY(-1%);
  }
  75% {
    -webkit-transform: translateX(1%) translateY(1%);
            transform: translateX(1%) translateY(1%);
  }
  85% {
    -webkit-transform: translateX(-1%) translateY(1%);
            transform: translateX(-1%) translateY(1%);
  }
  95% {
    -webkit-transform: translateX(1%) translateY(-1%);
            transform: translateX(1%) translateY(-1%);
  }
}
@-webkit-keyframes shine {
  to {
    -webkit-transform: skewX(-30deg) translateX(600%);
            transform: skewX(-30deg) translateX(600%);
  }
}
@keyframes shine {
  to {
    -webkit-transform: skewX(-30deg) translateX(600%);
            transform: skewX(-30deg) translateX(600%);
  }
}
JS
$(document).ready(function() {
  
  var $levels = $(".level"),
      numOfLevels = $levels.length,
      curLevel = 1,
      $curLevel = $(".level.active"),
      $levelPagi = $(".level-pagi"),
      $elems = $curLevel.find(".elem"),
      numOfPages = $elems.length,
      curPage = 1,
      $rotater = $curLevel.find(".rotater"),
      stepAngle = 360 / numOfPages,
      $botPagi = $(".nav-bot__pagi"),
      $navBot = $(".nav-bot"),
      SCENEPERS = 200,
      MULTI_Z = 13,
      LEVELANIM = 1000,
      SIDEANIM = 500,
      animating = false;
  
  function placeElems() {
    $levels.each(function() {
      var $elems = $(this).find(".elem"),
          len = $elems.length,
          angle = 360 / len,
          ELEM_Z = len * MULTI_Z;
      
      $(this).attr("data-elemZ", ELEM_Z);
      $elems.each(function(i) {
        $(this).css("transform", "rotateY("+ (0 - i * angle) +"deg) translateZ("+ (0 - ELEM_Z) +"vw)");
      });
    });
  }
  
  placeElems();
  
  function recreateBottomNav() {
    $(".nav-bot__pagi").remove();
    var newPagi = [];
    for (var i = 1; i <= numOfPages; i++) {
      var $botPagiEl = $(""),
          activeEl = +$curLevel.attr("data-curpage") || 1;
      if (i === activeEl) $botPagiEl.addClass("active");
      newPagi.push($botPagiEl);
    }
    $(".nav-bot__btn.left").after(newPagi);
    $botPagi = $(".nav-bot__pagi");
  }
  
  function redefineVars() {
    $curLevel = $(".level.active");
    $elems = $curLevel.find(".elem");
    numOfPages = $elems.length;
    curPage =  $curLevel.find(".elem.active").index() + 1 || 1;
    $rotater = $curLevel.find(".rotater");
    stepAngle = 360 / numOfPages;
  }
  
  function changeLevel() {
    $(".level").removeClass("active");
    $(".level-" + curLevel).addClass("active");
    $navBot.addClass("inactive");
    
    animating = true;
    
    setTimeout(function() {
      redefineVars();
      recreateBottomNav();

      $levels.css("transform", "translate3d(0,"+ (0 - (curLevel - 1) * 150) +"%,0)");
      $levelPagi.css("transform", "translate3d(0,"+ (0 - (curLevel - 1) * 100) +"%,0)");
      
      setTimeout(function() {
        $navBot.removeClass("inactive");
      }, 600);
      
    }, 200);
    
    setTimeout(function() {
      animating = false;
    }, LEVELANIM);
  }
  
  function navigateUp() {
    if (curLevel > 1) {
      curLevel--;
      changeLevel();
    }
  }

  function navigateDown() {
    if (curLevel < numOfLevels) {
      curLevel++;
      changeLevel();
    }
  }
  
  function sideNavigation(directPage) {
    if (directPage) {
      var diff = Math.abs(directPage - curPage),
          dirRight = directPage > curPage,
          curAngle = +$rotater.attr("data-angle") || 0;
      if (dirRight && diff > numOfPages/2) {
        dirRight = false;
        diff = numOfPages - diff;
      } else if (!dirRight && diff > numOfPages/2) {
        dirRight = true;
        diff = numOfPages - diff;
      }
      var nextAngle = (dirRight) ? curAngle + stepAngle * diff : curAngle - stepAngle * diff;
      curPage = directPage;
      $rotater.attr("data-angle", nextAngle).css("transform", "rotateY("+ nextAngle +"deg)");
    }
    $elems.removeClass("active");
    $elems.eq(curPage - 1).addClass("active");
    $botPagi.removeClass("active");
    $botPagi.eq(curPage - 1).addClass("active");
    $curLevel.attr("data-curpage", curPage);
    animating = true;
    setTimeout(function() {
      animating = false;
    }, SIDEANIM);
  }
  
  function navigateLeft() {
    var curAngle = +$rotater.attr("data-angle") || 0,
        nextAngle = curAngle - stepAngle;
    $rotater.attr("data-angle", nextAngle).css("transform", "rotateY("+ nextAngle +"deg)");
    (curPage > 1) ? curPage-- : curPage = numOfPages;
    sideNavigation();
  }
  
  function navigateRight() {
    var curAngle = +$rotater.attr("data-angle") || 0,
        nextAngle = curAngle + stepAngle;
    $rotater.attr("data-angle", nextAngle).css("transform", "rotateY("+ nextAngle +"deg)");
    (curPage < numOfPages) ? curPage++ : curPage = 1;
    sideNavigation();
  }
  
  var winW = $(window).width(),
      winH = $(window).height(),
      pathD,
      pathDCopy,
      bigArr = [],
      path,
      rndArr,
      $pickedElem,
      pickedZ;
  
  function range(n) {
    return Array.apply(null, {length: n}).map(Number.call, Number)
  }
  
  function createSvg($el, points) {
    var $el = $el,
        points = points,
        bgColor = $el.css("background-color"),
        elW = $el.width(),
        elH = $el.height(),
        minW = (winW - elW) / 2,
        maxW = winW - minW,
        minH = (winH - elH) / 2,
        maxH = (winH - minH),
        pps = Math.round(points / 4), // POINTS PER SIDE
        stepW = elW / pps,
        stepH = elH / pps,
        bigStepW = winW / pps,
        bigStepH = winH / pps,
        arr = [],
        $svg = $("");

    rndArr = range(pps * 4);

    if (pps > 1) {
      for (var i = 0; i < pps; i++) {
        arr[i] = (minW + stepW * i) + "," + minH;
        bigArr[i] = (bigStepW * i) + ",0";
        arr[i + pps] = maxW + "," + (minH + stepH * i);
        bigArr[i + pps] = winW + "," + (bigStepH * i);
        arr[i + pps*2] = (maxW - stepW * i) + "," + maxH;
        bigArr[i + pps*2] = (winW - bigStepW * i) + "," + winH;
        arr[i + pps*3] = minW + "," + (maxH - stepH * i);
        bigArr[i + pps*3] = "0," + (winH - bigStepH * i);
      }
    }

    arr[0] = "M" + arr[0];
    bigArr[0] = "M" + bigArr[0];
    pathDCopy = arr;
    pathD = arr.join(" ");
    $svg.find("path").attr("d", pathD);
    $("body").append($svg);
    return $svg;
  }
  
  function newD(points, p) {
    var arr = points.split(" ");
    arr[p] = bigArr[p];
    return arr.join(" ");
  }
  
  function animateLoop(elem, len, justAnimate) {
    var length = $(elem).attr("d").split(" ").length,
        len = len,
        ast = 8,
        dur = 100,
        duration = Math.floor(Math.random() * dur  + dur / 2),
        atSameTime = Math.floor(len / ast) || 8;
    if (rndArr.length) {
      while (atSameTime--) {
        var num = rndArr.splice(Math.floor(Math.random() * rndArr.length), 1)[0];
        pathD = newD(pathD, num);
      }
      Snap(elem).animate( { 'path' : pathD }, duration, mina.easeinout, function() { animateLoop(elem, len, justAnimate) } );
    } else {
      if (justAnimate)  {
        $(".svg-matter").remove();
        $(".inner").removeClass("clicked");
        activateHandlers();
        animating = false;
        return;
      }
      $pickedElem.find(".art-content").addClass("visible");
      $pickedElem.addClass("instant-transition");
      $pickedElem.find(".inner").addClass("instant-transition");
      $pickedElem.css("top");
      $pickedElem.find(".inner").css("transform", "translateZ("+ pickedZ +"vw)")
      bigArr = pathDCopy;
      $(".scene").addClass("content-visible");
      $pickedElem.addClass("content-visible full-screen");
    }
  }
  
  function elemClick() {
    if (animating) return;
    var $inner = $(this).parent(),
        $elem = $inner.parent(),
        bgColor = $inner.css("background-color"),
        innerZDiff = 15,
        z = +$elem.parents(".level.active").attr("data-elemz"),
        coef = SCENEPERS / (SCENEPERS + z - innerZDiff),
        w = Math.ceil($elem.width() * coef) + 1,
        h = Math.ceil($elem.height() * coef),
        left = ($elem.width() - w) / 2 + $(window).width() / 10,
        top = ($elem.height() - h) / 2;
    
    animating = true;
    removeHandlers();
    $pickedElem = $elem;
    pickedZ = z;

    var $div = $("
"); $div.css({"position": "absolute", "width": w, "height": h, "background": bgColor, "z-index": 15, "top": top, "left": left}); $inner.addClass("clicked"); setTimeout(function() { $curLevel.append($div); $div.addClass("shake"); setTimeout(function() { $div.removeClass("shake"); createSvg($div, 32); $div.remove(); animateLoop(".svg-matter path", 32); }, 400); }, 300); } $(document).on("click", ".elem:not(.active) .art-btn", function() { if (animating) return; var that = this; setTimeout(function() { $(that).trigger("click"); }, SIDEANIM + 50); }); $(document).on("click", ".elem.active .art-btn", elemClick); function activateHandlers() { $(document).on("mousewheel DOMMouseScroll", function(e) { if (animating) return; if (e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0) { navigateUp(); } else { navigateDown(); } }); $(document).on("keydown", function(e) { if (animating) return; if (e.which === 37) { navigateLeft(); } else if (e.which === 38) { navigateUp(); } else if (e.which === 39) { navigateRight(); } else if (e.which === 40) { navigateDown(); } }); } activateHandlers(); function removeHandlers() { $(document).off("mousewheel DOMMouseScroll"); $(document).off("keydown"); } $(document).on("click", ".nav-top__btn", function() { if (animating) return; if ($(this).hasClass("up")) { navigateUp(); } else { navigateDown(); } }); $(document).on("click", ".nav-bot__btn", function() { if (animating) return; if ($(this).hasClass("left")) { navigateLeft(); } else { navigateRight(); } }); $(document).on("click", ".nav-bot__pagi:not(.active)", function() { if (animating) return; sideNavigation(+$(this).attr("data-page")); }); $(document).on("click", ".elem:not(.active)", function() { if (animating) return; sideNavigation(+$(this).index() + 1); }); $(document).on("click", ".art-close", function() { $pickedElem.removeClass("content-visible"); setTimeout(function() { $(".svg-matter").attr("class", "svg-matter above"); $pickedElem.removeClass("full-screen instant-transition"); $pickedElem.find(".inner").attr("style", ""); $pickedElem.find(".art-content").removeClass("visible").removeClass("instant-transition"); $pickedElem.find(".inner").removeClass("instant-transition"); $pickedElem.css("top"); $(".scene").removeClass("content-visible"); rndArr = range(32); animateLoop(".svg-matter path", 32, true); }, 300); }); $(window).resize(function() { winW = $(window).width(); winH = $(window).height(); }); });
Host Instantly Drag and Drop Website Builder

 

Description

You can navigate with buttons, mouse clicks/scroll and arrow keys. Be sure to click READ MORE on various blocks and then close them, it's cool!
Term
Mon, 11/27/2017 - 21:56

Related Codes

Pen ID
Pen ID
Pen ID