InVision - How to make awesome GIFs

In this example below you will see how to do a InVision - How to make awesome GIFs with some HTML / CSS and Javascript

Cool animation concept by Andy Orsow from InVision https://dribbble.com/andyorsowCoded by me https://machycek.me

Thumbnail
This awesome code was written by machycek, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright machycek ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>InVision - How to make awesome GIFs</title>
  
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <section><div class="wrap">
    <img class="plus" src="https://bit.ly/plusSVGm" alt="plus"/>
  </div>
  <div class="content">
    <img src="https://d13yacurqjgara.cloudfront.net/users/49214/avatars/normal/andy-2014.jpg?1404255823" alt=""/>
    <img src="https://d13yacurqjgara.cloudfront.net/users/10009/avatars/normal/f6880fc58ebdaf2ab476a2a68ebf9244.jpg?1409785752" alt=""/>
    <img src="https://pbs.twimg.com/profile_images/600736445762916352/SgThS8tN.jpg" alt=""/>
  </div>
  <div class="circle"></div>
</section>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/machycek/invision-how-to-make-awesome-gifs-YPZbJy */
body {
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: #2c323c;
}

section {
  float: left;
  width: 100%;
  height: 100%;
  padding: 100px;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
section.active .content {
  opacity: 1;
}
section.active .circle {
  -moz-transform: translate(0px, 0) scale(100);
  -ms-transform: translate(0px, 0) scale(100);
  -webkit-transform: translate(0px, 0) scale(100);
  transform: translate(0px, 0) scale(100);
}
section.active .wrap {
  -moz-transform: translate(0px, 0);
  -ms-transform: translate(0px, 0);
  -webkit-transform: translate(0px, 0);
  transform: translate(0px, 0);
}
section.active .wrap .plus {
  -moz-transform: rotate(-315deg);
  -ms-transform: rotate(-315deg);
  -webkit-transform: rotate(-315deg);
  transform: rotate(-315deg);
}
section.active .wrap:hover {
  -moz-transform: translate(0px, 0);
  -ms-transform: translate(0px, 0);
  -webkit-transform: translate(0px, 0);
  transform: translate(0px, 0);
}
section .wrap {
  position: relative;
  z-index: 2;
  float: left;
  width: 25px;
  height: 25px;
  padding: 15px;
  cursor: pointer;
  background: #2c6fb6;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  -moz-box-shadow: 0 0 0 -2px #2c323c, 0 0 0 -1px rgba(44, 111, 182, 0.3);
  -webkit-box-shadow: 0 0 0 -2px #2c323c, 0 0 0 -1px rgba(44, 111, 182, 0.3);
  box-shadow: 0 0 0 -2px #2c323c, 0 0 0 -1px rgba(44, 111, 182, 0.3);
  -moz-transform-origin: 50% 50%;
  -ms-transform-origin: 50% 50%;
  -webkit-transform-origin: 50% 50%;
  transform-origin: 50% 50%;
  -moz-transition: all 0.3s, -moz-transform 0.5s;
  -o-transition: all 0.3s, -o-transform 0.5s;
  -webkit-transition: all 0.3s, -webkit-transform 0.5s;
  transition: all 0.3s, transform 0.5s;
  -moz-transform: translate(100px, 0);
  -ms-transform: translate(100px, 0);
  -webkit-transform: translate(100px, 0);
  transform: translate(100px, 0);
}
section .wrap img.plus {
  -moz-transition: -moz-transform 0.5s;
  -o-transition: -o-transform 0.5s;
  -webkit-transition: -webkit-transform 0.5s;
  transition: transform 0.5s;
}
section .wrap:hover {
  /*  @include box-shadow(0 0 0 30px $primary-color, 0 0 0 31px $light-sc);*/
  background: #245b95;
  -moz-transform: translate(100px, 0) scale(0.9);
  -ms-transform: translate(100px, 0) scale(0.9);
  -webkit-transform: translate(100px, 0) scale(0.9);
  transform: translate(100px, 0) scale(0.9);
}

.circle {
  position: absolute;
  /*  z-index: 3;*/
  width: 47px;
  height: 47px;
  margin: 4px;
  background: #2c6fb6;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  -moz-transform: translate(100px, 0) scale(1);
  -ms-transform: translate(100px, 0) scale(1);
  -webkit-transform: translate(100px, 0) scale(1);
  transform: translate(100px, 0) scale(1);
  -moz-transition: -moz-transform 0.8s;
  -o-transition: -o-transform 0.8s;
  -webkit-transition: -webkit-transform 0.8s;
  transition: transform 0.8s;
}

.content {
  position: relative;
  z-index: 2;
  float: left;
  height: 50px;
  margin-left: 120px;
  /*  opacity: 0;*/
  -moz-transition: opacity 0.3s 0.1s;
  -o-transition: opacity 0.3s 0.1s;
  -webkit-transition: opacity 0.3s;
  -webkit-transition-delay: 0.1s;
  transition: opacity 0.3s 0.1s;
}
.content img {
  width: 50px;
  height: 50px;
  margin-right: 20px;
  opacity: 0;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  -moz-transition: all 0.3s 0.1s;
  -o-transition: all 0.3s 0.1s;
  -webkit-transition: all 0.3s;
  -webkit-transition-delay: 0.1s;
  transition: all 0.3s 0.1s;
  -moz-transform: translate(0, 50px);
  -ms-transform: translate(0, 50px);
  -webkit-transform: translate(0, 50px);
  transform: translate(0, 50px);
}
.content img:last-child {
  margin-right: 0;
}
.content img:hover {
  cursor: pointer;
  -moz-transition: -moz-transform 0.3s;
  -o-transition: -o-transform 0.3s;
  -webkit-transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  -moz-transform: scale(1.1, 1.1);
  -ms-transform: scale(1.1, 1.1);
  -webkit-transform: scale(1.1, 1.1);
  transform: scale(1.1, 1.1);
}
.content .fadeIn {
  opacity: 1;
  -moz-transform: translate(0, 0);
  -ms-transform: translate(0, 0);
  -webkit-transform: translate(0, 0);
  transform: translate(0, 0);
  -moz-animation: showImage 0.5s cubic-bezier(0.77, 0.33, 0.56, 0.89);
  -webkit-animation: showImage 0.5s cubic-bezier(0.77, 0.33, 0.56, 0.89);
  animation: showImage 0.5s cubic-bezier(0.77, 0.33, 0.56, 0.89);
}

@-webkit-keyframes showImage {
  0% {
    opacity: 0;
    -moz-transform: translate(0, 50px);
    -ms-transform: translate(0, 50px);
    -webkit-transform: translate(0, 50px);
    transform: translate(0, 50px);
  }
  80% {
    opacity: 1;
    -moz-transform: translate(0, -7px);
    -ms-transform: translate(0, -7px);
    -webkit-transform: translate(0, -7px);
    transform: translate(0, -7px);
  }
  100% {
    opacity: 1;
    -moz-transform: translate(0, 0);
    -ms-transform: translate(0, 0);
    -webkit-transform: translate(0, 0);
    transform: translate(0, 0);
  }
}


/*Downloaded from https://www.codeseek.co/machycek/invision-how-to-make-awesome-gifs-YPZbJy */
var images = $('.content img');
$('.wrap').on('click', function(){
  fadeOut();
  $('section').toggleClass('active');
});

function fadeOut(){
  if (images.hasClass('fadeIn')){
    for(var i = 1; i <= images.length; i++){
      (function(i){
        setTimeout(function(){
          $('.content img:nth-child('+i+')').removeClass('fadeIn');
        },i*50);
      })(i);
    }
  } else{
    for(var i = 1; i <= images.length; i++){
      (function(i){
        setTimeout(function(){
          $('.content img:nth-child('+i+')').addClass('fadeIn');
        },i*80);
      })(i);
    }
  }
}

Comments