Magic 8 Ball
by Emily Humphrey
HTML
<div class="stage">
<div class="ball">
<div class="porthole">
<div class="dice">
<div class="text-box">DOUBLE<br />NOTHING</div>
</div>
</div>
</div>
</div>
SCSS
@import url('https://fonts.googleapis.com/css2?family=Heebo:[email protected]&family=New+Rocker&family=Playfair:ital,opsz,wght@0,5..1200,300..900;1,5..1200,300..900&display=swap');
body {
padding: 0;
margin: 0;
font-family: "New Rocker", system-ui;
font-weight: 400;
font-style: normal;
}
.stage {
display: flex;
height: 100vh;
width: 100vw;
align-items: center;
justify-content: center;
}
.ball {
display: flex;
height: 80vh;
width: 80vh;
align-items: center;
justify-content: center;
border-radius: 100%;
background: #1F1E1C;
background: radial-gradient(circle, rgba(74,77,69,1) 0%, rgba(31,30,28,1) 61%);
}
.porthole {
display: flex;
height: 50%;
width: 50%;
align-items: center;
justify-content: center;
border-radius: 100%;
background: #5F005F90;
}
.dice {
position: relative;
z-index: 1;
display: flex;
height: 70%;
width: 70%;
font-size: 100%;
align-items: center;
justify-content: center;
overflow: hidden;
margin-top: 20px;
animation: unblurFadeIn 2s ease-out forwards;
}
.dice::after {
content: "â–˛";
position: absolute;
display: flex;
margin-top: 0px;
color: #3A1C3A;
z-index: -1;
font-size: 1750%;
line-height: 1;
transform: rotate(180deg);
}
.text-box {
margin-top: -30px;
font-weight: bold;
font-size: 20px;
color: #d1a9d1;
text-align: center;
line-height: 1.4em
}
@keyframes unblurFadeIn {
0% {
opacity: 0;
filter: blur(20px);
}
100% {
opacity: 1;
filter: blur(0px);
}
}