.button
each b in [1,2]
.hex
each h in [1,2,3]
div
View Compiled
// Hexagon
$sqrt3: 1.7320508075688772;
$edgeSize: 100px;
$hexWidth: $edgeSize * 2;
$hexHeight: $sqrt3 * $edgeSize;
// Display
$borderHover: 15px;
$soft-white: rgba(255,255,255,1);
// Easing
$ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
$ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
body {
background: #151515;
margin-top: 100px;
}
.button {
position: absolute;
top: 50%;
left: 50%;
transform: translate3d(-50%,-50%,0) rotate(30deg);
}
/* End of container */
// Contains 2 hexagons (.hex)
.button {
cursor: pointer;
width: $hexWidth;
height: $hexHeight;
float: left;
&:last-child {
margin-right: 0;
}
// Hover state
&:hover {
.hex:last-child {
opacity: 1;
transform: scale(1.3);
}
.hex:first-child {
opacity: 1;
div:before, div:after {
height: $borderHover;
}
transform: scale(1.2);
}
}
}
// Contains 3 div that makes the hexagon
.hex {
position: absolute;
top: 0;
left: $edgeSize/2;
width: $edgeSize;
height: $hexHeight;
opacity: 0.5;
// Inset
&:first-child {
transform: scale(0.9);
transition: all 0.3s $ease-out-quart;
z-index: 0;
}
// Outset
&:last-child {
transition: all 0.3s $ease-out-expo;
z-index: 1;
}
div {
box-sizing: border-box;
position: absolute;
top: 0;
width: $edgeSize;
height: $hexHeight;
&:before, &:after {
content: ' ';
position: absolute;
background: $soft-white;
width: 100%;
height: 1px;
transition: height 0.3s $ease-out-quart;
}
&:before {
top: 0;
}
&:after {
bottom: 0;
}
&:nth-child(1) {
transform: rotate(0deg);
}
&:nth-child(2) {
transform: rotate(60deg);
}
&:nth-child(3) {
transform: rotate(120deg);
}
transform-origin: center center;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.