Skip to content

Instantly share code, notes, and snippets.

@lightmnd
Created February 22, 2018 14:09
Show Gist options
  • Save lightmnd/2245664ceffcc3a06f30ab41fa219073 to your computer and use it in GitHub Desktop.
Save lightmnd/2245664ceffcc3a06f30ab41fa219073 to your computer and use it in GitHub Desktop.
Spinners
<!--
css-doodle:
http://yuanchuan.name/css-doodle/
-->
<css-doodle>
:doodle {
@grid: 15 / 61.8vmin;
@shape: circle;
}
border-radius: 50%;
border: calc(1px + .05vmin)
solid transparent;
--r: @rand(360deg);
--n: calc(
@abs(@abs(@row() - 8)
+ @abs(@col() - 8) - 15) / 15
);
transform: rotate(var(--r));
border-left-color: hsl(
calc(var(--n) * 360 + 120), 60%, 60%
);
animation:
spin calc(.6s / var(--n)) linear infinite;
@keyframes spin {
to {
transform: rotate(
calc(var(--r) + @pick(1turn, -1turn))
);
}
}
</css-doodle>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/52982/css-doodle.v0.2.0.min.js"></script>
html, body {
margin: 0;
width: 100%;
height: 100%;
background: #0a0c27;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment