HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
If the stylesheet you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
%button.darkmode dark mode
%button.refresh regenerate
#wrap
-10.times do
.row
-5.times do
.cell
$t: transparent;
$red: #db2430;
@mixin stitches($color){
background:linear-gradient(55deg, $t 2.5px, $color 2.5px, $color 3.5px, $color 4.5px, $t 4.5px), linear-gradient(-55deg, $t 2.5px, $color 2.5px, $color 3.5px, $color 4.5px, $t 4.5px), linear-gradient(55deg, $t 2.5px, $color 2.5px,$color 3.5px,$color 4.5px, $t 4.5px), linear-gradient(-55deg, $t 2.5px, $color 2.5px, $color 3.5px,$color 4.5px, $t 4.5px), #000;
background-size:10px 12px, 10px 12px, 10px 12px, 10px 12px;
background-position:calc(5.5px - 4px) 50%, -9px 50%, calc(5.5px - 4px) calc(50% - 6.5px), -9px calc(50% - 6px);
}
body{
width:100vw;
height:100vh;
max-width:100vw;
display:flex;
justify-content:center;
align-items:center;
@include stitches($red);
@media (max-height:800px){
zoom:0.75;
position:absolute;
left:50%;
top:50%;
transform:translateX(-50%) translateY(-50%);
}
&:before{
content:'';
position:absolute;
width:500%;
height:100%;
@include stitches(#666);
opacity:0;
transition:0.5s ease-in-out;
@media (max-height:800px){
height:200%;
top:-50%;
}
}
&.darkmode{
filter:saturate(0) brightness(0.75) contrast(1.25);
&:before{
opacity:1;
}
}
button{
position:absolute;
margin-bottom:50px;
top:calc(50% + 350px);
color:#fff;
padding:5px;
text-transform:uppercase;
letter-spacing:2px;
border:none;
background:$t;
font-family:Futura;
font-weight:900;
text-shadow:0 5px 10px rgba(0,0,0,1);
transform:translateX(-50%);
left:calc(50% + 100px);
outline:none;
cursor:pointer;
&:focus, &:hover{
outline:none;
}
&.refresh.loading{
&:before{
width:70px;
transition:width 1s ease-in-out;
transition-delay:0s;
animation:bgload 2s ease-in 1 forwards;
@keyframes bgload{
to{
background-position:-200px 50%, 50% 50%;
}
}
}
}
&.refresh{
&:before{
transition:0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
transition-delay:1.25s;
background:repeating-linear-gradient(45deg, #fff 2px, $t 2px, $t 9px, #fff 9px, #fff 11px), green;
background-size:1100px 100%, 100%;
background-repeat:no-repeat;
background-position:-400px 50%, 50% 50%;
animation:bgload2 1.5s ease-out 1 forwards;
@keyframes bgload2{
from{
background-position:-200px 50%, 50% 50%;
}
to{
background-position:0px 50%, 50% 50%;
}
}
}
}
&.active{
&:before{
transform:translateX(25px);
background:#222;
}
}
&:before{
content:'';
position:absolute;
width:20px;
height:20px;
background:green;
border-radius:25px;
top:37.5px;
z-index:2;
left:calc(50% - 10px);
transform:translateX(-25px);
box-shadow:inset 0 -1.5px 5px rgba(0,0,0,0.75);
transition:0.3s ease-in-out;
}
&:after{
content:'';
position:absolute;
width:75px;
left:calc(50% - 37.5px);
height:25px;
box-shadow:0 0 0 2px #fff, 0 5px 10px rgba(0,0,0,1);
top:35px;
border-radius:25px;
background:rgba(255,255,255,0.75);
z-index:0;
}
&:first-of-type{
left:calc(50% - 100px);
}
}
#wrap{
display: grid;
transition:filter 0.5s ease-in-out;
filter:hue-rotate(var(--hue));
grid-template-rows: repeat(10, 1fr);
grid-column-gap: 0px;
grid-row-gap: 0px;
width:700px;
height:700px;
position:relative;
margin-top:-40px;
z-index:2;
box-shadow:0 40px 40px -10px rgba(0,0,0,0.5), 0 0 0 200vh rgba(0,0,0,0.05);
border-radius:10px;
background:linear-gradient(55deg, $t 2.5px, $red 2.5px, $red 3.5px, $red 4.5px, $t 4.5px), linear-gradient(-55deg, $t 2.5px, $red 2.5px, $red 3.5px, $red 4.5px, $t 4.5px), linear-gradient(55deg, $t 2.5px, $red 2.5px,$red 3.5px,$red 4.5px, $t 4.5px), linear-gradient(-55deg, $t 2.5px, $red 2.5px, $red 3.5px,$red 4.5px, $t 4.5px), #000;
background-size:10px 12px, 10px 12px, 10px 12px, 10px 12px;
background-position:0px 50%, -10.5px 50%, 0px calc(50% - 6px), -10.5px calc(50% - 6px);
overflow:hidden;
min-width:700px;
&.hide{
.row{
clip-path: polygon(-100% -100%, -100% -100%, -100% 200%, -100% 200%);
}
}
.row{
width:50%;
height:100%;
margin-left:50%;
top:0;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-column-gap: 0px;
grid-row-gap: 0px;
-webkit-box-reflect: left;
clip-path: polygon(-100% -100%, 100% -100%, 100% 200%, -100% 200%);
transition:1s ease-in-out;
@for $i from 1 through 10{
&:nth-of-type(even){
transition:0.8s ease-in-out;
}
&:nth-of-type(#{$i}){
transition-delay:#{$i/10}s;
}
}
&:nth-of-type(5){
@for $i from 1 through 7{
&.full#{$i}{
z-index:9;
transition:0.6s;
transition-delay:0s;
.cell{
&:nth-of-type(1){
z-index:9;
opacity:1;
@for $i from 9 through 16{
&.cell#{$i}{
opacity:1;
}
}
&.darkmode{
&:before{
clip-path: polygon(41% 24%, 35% 15%, 25% 10%, 17% 9%, 10% 9%, 5% 6%, 1% 1%, 5% 11%, 10% 14%, 22% 17%, 30% 22%, 34% 30%, 34% 33%, 31% 35%, 23% 36%, 17% 37%, 12% 40%, 12% 42%, 17% 44%, 26% 47%, 31% 48%, 34% 37%, 36% 37%, 34% 45%, 34% 48%, 37% 49%, 38% 54%, 37% 56%, 33% 53%, 32% 50%, 30% 51%, 30% 59%, 33% 64%, 38% 70%, 41% 73%, 42% 78%, 43% 82%, 45% 85%, 47% 88%, 49% 91%, 48% 94%, 49% 98%, 51% 95%, 54% 88%, 58% 82%, 58% 74%, 59% 71%, 64% 69%, 69% 61%, 70% 56%, 68% 50%, 66% 52%, 63% 55%, 61% 54%, 63% 50%, 66% 48%, 68% 48%, 66% 39%, 64% 34%, 67% 34%, 68% 43%, 71% 47%, 77% 47%, 84% 44%, 88% 41%, 84% 39%, 74% 35%, 65% 32%, 69% 25%, 74% 20%, 80% 17%, 88% 15%, 94% 12%, 97% 7%, 99% 1%, 94% 7%, 88% 9%, 81% 9%, 74% 11%, 67% 14%, 63% 18%, 60% 23%, 57% 25%, 52% 27%, 49% 27%, 45% 25%, 42% 25%);
mask:none;
}
}
&:before{
width:200%;
height:200%;
left:auto;
right:0;
opacity:1;
z-index:9;
}
&:after{
content:'';
opacity:1;
position:absolute;
width:200%;
height:200%;
@include stitches($red);
z-index:999;
left:auto;
right:0%;
top:0%;
z-index:0;
}
}
}
}
}
}
&:nth-of-type(1), &:nth-of-type(10){
@for $i from 8 through 15{
&.full#{$i}{
z-index:9;
transition:0.6s;
transition-delay:0s;
.cell{
&:nth-of-type(4){
z-index:9;
&:before{
width:175%;
height:175%;
left:auto;
top:12.5%;
right:-50%;
opacity:1;
z-index:9;
}
&:after{
content:'';
opacity:1;
position:absolute;
width:300%;
height:300%;
@include stitches($red);
z-index:999;
left:auto;
right:-100%;
top:0;
z-index:0;
mask:none;
}
}
}
}
}
}
&:nth-of-type(10){
@for $i from 8 through 15{
&.full#{$i}{
z-index:9;
transition:0.6s;
transition-delay:0s;
.cell{
&:nth-of-type(4){
z-index:9;
&:before{
width:175%;
height:175%;
left:auto;
top:auto;
bottom:12.5%;
right:-50%;
opacity:1;
z-index:9;
}
&:after{
content:'';
opacity:1;
position:absolute;
width:300%;
height:300%;
@include stitches($red);
z-index:999;
left:auto;
right:-100%;
top:auto;
bottom:0;
z-index:0;
}
}
}
}
}
}
@for $i from 16 through 22{
&.full#{$i}{
.cell{
&.darkmode{
&:before{
content:'' !important;
background-clip:border-box;
}
}
}
}
}
@for $i from 16 through 17{
&.full#{$i}{
.cell{
opacity:1;
z-index:99;
&:not(.darkmode){
transform:rotate(var(--angle));
}
&.darkmode, &.darkmode.cell1, &.darkmode.cell9{
&:before{
clip-path: polygon(0 40%, 3% 52%, 7% 64%, 17% 65%, 25% 58%, 25% 47%, 20% 37%, 17% 28%, 17% 14%, 24% 4%, 31% 1%, 27% 15%, 27% 25%, 31% 37%, 39% 47%, 44% 54%, 47% 62%, 57% 65%, 61% 55%, 64% 44%, 60% 36%, 56% 29%, 58% 20%, 62% 23%, 62% 30%, 67% 36%, 73% 28%, 75% 19%, 73% 9%, 68% 1%, 76% 6%, 82% 22%, 81% 36%, 79% 47%, 79% 59%, 87% 66%, 95% 63%, 99% 54%, 100% 41%, 100% 100%, 81% 100%, 66% 96%, 57% 94%, 48% 93%, 35% 95%, 27% 97%, 18% 99%, 8% 100%, 0 100%);
content: '';
top: 0;
transform: none;
background-clip:none;
-webkit-background-clip:none;
width:100%;
height:100%;
top:0;
left:0;
right:auto;
bottom:auto;
mask:none;
border-radius:0;
}
&:after{
display:none;
}
}
&:before{
//thick diagonal
mask:none;
clip-path: polygon(50% 0%, 100% 50%, 100% 100%, 50% 50%, 0 100%, 0 50%);
}
}
}
}
@for $i from 18 through 19{
&.full#{$i}{
.cell{
opacity:1;
&:not(.darkmode){
transform:rotate(var(--angle));
}
&.darkmode, &.darkmode.cell1, &.darkmode.cell9{
&:before{
clip-path: polygon(0 40%, 3% 52%, 7% 64%, 17% 65%, 25% 58%, 25% 47%, 20% 37%, 17% 28%, 17% 14%, 24% 4%, 31% 1%, 27% 15%, 27% 25%, 31% 37%, 39% 47%, 44% 54%, 47% 62%, 57% 65%, 61% 55%, 64% 44%, 60% 36%, 56% 29%, 58% 20%, 62% 23%, 62% 30%, 67% 36%, 73% 28%, 75% 19%, 73% 9%, 68% 1%, 76% 6%, 82% 22%, 81% 36%, 79% 47%, 79% 59%, 87% 66%, 95% 63%, 99% 54%, 100% 41%, 100% 100%, 81% 100%, 66% 96%, 57% 94%, 48% 93%, 35% 95%, 27% 97%, 18% 99%, 8% 100%, 0 100%);
content: '';
top: 0;
transform: none;
background-clip:none;
-webkit-background-clip:none;
width:100%;
height:100%;
top:0;
left:0;
right:auto;
bottom:auto;
mask:none;
border-radius:0;
}
&:after{
display:none;
}
}
&:before{
//thin diagonal
mask:none;
clip-path: polygon(50% 40%, 100% 90%, 100% 100%, 50% 50%, 0 100%, 0 90%);
}
&:after{
// triangle
opacity:1;
clip-path: polygon(50% 70%, 41% 85%, 60% 85%);
}
}
}
}
@for $i from 20 through 21{
&.full#{$i}{
.cell{
opacity:1;
&.darkmode, &.darkmode.cell1, &.darkmode.cell9{
&:before{
clip-path: polygon(0 59%, 9% 70%, 21% 65%, 20% 54%, 10% 43%, 10% 24%, 20% 11%, 31% 8%, 28% 18%, 30% 33%, 35% 41%, 42% 39%, 47% 32%, 48% 19%, 51% 23%, 55% 43%, 55% 61%, 63% 69%, 71% 65%, 75% 58%, 72% 38%, 66% 28%, 61% 18%, 71% 24%, 80% 38%, 83% 51%, 84% 62%, 92% 65%, 98% 63%, 100% 59%, 100% 100%, 86% 98%, 77% 94%, 65% 92%, 54% 93%, 48% 96%, 40% 98%, 31% 97%, 22% 94%, 12% 95%, 0 100%);
content: '';
top: 0;
mask:none;
transform: none;
background-clip:none;
-webkit-background-clip:none;
width:100%;
height:100%;
top:0;
left:0;
right:auto;
bottom:auto;
border-radius:0;
}
&:after{
display:none;
}
}
&:not(.darkmode){
transform:rotate(var(--angle));
}
&:before{
//thin diagonal
mask:none;
clip-path: polygon(50% 40%, 100% 90%, 100% 100%, 50% 50%, 0 100%, 0 90%);
top:-30px;
}
&:after{
//thick diagonal
mask:none;
clip-path: polygon(50% 20%, 100% 70%, 100% 100%, 50% 50%, 0 100%, 0 70%);
filter:invert(1);
opacity:1;
}
}
}
}
@for $i from 21 through 22{
&.full#{$i}{
.cell{
&:before{
width:100%;
height:100%;
left:0;
top:0;
}
&.cell5, &.cell7{
&:not(.darkmode){
&:before{
width:50%;
height:50%;
top:25%;
left:25%;
}
}
}
&.cell2, &.cell6{
&:not(.darkmode){
&:before{
width:75%;
height:75%;
top:12.5%;
left:12.5%;
}
}
}
}
}
}
}
.cell{
position:relative;
&:before, &:after{
content:'';
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
@include stitches(#fff);
}
&:after{
opacity:0;
}
&.cell1, &.cell9{
&.darkmode{
&:before{
content:'666';
color:$t;
background-clip:text;
font-size:50px;
clip-path:none;
width:100%;
text-align:center;
top:50%;
transform:translateY(-50%);
font-family: 'UnifrakturCook', cursive;
}
}
&:before{
//deer
clip-path: polygon(57% 0%, 57% 13%, 51% 13%, 51% 8%, 45% 8%, 45% 24%, 30% 24%, 29% 8%, 24% 8%, 24% 12%, 18% 12%, 18% 1%, 11% 1%, 11% 7%, 5% 7%, 5% 13%, 16% 14%, 17% 20%, 23% 20%, 24% 24%, 28% 25%, 29% 30%, 23% 30%, 23% 35%, 16% 36%, 17% 46%, 30% 47%, 30% 53%, 36% 53%, 36% 99%, 42% 100%, 41% 76%, 48% 76%, 48% 99%, 54% 99%, 54% 77%, 73% 77%, 74% 100%, 81% 100%, 81% 77%, 86% 77%, 86% 100%, 92% 100%, 93% 53%, 85% 53%, 86% 48%, 93% 47%, 93% 41%, 86% 41%, 86% 47%, 46% 46%, 45% 36%, 52% 36%, 52% 31%, 46% 31%, 46% 24%, 51% 24%, 51% 20%, 57% 19%, 57% 14%, 70% 14%, 70% 8%, 64% 8%, 64% 1%, 57% 0%);
}
}
&.cell2, &.cell10{
&:before{
//flower
clip-path: polygon(72% 0, 71% 25%, 24% 73%, 0 74%, 18% 55%, 80% 55%, 98% 73%, 76% 75%, 28% 27%, 27% 0, 45% 19%, 46% 84%, 28% 100%, 27% 77%, 74% 29%, 100% 29%, 80% 47%, 19% 48%, 0 29%, 23% 28%, 71% 77%, 71% 100%, 53% 84%, 51% 57%, 53% 19%);
}
&.darkmode{
&:before{
clip-path: polygon(4% 91%, 10% 96%, 55% 56%, 66% 65%, 75% 65%, 86% 57%, 92% 51%, 97% 57%, 100% 39%, 87% 41%, 89% 46%, 76% 57%, 67% 56%, 61% 50%, 78% 35%, 83% 38%, 89% 22%, 73% 27%, 75% 31%, 55% 46%, 53% 41%, 50% 36%, 52% 29%, 58% 22%, 63% 19%, 69% 23%, 74% 7%, 58% 9%, 60% 13%, 51% 19%, 45% 25%, 44% 35%, 46% 45%, 48% 49%, 48% 51%);
}
}
}
&.cell3, &.cell11{
&:before{
//dino
clip-path: polygon(50% 5%, 50% 10%, 46% 10%, 45% 37%, 43% 36%, 43% 40%, 36% 39%, 36% 44%, 30% 44%, 30% 48%, 26% 48%, 26% 52%, 18% 52%, 18% 47%, 14% 48%, 14% 45%, 11% 44%, 10% 36%, 6% 37%, 7% 60%, 25% 78%, 26% 94%, 34% 95%, 34% 91%, 30% 91%, 30% 86%, 34% 86%, 34% 82%, 38% 82%, 39% 76%, 42% 76%, 42% 81%, 46% 81%, 46% 94%, 54% 95%, 54% 91%, 50% 91%, 50% 74%, 56% 74%, 57% 68%, 63% 65%, 63% 51%, 68% 50%, 68% 56%, 73% 56%, 73% 44%, 63% 44%, 63% 37%, 78% 37%, 78% 32%, 67% 32%, 67% 28%, 88% 29%, 89% 11%, 83% 11%, 83% 6%, 60% 6%, 60% 16%, 54% 17%, 55% 12%, 60% 11%, 61% 6%, 51% 6%);
}
&.darkmode{
&:before{
clip-path: polygon(9% 8%, 11% 24%, 25% 36%, 34% 26%, 47% 23%, 64% 23%, 75% 31%, 78% 37%, 86% 33%, 93% 23%, 95% 5%, 98% 22%, 98% 38%, 93% 49%, 85% 53%, 79% 59%, 74% 51%, 64% 48%, 59% 50%, 56% 57%, 62% 65%, 79% 66%, 78% 78%, 73% 96%, 59% 95%, 57% 83%, 50% 83%, 48% 89%, 46% 95%, 34% 95%, 27% 81%, 21% 67%, 44% 65%, 49% 57%, 45% 48%, 35% 48%, 28% 53%, 23% 57%, 15% 55%, 6% 38%, 5% 25%);
}
}
}
&.cell4, &.cell12{
&:before{
// tree
clip-path: polygon(50% 0, 29% 18%, 41% 19%, 20% 45%, 34% 45%, 10% 70%, 45% 70%, 45% 90%, 55% 90%, 55% 70%, 90% 70%, 65% 45%, 80% 45%, 60% 19%, 72% 18%);
}
&.darkmode{
&:before{
clip-path:none;
mask:linear-gradient(to right, $t 45%, #000 45%, #000 55%, $t 55%), linear-gradient(to top, $t 35%, #000 35%, #000 45%, $t 45%);
width:50%;
height:75%;
top:12.5%;
left:25%;
z-index:2;
}
&:after{
opacity:1;
@include stitches($red);
z-index:1;
}
}
}
&.cell5, &.cell13{
&:before{
// heart
clip-path: polygon(51% 90%, 5% 50%, 5% 30%, 15% 15%, 35% 15%, 50% 30%, 65% 15%, 84% 15%, 95% 30%, 95% 50%);
}
&.darkmode{
@include stitches($red);
&:before{
clip-path: polygon(48% 0%, 8% 94%, 14% 94%, 100% 32%, 0 32%, 90% 94%, 93% 91%, 11% 36%, 89% 36%, 16% 88%, 18% 80%, 49% 10%, 93% 93%, 95% 87%);
border-radius:100%;
}
&:after{
opacity:1;
mask:radial-gradient(circle at center, transparent 60%, #000 60%, #000 70%, $t 70%);
clip-path:none;
}
}
}
&.cell6, &.cell14{
&.darkmode{
&:before{
clip-path: polygon(14% 10%, 10% 19%, 8% 28%, 11% 42%, 16% 51%, 22% 47%, 29% 39%, 38% 38%, 44% 38%, 48% 97%, 53% 97%, 56% 94%, 52% 37%, 59% 34%, 68% 34%, 74% 36%, 80% 38%, 79% 29%, 79% 19%, 77% 8%, 73% 3%, 70% 1%, 61% 9%, 50% 15%, 48% 6%, 39% 8%, 41% 17%, 27% 15%);
mask:none;
}
}
&:before{
// snowflake
clip-path: circle(45% at 50% 50%);
mask:radial-gradient(circle at 15% 65%, #000 5%, $t 5%), radial-gradient(circle at 85% 65%, #000 5%, $t 5%),radial-gradient(circle at 15% 35%, #000 5%, $t 5%), radial-gradient(circle at 85% 35%, #000 5%, $t 5%),radial-gradient(circle at 35% 85%, #000 5%, $t 5%), radial-gradient(circle at 65% 85%, #000 5%, $t 5%),radial-gradient(circle at 35% 15%, #000 5%, $t 5%), radial-gradient(circle at 65% 15%, #000 5%, $t 5%), linear-gradient(to right, $t 47.5%, #000 47.5%, #000 52.5%, $t 52.5%), linear-gradient(to bottom, $t 47.5%, #000 47.5%, #000 52.5%, $t 52.5%), linear-gradient(45deg, $t 47.5%, #000 47.5%, #000 52.5%, $t 52.5%), linear-gradient(-45deg, $t 47.5%, #000 47.5%, #000 52.5%, $t 52.5%);
}
}
&.cell7, &.cell15{
&:before{
// star
mask:radial-gradient(circle at center, #000 57.5%, $t 57.5%);
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
}
&.cell8, &.cell16{
&:before{
clip-path: circle(25% at 50% 50%);
mask:linear-gradient(45deg, $t 47.5%, #000 47.5%, #000 52.5%, $t 52.5%), linear-gradient(-45deg, $t 47.5%, #000 47.5%, #000 52.5%, $t 52.5%);
}
}
@for $i from 9 through 16{
&.cell#{$i}{
opacity:0;
}
}
}
}
}
function draw() {
$("#wrap, body").addClass('hide');
$(".refresh").addClass("loading");
setTimeout(function() {
$("#wrap, body").removeClass("hide");
$(".refresh").removeClass("loading");
$(".row").removeClass();
$("#wrap > div").addClass("row");
$(".cell").removeClass();
$("#wrap .row > div").addClass("cell");
if ($("body").hasClass("darkmode")){
$(".cell").addClass("darkmode");
}
$(wrap)
.get(0)
.style.setProperty("--hue", (Math.floor(Math.random() * 2) * 100) + 'deg');
$("#wrap .cell").each(function() {
$(this).addClass("cell" + Math.floor(Math.random() * 16 + 1));
$(this).parent().removeClass(); $(this).parent().addClass("row full" + Math.floor(Math.random() * 22 + 1));
});
$(".cell").each(function() {
$(this)
.parent()
.get(0)
.style.setProperty("--size", Math.floor(Math.random() * 2 + 1));
$(this)
.parent()
.get(0)
.style.setProperty("--angle", ((Math.floor(Math.random() * 2) + 1) * 180) + "deg");
});
}, 2000);
}
$(".darkmode").click(function(){
$("body").toggleClass("darkmode");
$(this).toggleClass("active");
draw();
})
$(".refresh").on("click", function() {
draw();
});
$(document).ready(function(){
$("#wrap").removeClass('hide');
draw();
})
Also see: Tab Triggers