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.
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.
<div class="line-top"></div>
<div class="shape rectangle"></div>
<div class="shape triangle" data-stroke="#ccc" data-stroke-width="2px"></div>
<div class="shape circle3"></div>
<div class="shape star5" data-side="5" data-stroke="#ccc" data-stroke-width="2px" data-star-radius="50%"></div>
<div class="shape polygon6" data-side="6" data-stroke="#ccc" data-stroke-width="2px"></div>
<div class="motion">
<div class="glitter glitter1"></div>
<div class="glitter glitter2"></div>
<div class="glitter glitter3"></div>
<div class="glitter glitter4"></div>
<div class="glitter glitter5"></div>
<div class="glitter glitter6"></div>
<div class="glitter glitter7"></div>
<div class="glitter glitter8"></div>
<div class="circle circle1"></div>
<div class="circle circle2"></div>
</div>
<div class="logo">
<div class="character d">
<div class="d-back back1"></div>
<div class="d-back back2"></div>
<span>D</span>
</div>
<div class="character a"><span>A</span></div>
<div class="character y"><span>Y</span></div>
<div class="character b"><span>B</span></div>
<div class="character r"><span>R</span></div>
<div class="character u"><span>U</span></div>
<div class="character s"><span>S</span></div>
<div class="character h"><span>H</span></div>
</div>
.motion {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
width: 100%;
height: 100%;
max-width: 600px;
max-height: 600px;
}
.line-top {
position: absolute;
bottom: 50%;
left: 0;
right: 0;
width: 2px;
height: 70%;
transform-origin: 50% 100%;
background: #ccc;
margin: auto;
transform: translateY(-100%);
}
.shape {
position: absolute;
width: 50px;
top: 50%;
left: 50%;
opacity: 0;
}
.rectangle {
height: 50px;
border: 2px solid #ccc;
}
.circle3 {
height: 50px;
border: 2px solid #ccc;
border-radius: 50%;
}
.circle {
position: absolute;
width: 140px;
height: 140px;
border-radius: 50%;
box-sizing: border-box;
border: 70px solid #ccc;
left: -100px;
right: -100px;
top: -100px;
bottom: -100px;
margin: auto;
opacity: 0;
}
.circle2 {
width: 300px;
height: 300px;
}
.glitter {
position: absolute;
left: 50%;
top: 50%;
width: 100px;
height: 2px;
background: #ccc;
transform-origin: 0px 1px;
}
.logo {
position: absolute;
width: 295px;
height: 50px;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
font-size: 0px;
overflow: hidden;
}
.character {
position: relative;
display: inline-block;
width: 35px;
height: 50px;
overflow: hidden;
text-align: center;
}
.character span {
position: relative;
display: block;
width: 100%;
height: 100%;
line-height: 50px;
text-align: center;
font-size: 40px;
font-weight: 300;
z-index: 2;
}
.character.d {
transform-origin: 0%;
/* background: #333; */
color: white;
width: 50px;
}
.character .d-back {
position: absolute;
width: 100%;
height: 50%;
background: #333;
transform-origin: 0;
}
.character .back1 {
top: 0;
}
.character .back2 {
bottom: 0;
}
document.querySelector(".star5").appendChild(Shape.star({side: 5, width: 50, stroke: "#ccc", strokeWidth: 2}));
document.querySelector(".polygon6").appendChild(Shape.poly({side: 6, width: 50, stroke: "#ccc", strokeWidth: 2}));
document.querySelector(".triangle").appendChild(Shape.poly({side: 3, width: 50, stroke: "#ccc", strokeWidth: 2}));
const mainScene = new Scene({
".line-top": {
0: {
transform: "translateY(-100%) scaleY(1)",
},
1: {
transform: "translateY(0%) scaleY(0)",
},
options: {
easing: "ease-in",
},
},
".circle1": {
0: {
"border-width": "100px",
"transform": "scale(0)",
},
0.9: {
opacity: 1,
},
1: {
"border-width": "0px",
"transform": "scale(1)",
"opacity": 0,
},
options: {
delay: 1,
},
},
".circle2": {
0: {
"border-width": "200px",
"transform": "scale(0)",
},
0.3: {
opacity: 1,
},
0.9: {
"border-width": "0px",
"transform": "scale(1)",
"opacity": 0,
},
2: 1,
options: {
delay: 1.6,
},
},
".rectangle": {
0: {
opacity: 0,
transform: "translate(-50%, -50%) rotate(30deg) translate2(0px) scale(0.3)",
},
0.1: {
opacity: 1,
},
1: {
opacity: 1,
},
1.5: {
transform: "rotate(0deg) translate2(-100px) scale(1)",
opacity: 0,
},
options: {
delay: 2,
},
},
".star5": {
0: {
opacity: 0,
transform: "translate(-50%, -50%) translate2(0px, 0px) rotate(0deg) scale(0.3)",
},
0.1: {
opacity: 1,
},
1: {
opacity: 1,
},
1.5: {
transform: "rotate(150deg) translate2(-5px, -98px) scale(1)",
opacity: 0,
},
options: {
delay: 2,
},
},
".circle3": {
0: {
opacity: 0,
transform: "translate(-50%, -50%) translate2(0px, 0px) rotate(0deg) scale(0.3)",
},
0.1: {
opacity: 1,
},
1: {
opacity: 1,
},
1.5: {
transform: "rotate(150deg) translate2(95px, -40px) scale(1)",
opacity: 0,
},
options: {
delay: 2,
},
},
".polygon6": {
0: {
opacity: 0,
transform: "translate(-50%, -50%) translate2(0px, 0px) rotate(0deg) scale(0.3)",
},
0.1: {
opacity: 1,
},
1: {
opacity: 1,
},
1.5: {
transform: "rotate(150deg) translate2(75px, 75px) scale(1)",
opacity: 0,
},
options: {
delay: 2,
},
},
".triangle": {
0: {
opacity: 0,
transform: "translate(-50%, -50%) translate2(0px, 0px) rotate(0deg) scale(0.3)",
},
0.1: {
opacity: 1,
},
1: {
opacity: 1,
},
1.5: {
transform: "rotate(-150deg) translate2(-40px, 90px) scale(1)",
opacity: 0,
},
options: {
delay: 2,
},
},
".d-back": i => ({
transform: {
scaleX: [0, 1],
},
options: {
duration: 1,
delay: 2.8 + i * 0.2,
},
}),
".character span": i => ({
0: {
transform: "translate(-100%)",
},
1: {
transform: "translate(0%)",
},
options: {
delay: 3.1 + i * 0.2,
},
}),
".glitter": i => ({
0: {
width: "0px",
transform: {
rotate: `${360 / 8 * i}deg`,
translate: "0px",
scaleX: 1,
},
opacity: 0,
},
0.5: {
width: "50px",
opacity: 1,
},
1: {
width: "0px",
transform: {
translate: "100px",
scaleX: 0,
},
opacity: 0,
},
options: {
delay: 1,
},
}),
}, {
easing: "ease-out",
selector: true,
iterationCount: "infinite",
}).playCSS();
Also see: Tab Triggers