JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
- var lights = 150;
h1 Merry Christmas
.bokeh
- for (var i = 0; i < lights; i++)
.light
/* Font */
@import url(https://fonts.googleapis.com/css?family=Montserrat);
/* Colors */
$colorCollection: (#D00010, #FEC641, #63C13B, #FE0016, #5C6C94, #6B0D05, #7D0006, #DB1913, #FEE34A, #2F8A27);
// $colorCollection: (#F4A43B, #0AB1AA, #FDFEE4, #F42618, #ADFEDD, #FF5F24, #FEF14F, #FD361B, #30398D, #FEE086);
// $colorCollection: (#FCF1BD);
/* Config */
$lights: 150; // match lights in mark up
$textColor: #FFFFFF;
$totalAnimation: 5;
$lightSize: 75;
$blurLevel: 2;
/* Pretty Lights */
.bokeh{
position: relative;
width: 100%;
height: 100%;
pointer-events: none;
top: -50px;
left: -25px;
}
.light{
position: absolute;
border-radius: 50%;
opacity: 0;
}
@for $i from 1 through $lights{
$lightWidth: $lightSize + random(25);
$lightHeight: $lightWidth;
$lightVertical: random(100);
$lightHorizontal: random(100);
$lightBlur: $blurLevel + random($blurLevel);
$lightDelay: 10 + random(25);
$animation: 1 + random($totalAnimation);
.light:nth-child(#{$i}){
width: $lightWidth + px;
height: $lightHeight + px;
top: #{$lightVertical + "%"};
left: #{$lightHorizontal + "%"};
background: nth($colorCollection, random(length($colorCollection)));
filter: blur($lightBlur + px);
animation: #{$lightDelay + s} #{"light" + $animation} linear infinite;
}
}
@for $i from 1 through $totalAnimation{
@keyframes light#{$i} {
25%{
opacity: (25 + random(50)) * 0.01;
}
50%{
opacity: 0;
}
75%{
opacity: (25 + random(50)) * 0.01;
}
100%{
opacity: 0;
}
}
}
/* Other Stuff */
body, html{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
font-family: 'Montserrat', sans-serif;
background-image: linear-gradient(right bottom, #0A0707 0%, #110C0D 50%, #0C090A 100%);
}
h1 {
text-align: center;
text-transform: uppercase;
text-shadow: 0px 0px 50px rgba($textColor, 0.5);
color: $textColor;
position: absolute;
top: 25%;
z-index: 10;
opacity: 0.9;
left: 0%;
right: 0%;
}
// Merry Christmas
// Try the different color collections
// Uncomment $colorCollection in SCSS
// View my snow pen that uses similar code:
// https://codepen.io/YoEmanYo/pen/owAnm
Also see: Tab Triggers