<div class="container">
<div class="box"></div>
<div class="actions">
<button id="play">Play</button>
<button id="reset">Reset</button>
</div>
</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;
justify-content: center;
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 {
inline-size: 30vw;
border-radius: 5px;
margin: 0 1vh;
box-shadow: 0 20px 30px rgba(0, 0, 0, 0.6);
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
transition: box-shadow 0.3s ease;
background-image: linear-gradient(
to bottom,
rgba(146, 135, 187, 0.8) 0%,
rgba(0, 0, 0, 0.6) 100%
);
backdrop-filter: blur(3px);
min-block-size: 50vh;
display: flex;
flex-direction: column;
align-items: center;
color: #212121;
padding: 4vh 2vh;
}
.box {
width: 20vh;
height: 20vh;
background-color: #2196f3;
border-radius: 100%;
cursor: pointer;
margin: auto;
}
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-top: 4vh;
}
View Compiled
const aniElement = document.querySelector(".box");
const play = document.getElementById("play");
const reset = document.getElementById("reset");
aniElement.style.transitionProperty = "transform";
aniElement.style.transitionDuration = "2s";
aniElement.style.transform = "scale(1, 1)";
play.addEventListener("click", () => {
aniElement.style.transform = "scale(1.5, 1.5)";
});
reset.addEventListener("click", () => {
aniElement.style.transform = "scale(1, 1)";
});
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.