.main-content
h1 Are you staying in or going out?
.illustration
.boy
img(src="https://meowlivia.s3.us-east-2.amazonaws.com/codepen/boy.svg" width="90px")
.person-type-wrapper
.person-type.active.home-body
.scenery
img(src="https://meowlivia.s3.us-east-2.amazonaws.com/codepen/indoor.svg" height="250")
.background-items
img(src="https://meowlivia.s3.us-east-2.amazonaws.com/codepen/furniture.svg" width="270")
.foreground-items
img(src="https://meowlivia.s3.us-east-2.amazonaws.com/codepen/playstation.svg" width="65")
.person-type.outdoor-person
.scenery
img(src="https://meowlivia.s3.us-east-2.amazonaws.com/codepen/outdoor.svg" height="250")
.background-items
img(src="https://meowlivia.s3.us-east-2.amazonaws.com/codepen/sky.svg" width="220")
.foreground-items
img(src="https://meowlivia.s3.us-east-2.amazonaws.com/codepen/dogtree.svg" width="200")
.option-wrapper
.option.active(data-option="home") I'm attached to my home.
.option(data-option="outdoor") Hell yeah, I love the outdoors!
aside.context
.explanation
| Part I of CSS Animations Experiment.
a(href="https://codepen.io/oliviale/details/ELPvLM" target="_blank") Part II here.
footer
a(href="https://twitter.com/meowlivia_" target="_blank")
i.icon-social-twitter.icons
a(href="https://github.com/oliviale" target="_blank")
i.icon-social-github.icons
a(href="https://dribbble.com/oliviale" target="_blank")
i.icon-social-dribbble.icons
View Compiled
body {
background: radial-gradient(#444, #53346d);
font-family: "Comfortaa", sans-serif;
}
.main-content {
max-width: 700px;
margin: 4em auto 0;
text-align: center;
}
h1 {
margin: 2em 0;
color: #fff;
}
svg {
display: inline-block;
}
.illustration {
position: relative;
align-self: end;
margin: auto;
height: 250px;
width: 250px;
}
.boy,
.scenery,
.background-items,
.foreground-items {
position: absolute;
left: 0;
right: 0;
margin: auto;
}
.scenery {
transition: all 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.background-items {
transition: all 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55) 100ms;
top: 23px;
}
.foreground-items {
transition: all 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55) 200ms;
bottom: 20px;
}
.home-body {
.foreground-items {
margin-left: -60px;
}
}
.outdoor-person {
.foreground-items {
margin-right: -80px;
}
}
.boy {
bottom: 25px;
margin-right: -65px;
z-index: 10;
}
.person-type > div {
transform: scale(0);
opacity: 0;
}
.person-type.active > div {
transform: scale(1);
opacity: 1;
}
.option-wrapper {
display: flex;
margin: 3em auto;
background: rgba(255, 255, 255, 0.25);
border-radius: 4px;
padding: 5px;
max-width: 300px;
font-size: 12px;
line-height: 1.2;
.option {
transition: all 200ms ease;
padding: 10px 10px 8px;
width: 50%;
border-radius: 4px;
cursor: pointer;
color: #fff;
&.active {
background: #fff;
color: #333;
pointer-events: none;
}
}
}
aside.context {
text-align: center;
color: #fff;
a {
text-decoration: none;
color: #fff;
padding: 3px 0;
border-bottom: 1px dashed;
}
.explanation {
max-width: 700px;
margin: 4em auto;
}
}
footer {
text-align: center;
margin: 8em auto;
width: 100%;
a {
text-decoration: none;
display: inline-block;
width: 45px;
height: 45px;
border-radius: 50%;
background: transparent;
border: 1px dashed #fff;
color: #fff;
margin: 5px;
&:hover {
background: rgba(255, 255, 255, 0.1);
}
.icons {
margin-top: 12px;
display: inline-block;
font-size: 20px;
}
}
}
View Compiled
$(".option").on("click", function() {
$(".person-type").removeClass("active");
$(".option").removeClass("active");
$(this).addClass("active");
var type = $(this).data("option");
console.log($(type));
setTimeout(function() {
if (type === "home") {
$(".home-body").addClass("active");
} else if (type === "outdoor") {
$(".outdoor-person").addClass("active");
}
}, 500);
});