*, *:before, *:after { box-sizing: border-box; margin: 0; padding: 0; } .box { position: absolute; top: -4em; left: 0; height: 46em; width: 40em; margin: auto; overflow: hidden; } .wrapper { position: relative; height: 38em; width: 38em; margin: 1em auto; overflow: hidden; background: white; } .cross { position: absolute; top: 0; left: 0; background: #333; height: 6em; width: 2em; margin: 0; animation: rot 3s ease-in-out infinite; @for $i from 0 to 10 { &.r#{$i} { @for $j from 0 to 9 { &.c#{$j} { top: 6em * $i + 2em * $j - 9; left: -2em * $i + 6em * $j; } } } } &:before { content: ''; height: 2em; width: 6em; margin: -1em 0; position: absolute; top: 33.333%; left: -100%; margin: 0; background: inherit; } } .white { top: -8em; left: -2em; background: #333; opacity: 0; animation: show 3s linear infinite; .cross { background: #fff; animation-direction: reverse; } } @keyframes rot { 50% { transform: rotate(-90deg); } 100% { transform: rotate(-90deg); } } @keyframes show { 0%, 50% { opacity: 0; } 50.1%, 100% { opacity: 1; } }