Skip to content

Instantly share code, notes, and snippets.

@msisto
Last active August 29, 2015 14:07
Show Gist options
  • Save msisto/77ab4de8d9c20693ac41 to your computer and use it in GitHub Desktop.
Save msisto/77ab4de8d9c20693ac41 to your computer and use it in GitHub Desktop.
A Pen by Matt Sisto.
%figure
%aside
%aside
%aside
%aside
%section
%p Metaball. Hover over me!
@import "bourbon";
$size: 300px;
$background: #DCDEE1;
$color: #2D72D9;
* {
@include box-sizing(border-box);
}
body {
background: $background;
}
p {
color: $color;
font-family: Avenir, $helvetica;
font-size: 26px;
font-weight: 100;
text-align: center;
width: $size*1.5;
}
// Metaball container
figure {
@include size($size);
@include transform(rotate(45deg));
margin: $size/4;
position: relative;
// Circles
aside {
@include size($size/2);
@include transition;
border: 3px solid transparent;
border-radius: 50%;
float: left;
position: relative;
&:nth-child(1),
&:nth-child(4) {
background: $color;
border-color: $color;
}
// Negative space
&:nth-child(2),
&:nth-child(3) {
background: $background;
border-color: $background;
z-index: 1000;
}
}
// Square "fill"
section {
$section-size: $size/2.73;
@include position(absolute, 50% 0 0 50%);
@include size($section-size);
@include transform(rotate(135deg));
@include transition;
background: $color;
border: 3px solid transparent;
margin-left: -($section-size/2);
margin-top: -($section-size/2);
z-index: 10;
}
&:hover {
aside, section {
background: none;
border-color: $color;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment