JSFiddle - React, Tailwind, and code Playground
by GolezTrol
HTML
<div class="ferris_wheel">
<div class = "wheel">
<div class="spokes">
<div class="spoke"><div class="cabin"></div></div>
<div class="spoke"><div class="cabin"></div></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
</div>
</div>
</div>
CSS
div {
box-sizing: border-box;
pointer-events: none;
}
.ferris_wheel {
width: 90vmin;
height: 90vmin;
position: relative;
x-webkit-transform: rotatex(40deg);
}
.wheel,
.spokes,
.cabins {
border: 1px solid green;
border-radius: 50%;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.spoke {
width: 50%;
transform-origin: 100% 2px;
top: calc(50% - 2px);
left: 0px;
border-top: 2px solid silver;
border-bottom: 2px solid grey;
}
.spoke,
.spoke::before,
.spoke::after {
position: absolute;
}
.spoke::before,
.spoke::after {
top: 2px;
border: 2px solid grey;
content: "";
display: block;
height: 2vmin;
width: 66%;
transform-origin: 6px 4px;
-moz-transform: rotate(70deg);
-webkit-transform: rotate(70deg);
transform: rotate(70deg);
}
.spoke::after {
width: 32%;
left: 50%;
height: 1vmin;
transform-origin: 6px 50%;
}
.cabin {
pointer-events: initial;
position: absolute;
display: inline-block;
box-sizing: border-box;
height: 13.333vmin;
width: 10vmin;
top: calc(50% - 2vmin);
}
.cabin::before {
}
.cabin::after {
content: ' \1F64C \1F64D';
font-family: 'Segoe UI Symbol';
font-size: 3.5vmin;
line-height: 5vmin;
text-align: bottom;
position: absolute;
box-sizing: border-box;
display: inline-block;
width: 100%;
height: 100%;
border: 0 solid blue;
border-color: attr(data-color color); /* Color in markup. Not supported yet */
border-width: 3vmin 1px 6vmin 1px;
border-radius: 6vmin;
-webkit-animation:rock 1s ease infinite;
-moz-animation:rock 1s ease infinite;
animation:rock 1s ease infinite;
transform-origin: 50% 0;
}
@-moz-keyframes rock { 30% { -moz-transform: rotate(-5deg); } 100% { -moz-transform: rotate(5deg); } }
@-webkit-keyframes rock { 30% { -webkit-transform: rotate(-5deg); } 100% { -webkit-transform: rotate(5deg); }...