UNPKG

animarte

Version:

Making the digital world a little more animated place

91 lines (88 loc) 2.19 kB
.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-2_angle { syntax: "<angle>"; initial-value: 0deg; inherits: true; } .animarte-ellipsis--dancing-2 .animarte-ellipsis__element { position: absolute; animation-timing-function: linear; animation-duration: var(--animarte-speed); } .animarte-ellipsis--dancing-2 .animarte-ellipsis__element:nth-of-type(1) { animation-name: ellipsisDancing2Left; } .animarte-ellipsis--dancing-2 .animarte-ellipsis__element:nth-of-type(2) { animation-name: ellipsisDancing2Middle; } .animarte-ellipsis--dancing-2 .animarte-ellipsis__element:nth-of-type(3) { --radius: calc(var(--animarte-size) / 4 - var(--width)); animation-timing-function: linear; animation-name: ellipsisDancing2Right; translate: calc(cos(var(--ellipsis-dancing-2_angle)) * var(--radius)) calc(sin(var(--ellipsis-dancing-2_angle) * -1) * var(--radius)); } @keyframes ellipsisDancing2Left { 0%, 50% { right: 100%; bottom: 50%; transform: translate(100%, 50%); } 100% { right: 50%; bottom: 50%; transform: translate(50%, 50%); } } @keyframes ellipsisDancing2Middle { 0% { right: 50%; bottom: 50%; transform: translate(50%, 50%); } 50%, 100% { right: 0%; bottom: 50%; transform: translate(0%, 50%); } } @keyframes ellipsisDancing2Right { 0% { --ellipsis-dancing-2_angle: 0deg; left: calc(50% + var(--width) - var(--width) / 2); } 49.99% { --ellipsis-dancing-2_angle: 180deg; left: calc(50% + var(--width) - var(--width) / 2); } 50% { --ellipsis-dancing-2_angle: 0deg; left: var(--width); } 100% { --ellipsis-dancing-2_angle: -180deg; left: var(--width); } }