css-orbital/style.css

162 lines
2.6 KiB
CSS

:root {
--width__inner-content: 10em;
--width__orbital: 7em;
--radius__orbital: 14em;
--radius__orbital--diagonal: calc(var(--radius__orbital) / 1.4142);
}
body, html {
padding: 0;
margin: 0;
background-color: rgba(0, 255, 0, 0.1);
}
.wrapper {
position: relative;
width: 80vw;
height: 80vh;
font-size: 1rem;
background-color: white;
}
ul, li {
padding: 0;
margin: 0;
list-style: none;
}
.orbitals {
position: relative;
width: 100%;
height: 100%;
}
.orbital {
position: absolute;
width: var(--width__orbital);
height: var(--width__orbital);
border-radius: 50%;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
&:nth-child(1) {
/* top */
transform: translate(-50%, calc(-50% - var(--radius__orbital)));
}
&:nth-child(2) {
/* top right */
transform: translate(calc(-50% + var(--radius__orbital--diagonal)), calc(-50% - var(--radius__orbital--diagonal)));
}
&:nth-child(3) {
/* right */
transform: translate(calc(-50% + var(--radius__orbital)), -50%);
}
&:nth-child(4) {
/* bottom right */
transform: translate(calc(-50% + var(--radius__orbital--diagonal)), calc(-50% + var(--radius__orbital--diagonal)));
}
&:nth-child(5) {
/* bottom */
transform: translate(-50%, calc(-50% + var(--radius__orbital)));
}
&:nth-child(6) {
/* bottom left */
transform: translate(calc(-50% - var(--radius__orbital--diagonal)), calc(-50% + var(--radius__orbital--diagonal)));
}
&:nth-child(7) {
/* left */
transform: translate(calc(-50% - var(--radius__orbital)), -50%);
}
&:nth-child(8) {
/* top left */
transform: translate(calc(-50% - var(--radius__orbital--diagonal)), calc(-50% - var(--radius__orbital--diagonal)));
}
}
.orbital-content {
width: 100%;
height: 100%;
}
.inner-content {
position: absolute;
width: var(--width__inner-content);
height: var(--width__inner-content);
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
opacity: 0.3;
}
.image-hover {
width: 100%;
height: 100%;
& > .img {
position: absolute;
width: 100%;
height: 100%;
inset: 0;
object-fit: cover;
&:last-child {
transition: opacity .3s;
opacity: 0;
}
}
&:hover > .img {
&:last-child {
opacity: 1;
}
}
}
.content-center {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.bg-red {
background-color: rgba(255, 200, 200);
}
.bg-green {
background-color: rgba(200, 255, 200);
}
.bg-blue {
background-color: rgba(200, 200, 255);
}
.clockwise {
animation: rotate 20s linear infinite;
}
.anti-clockwise {
animation: rotate 20s reverse linear infinite;
}
@keyframes rotate {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}