UNPKG

animarte

Version:

Making the digital world a little more animated place

78 lines (76 loc) 1.81 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-blocks--rolling .animarte-blocks__element { display: grid; grid-template: 1fr 1fr/1fr 1fr; position: absolute; left: 0; top: 0; width: 100%; height: 100%; } .animarte-blocks--rolling .animarte-blocks__element:nth-of-type(1) { rotate: 0deg; } .animarte-blocks--rolling .animarte-blocks__element:nth-of-type(3) { rotate: 180deg; } .animarte-blocks--rolling .animarte-blocks__element:nth-of-type(2) { rotate: 270deg; } .animarte-blocks--rolling .animarte-blocks__element::before { content: ""; display: block; position: relative; border-radius: 25%; margin: 7.5%; background: currentColor; animation-iteration-count: infinite; animation-duration: var(--animarte-speed); } .animarte-blocks--rolling .animarte-blocks__element:nth-child(1)::before { animation-name: blockKeyframes; animation-delay: calc(var(--animarte-speed) / 4 / 4 * 1); } .animarte-blocks--rolling .animarte-blocks__element:nth-child(2)::before { animation-name: blockKeyframes; animation-delay: calc(var(--animarte-speed) / 4 / 4 * 2); } .animarte-blocks--rolling .animarte-blocks__element:nth-child(3)::before { animation-name: blockKeyframes; animation-delay: calc(var(--animarte-speed) / 4 / 4 * 3); } @keyframes blockKeyframes { 0% { top: 0%; left: 0%; } 25% { top: 0%; left: 100%; transform: rotateZ(180deg); } 50% { top: 100%; left: 100%; transform: rotateZ(360deg); } 75% { top: 100%; left: 0%; transform: rotateZ(540deg); } 100% { top: 0%; left: 0%; transform: rotateZ(720deg); } }