Quick radial menu from GSAP

In this example below you will see how to do a Quick radial menu from GSAP with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by midnightviking, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright midnightviking ©
  • HTML
  • CSS
  • JavaScript
    <div class="pie-menu"><span>^</span></div>
<div class="pie-menu m"><span>^</span></div>

/*Downloaded from https://www.codeseek.co/midnightviking/quick-radial-menu-from-gsap-vacgr */
    body{
  background:#222;
  font-family:arial;
}
.pie-menu{
  background:skyblue;
  height:75px;
  width:75px;
  line-height:1.8em;
  font-size:3em;
  color:white;
  text-align:center;
  border-radius:50%;
  cursor:pointer;
  position:absolute;
  top:20%;
  left:40%;
}
.m{top:60%;}
.operand{
  border:1px solid #111;
  background:#666;
  text-align:center;
  position:absolute;
  color:#FFF;
  font-size:0.5em;
  border-radius:50%;
  height:35px;
  width:35px;
  line-height:1.4em;
  padding:0px;
  top:20%;
  left:28%;
  /*display:none;*/
}
.add{
  top:105%;
}
.subtract{
  top:-55%;
}
.multiply{
  left:-55%
}
.divide{
  left:105%;
}



/*Downloaded from https://www.codeseek.co/midnightviking/quick-radial-menu-from-gsap-vacgr */
    var $add, $subtract, $multiply, $divide;
$add = $("<div/>").addClass("operand add").text("+");
$subtract = $("<div/>").addClass("operand subtract").text("-");
$multiply = $("<div/>").addClass("operand multiply").text("x");
$divide = $("<div/>").addClass("operand divide").text("/");

$allItems = [$add, $subtract, $divide, $multiply];

$(document).ready(function(){
  $(".pie-menu").on({
    click:function(){
      //$(this).append($add);
    },
    mouseenter:function(){
      $(this).append($add).append($divide).append($multiply).append($subtract);  
      TweenMax.from($allItems, 0.25, {top:"20%",left:"28%",opacity:0});
      
    },
    mouseleave:function(){
      $multiply.detach();
      $divide.detach();
      $subtract.detach();
      $add.detach();
    }
  });
  
  
  
});

Comments