animarte
Version:
Making the digital world a little more animated place
80 lines (77 loc) • 1.95 kB
CSS
.animarte {
position: relative;
isolation: isolate;
box-sizing: border-box;
overflow: hidden;
flex-shrink: 0;
width: var(--animarte-size);
height: var(--animarte-size);
color: var(--animarte-color);
}
.animarte-ellipsis {
display: flex;
justify-content: space-between;
align-items: center;
}
.animarte-ellipsis__element {
--width: 20%;
--height: 20%;
width: var(--width);
height: var(--height);
border-radius: 100vw;
background: currentColor;
animation-iteration-count: infinite;
}
@property --ellipsis-dancing-3_angle {
syntax: "<angle>";
initial-value: 0deg;
inherits: true;
}
.animarte-ellipsis--dancing-3 .animarte-ellipsis__element {
position: absolute;
animation-timing-function: linear;
animation-duration: var(--animarte-speed);
}
.animarte-ellipsis--dancing-3 .animarte-ellipsis__element:nth-of-type(1) {
animation-name: ellipsisDancing3Left;
}
.animarte-ellipsis--dancing-3 .animarte-ellipsis__element:nth-of-type(2) {
animation-name: ellipsisDancing3Middle;
}
.animarte-ellipsis--dancing-3 .animarte-ellipsis__element:nth-of-type(3) {
--ellipsis-dancing-3_angle: 0deg;
--radius: calc(var(--animarte-size) / 2 - 2.5 * var(--width));
left: calc(50% - var(--width) / 2);
animation-timing-function: linear;
animation-name: ellipsisDancing3Right;
translate: calc(cos(var(--ellipsis-dancing-3_angle)) * var(--radius)) calc(sin(var(--ellipsis-dancing-3_angle) * -1) * var(--radius));
}
@keyframes ellipsisDancing3Left {
0%, 100% {
right: 100%;
bottom: 50%;
transform: translate(100%, 50%);
}
50% {
right: 50%;
bottom: 50%;
transform: translate(50%, 50%);
}
}
@keyframes ellipsisDancing3Middle {
0%, 100% {
right: 50%;
bottom: 50%;
transform: translate(50%, 50%);
}
50% {
right: 0%;
bottom: 50%;
transform: translate(0%, 50%);
}
}
@keyframes ellipsisDancing3Right {
to {
--ellipsis-dancing-3_angle: 1turn;
}
}