LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

Choose your starter!

CSS
*, *:before, *:after {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  font-family: "Montserrat", sans-serif;
  font-size: 1em;
  line-height: 1.6;
  background: #FFECB3;
}

h1 {
  font-size: 1.4em;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .15em;
  margin-bottom: .5em;
}

.container {
  width: 80%;
  display: block;
  margin: 100px auto;
  text-align: center;
}

.pokeball {
  display: inline-block;
  margin: 20px;
  width: 100px;
  height: 100px;
  background: #b71c1c;
  border-radius: 50%;
  box-shadow: inset 0 -72px 0 -37px #fff, inset 0 -76px 0 -35px #000, 0 0 0 5px #000;
  position: relative;
  -webkit-transition: .4s;
  transition: .4s;
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}
.pokeball:before {
  display: block;
  content: "";
  position: absolute;
  width: 100%;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #fff;
  top: 50px;
  left: 40px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: 2px 0 0 0 rgba(0, 0, 0, 0.2), 0 0 0 5px #fff, 0 0 0 10px #000;
}
.pokeball:after {
  display: block;
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset -7px 0 5px 0 rgba(0, 0, 0, 0.4);
}
.pokeball:hover {
  cursor: pointer;
  -webkit-animation: anti-wiggle 1s ease-in-out;
          animation: anti-wiggle 1s ease-in-out;
}
.pokeball:hover:after {
  -webkit-animation: wiggle 1s ease-in-out;
          animation: wiggle 1s ease-in-out;
}
.pokeball:focus, .pokeball:active {
  outline: 0;
}

@-webkit-keyframes wiggle {
  20% {
    box-shadow: inset -5px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(7deg);
            transform: rotate(7deg);
  }
  40% {
    box-shadow: inset -11px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(-14deg);
            transform: rotate(-14deg);
  }
  60% {
    box-shadow: inset -5px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(4deg);
            transform: rotate(4deg);
  }
  80% {
    box-shadow: inset -8px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(-2deg);
            transform: rotate(-2deg);
  }
  100% {
    box-shadow: inset -7px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
}

@keyframes wiggle {
  20% {
    box-shadow: inset -5px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(7deg);
            transform: rotate(7deg);
  }
  40% {
    box-shadow: inset -11px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(-14deg);
            transform: rotate(-14deg);
  }
  60% {
    box-shadow: inset -5px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(4deg);
            transform: rotate(4deg);
  }
  80% {
    box-shadow: inset -8px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(-2deg);
            transform: rotate(-2deg);
  }
  100% {
    box-shadow: inset -7px 0 5px 0 rgba(0, 0, 0, 0.4);
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
}
@-webkit-keyframes anti-wiggle {
  20% {
    -webkit-transform: translateX(4px) rotate(-7deg);
            transform: translateX(4px) rotate(-7deg);
  }
  40% {
    -webkit-transform: translateX(-8px) rotate(14deg);
            transform: translateX(-8px) rotate(14deg);
  }
  60% {
    -webkit-transform: translateX(2px) rotate(-4deg);
            transform: translateX(2px) rotate(-4deg);
  }
  80% {
    -webkit-transform: translateX(-1px) rotate(2deg);
            transform: translateX(-1px) rotate(2deg);
  }
  100% {
    -webkit-transform: translateX(0px) rotate(0deg);
            transform: translateX(0px) rotate(0deg);
  }
}
@keyframes anti-wiggle {
  20% {
    -webkit-transform: translateX(4px) rotate(-7deg);
            transform: translateX(4px) rotate(-7deg);
  }
  40% {
    -webkit-transform: translateX(-8px) rotate(14deg);
            transform: translateX(-8px) rotate(14deg);
  }
  60% {
    -webkit-transform: translateX(2px) rotate(-4deg);
            transform: translateX(2px) rotate(-4deg);
  }
  80% {
    -webkit-transform: translateX(-1px) rotate(2deg);
            transform: translateX(-1px) rotate(2deg);
  }
  100% {
    -webkit-transform: translateX(0px) rotate(0deg);
            transform: translateX(0px) rotate(0deg);
  }
}
JS
/* Big thanks to Reddit-user 'morete' for helping me with a problem with the shadow*/

/* Also, thank you 'serrol_' for pointing out that it looks better if the ball moves slightly and not just rotates */
Host Instantly Drag and Drop Website Builder

 

Description

Choose your starter! Pokeballs with a small hover-animation. Enjoy!
Term
Mon, 11/27/2017 - 21:53

Related Codes

Pen ID
Pen ID
Pen ID