Hover Radiation

In this example below you will see how to do a Hover Radiation with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by chrismbarr, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright chrismbarr ©
  • HTML
  • CSS
  • JavaScript
    <div id="thing"></div>

/*Downloaded from https://www.codeseek.co/chrismbarr/hover-radiation-viDoj */
    $size: 200px;
$color: #059998;

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

body{
  background-color: #333;
}

#thing{
  transition: all 0.3s;
  -webkit-transition: all 0.3s;
  
  &,
  &:after,
  &:before{
    //Style it
    border: 5px solid $color;
    border-radius: 50%;

    //Center it
    position: absolute;
    top:50%;
    left: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);

    //Size it
    height: $size;
    width: $size;
  }
  
  &:after,
  &:before{
    content:'';
    display: block;
  }
  
  &:hover{
    background-color: transparentize($color, 0.9);
    
    &:before{
      -webkit-animation: thing-animation 1s infinite linear;
    }
  
    &:after{
      -webkit-animation: thing-animation 1s 0.3s infinite linear;
    }
  }
}

@-webkit-keyframes thing-animation{
  0%{
    opacity:0;
    -webkit-transform: translate(-50%, -50%) scale(1);
  }
  40%{
    opacity:1;
  }
  80%,100%{
    opacity:0;
    -webkit-transform: translate(-50%, -50%) scale(1.5);
  }
}


/*Downloaded from https://www.codeseek.co/chrismbarr/hover-radiation-viDoj */
    

Comments