<div class="container">
<div class="circle"></div>
<div class="square"></div>
</div>
<div class="actions">
<button id="play">Play</button>
</div>
@import url("https://fonts.googleapis.com/css?family=Gochi+Hand");
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
width: 100vw;
min-height: 100vh;
margin: 0;
background-color: #291642;
font-family: "Gochi Hand", sans-serif;
font-size: 100%;
letter-spacing: 0.1rem;
color: #fff;
display: flex;
flex-direction: column;
align-items: center;
background: linear-gradient(to right, #44ea76 0%, #39fad7 80%, #39fad7 100%)
no-repeat,
url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/slider-2.jpg")
no-repeat fixed;
background-size: cover;
background-blend-mode: hue;
}
.container {
flex: 1;
min-height: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.actions {
padding: 3vh;
display: flex;
justify-content: center;
align-items: center;
background-color: rgba(0, 0, 0, 0.5);
width: 100%;
}
button {
display: inline-flex;
align-items: center;
font-size: 1.2rem;
height: 3rem;
padding: 0.2rem 3.2rem;
color: rgba(255, 255, 255, 0.8);
background: #ff3366;
border-radius: 10rem;
border: none;
cursor: pointer;
margin: 0 2vh;
transition: all 1s ease-in;
transform-origin: center;
}
button:hover {
box-shadow: inset 0 0 3px 5px currentColor;
transform: rotate(2deg) skew(1deg, -1deg);
}
.circle,
.square {
height: 80px;
width: 80px;
border-radius: 50%;
background: #f36;
box-shadow: inset -10px -10px 10px rgba(0, 0, 0, 0.6);
margin: auto;
}
.square {
background-color: #f90;
border-radius: 10px;
}
View Compiled
const handlePlay = document.getElementById("play");
const circle = gsap.set(".circle", {
x: 100,
y: 50,
opacity: 0.5,
paused: true
});
const square = gsap.to(".square", {
duration: 0,
x: 100,
y: 50,
opacity: 0.5,
paused: true
});
handlePlay.addEventListener("click", () => {
circle.play();
square.play();
});
View Compiled
This Pen doesn't use any external CSS resources.