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.
<div class="scene-container">
<div class="scene">
<div class="skybox">
<div class="cloud"></div>
<div class="cloud two"></div>
<div class="cloud three"></div>
<div class="cloud four"></div>
<div class="cloud five"></div>
<div class="cloud six"></div>
<div class="cloud seven"></div>
<div class="cloud eight"></div>
</div>
<div class="background">
</div>
<div class="background two">
</div>
<div class="background three">
</div>
<div class="foreground">
<div class="cactus">
</div>
<div class="cactus two">
</div>
<div class="cactus three">
</div>
<div class="station-container">
<div class="station-base">
</div>
<div class="station">
<div class="garage">
<div class="windows">
</div>
</div>
<div class="windows">
</div>
<div class="windows two">
</div>
<div class="door">
</div>
<div class="roof">
</div>
<div class="roof-underside">
</div>
<div class="column">
</div>
<div class="column two">
</div>
</div>
</div>
<div class="road">
</div>
</div>
</div>
</div>
//desert color palette
$timberwolf: #d9d4ce;
$wafer: #ddcbbf;
$coldturkey: #c7b7b7;
$rodeodust: #c8a995;
$graychateau: #9ea5ad;
$ghost: #c9c9d6;
$aquaisland: #a3c7dd;
$goldenrod: #fcd667;
$fire: #ab3400;
$aliceblue: #f0f8ff;
$cactus: #5c755e;
$sky: $aquaisland;
$cloud: $aliceblue;
$background: $coldturkey;
$foreground: $wafer;
$road: $graychateau;
$gray: #ccc;
@mixin texture-dot {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23f0f8ff' fill-opacity='0.5' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
}
@mixin mountain {
clip-path: polygon(
0% 59%,
4% 55%,
7% 55%,
10% 56%,
13% 53%,
15% 53%,
18% 52%,
22% 50%,
27% 46%,
29% 44%,
32% 43%,
36% 43%,
38% 43%,
40% 45%,
42% 46%,
45% 42%,
46% 41%,
48% 42%,
52% 40%,
56% 40%,
59% 41%,
63% 41%,
65% 42%,
68% 41%,
69% 41%,
75% 44%,
80% 47%,
84% 49%,
87% 50%,
89% 50%,
91% 52%,
94% 52%,
96% 54%,
100% 56%,
100% 58%,
100% 100%,
0% 100%
);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: 100%;
}
.scene-container {
background-color: lighten($sky, 8);
display: flex;
justify-content: center;
align-items: center;
overflow-x: hidden;
width: 100vw;
min-height: 100vh;
padding: 1rem;
}
.scene {
background-color: transparent;
width: 1000px;
height: 540px;
flex-shrink: 0;
overflow: hidden;
position: relative;
}
.skybox {
@include texture-dot;
width: 100%;
height: 100%;
z-index: 5;
}
$animation-time: 140s;
.cloud {
animation: animateclouds $animation-time infinite linear;
background-color: $cloud;
border-radius: 40px;
border-left: 3px solid darken($cloud, 3);
border-bottom: 3px solid darken($cloud, 3);
box-shadow: -1px 3px 2px 0px rgba(0, 0, 0, 0.075);
width: 200px;
height: 60px;
position: absolute;
top: 100px;
left: -250px;
&::before {
background: $cloud;
border-radius: 50%;
border-left: 3px solid darken($cloud, 3);
content: "";
display: block;
width: 100px;
height: 100px;
position: absolute;
top: -45px;
left: 70px;
z-index: 2;
}
&::after {
background: $cloud;
border-left: 3px solid darken($cloud, 3);
border-radius: 50%;
content: "";
display: block;
width: 60px;
height: 60px;
position: absolute;
top: -20px;
left: 30px;
}
&.two {
animation-delay: -($animation-time / 5);
top: 250px;
transform: scale(1.5);
}
&.three {
animation-delay: -($animation-time / 4);
top: 0px;
transform: scale(0.5);
}
&.four {
animation-delay: ($animation-time / 3);
top: 175px;
}
&.five {
animation-delay: -($animation-time / 2);
}
&.six {
animation-delay: ($animation-time / 1.5);
top: 50px;
transform: scale(0.75);
}
&.seven {
animation-delay: -($animation-time / 1.25);
top: 125px;
transform: scale(1.1);
}
&.eight {
animation-delay: ($animation-time / 1.1);
top: 175px;
transform: scale(0.8);
}
}
@keyframes animateclouds {
100% {
transform: translateX(1500px);
}
}
.background {
@include mountain;
background-color: $background;
bottom: 0;
position: absolute;
height: 100%;
width: 100%;
z-index: 10;
&.two {
transform: translate(25rem, 2rem);
z-index: 9;
&::before {
background-color: $background;
}
}
&.three {
transform: translate(-30rem, 2rem);
z-index: 9;
&::before {
background-color: $background;
}
}
&::before {
@include mountain;
content: "";
background-color: darken($background, 8);
bottom: 0;
position: absolute;
height: 100%;
width: 100%;
transform: translateY(0.25rem);
z-index: -1;
}
}
.foreground {
background-color: $foreground;
border-top: 4px solid darken($foreground, 5);
bottom: 0;
position: absolute;
height: 40%;
width: 100%;
z-index: 20;
}
.cactus {
background: lighten($cactus,15%);
border-top-right-radius: 5px;
border-top-left-radius: 5px;
width: 8px;
height: 15px;
position: absolute;
left: 200px;
top: -10px;
&::before {
background: lighten($cactus, 12%);
content: '';
display: block;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
width: 8px;
height: 10px;
position: relative;
top: 30px;
left: -60px;
transform: scale(1.25);
}
&::after {
background: lighten($cactus, 10%);
content: '';
display: block;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
width: 8px;
height: 12px;
position: relative;
top: 35px;
right: -60px;
transform: scale(1.35);
}
&.two {
left: 800px;
top: 5px;
transform: scale(1.1);
}
&.three {
left: 50px;
top: 40px;
transform: scale(1.25);
}
}
.station-container {
width: 400px;
height: 216px;
left: 0;
right: 0;
top: -120px;
margin: 0 auto;
position: absolute;
}
.station-base {
background: $road;
border: 0.1rem solid darken($road, 10);
border-radius: 2px;
bottom: -10px;
height: 40px;
left: -10%;
width: 120%;
position: absolute;
transform: perspective(0.5rem) rotateX(3deg);
z-index: 31;
&::after {
background-color: $road;
border: 0.1rem solid darken($road, 10);
border-bottom: 0;
border-top: 0;
bottom: -19px;
content: "";
display: block;
width: 120px;
height: 19px;
position: absolute;
right: 20px;
}
}
.station {
background-color: lighten($gray, 1);
border-left: 1px solid darken($gray, 5);
border-right: 1px solid darken($gray, 5);
width: 100%;
height: 108px;
position: absolute;
top: 40%;
z-index: 35;
&::before {
background-color: $fire;
content: "";
display: block;
width: 100%;
height: 12px;
position: absolute;
top: 4px;
}
}
.windows {
background-color: darken($road, 10);
border: 2px solid $road;
bottom: 25px;
left: 10px;
width: 100px;
height: 40px;
position: absolute;
&.two {
left: 190px;
}
}
.door {
background-color: darken($road, 10);
border: 2px solid $road;
bottom: 0;
left: 120px;
width: 60px;
height: 60px;
position: absolute;
&::before {
content: "";
background-color: $road;
display: block;
height: 100%;
width: 3px;
position: absolute;
left: 49%;
}
}
.roof {
background: $gray;
width: 320px;
height: 20px;
position: absolute;
left: -10px;
top: -15px;
&::before {
background-color: $fire;
content: "";
display: block;
width: 100%;
height: 12px;
position: absolute;
top: 4px;
}
}
.roof-underside {
background: darken($gray, 10);
top: 5px;
content: "";
width: 300px;
height: 15px;
position: absolute;
transform: perspective(1rem) rotateX(-7deg);
}
.column {
background-color: lighten($road, 10);
border-bottom: 4px solid darken($road, 4);
border-top: 4px solid lighten($road, 1);
bottom: -20%;
left: 60px;
position: absolute;
width: 10px;
height: 116px;
&.two {
left: 230px;
}
&::before {
background-color: darken($gray, 25);
border-bottom: 3px solid darken($gray, 30);
border-top: 15px solid darken($gray, 28);
bottom: -4px;
left: -25px;
content: "";
display: block;
width: 20px;
height: 25px;
position: absolute;
}
&::after {
background-color: darken($gray, 25);
border-bottom: 3px solid darken($gray, 30);
border-top: 15px solid darken($gray, 28);
bottom: -4px;
right: -25px;
content: "";
display: block;
width: 20px;
height: 25px;
position: absolute;
}
}
.garage {
background-color: lighten($gray, 5);
border: 2px solid darken($road, 2);
box-shadow: 0px 1px 2px 1px rgba(darken($road, 40), 0.5) inset;
width: 80px;
height: 75px;
position: absolute;
right: 10px;
bottom: 0;
&::before {
background: rgba($road, 0.5);
content: "";
display: block;
width: 100%;
height: 1px;
position: absolute;
top: 50%;
}
&::after {
background: darken($foreground, 15);
content: "";
display: block;
width: 10px;
height: 2px;
position: absolute;
top: 90%;
left: 0;
right: 0;
margin: 0 auto;
}
.windows {
background-color: darken($road, 10);
border: 2px solid $road;
width: 80%;
height: 18px;
position: absolute;
top: 12px;
left: 0;
right: 0;
margin: 0 auto;
&::before {
background-color: $road;
content: "";
display: inline-block;
margin-left: 30%;
width: 1px;
height: 100%;
}
&::after {
background-color: $road;
content: "";
display: inline-block;
margin-left: 30%;
width: 1px;
height: 100%;
}
}
}
.road {
background-color: $road;
border-top: 0.5rem solid darken($road, 10);
bottom: 0;
position: absolute;
height: 40%;
width: 100%;
z-index: 30;
&::before {
background: repeating-linear-gradient(
to right,
$road,
$road 9rem,
$goldenrod 9rem,
$goldenrod 12rem
);
bottom: 1rem;
content: "";
display: block;
width: 100%;
height: 0.5rem;
opacity: 0.9;
position: absolute;
transform: perspective(1rem) rotateX(3deg);
}
}
Also see: Tab Triggers