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="background">
<div class="flower roundpetal petal5 flower1">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
<div class="flower roundpetal petal5 flower2 blueflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
<div class="flower roundpetal petal5 flower3 yellowflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
<div class="flower roundpetal petal5 flower4 purpleflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
<div class="slope"></div>
<div class="tree">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="branch left branch1">
<div class="branch left branch-inner1">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="heart flower1 blueflower">
</div>
</div>
<div class="branch left branch-inner2">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="tulip flower1 redflower">
<div class="peak"></div>
</div>
</div>
<div class="branch left branch-inner3">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
</div>
<div class="flower petal5 flower1 redflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
</div>
<div class="branch right branch2">
<div class="branch left branch-inner1">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="flower petal5 flower1 blueflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
</div>
<div class="branch right branch-inner2">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="tulip flower1 greenflower">
<div class="peak"></div>
</div>
</div>
<div class="branch right branch-inner3">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="branch left branch-inner4">
<div class="leaf leaf1"></div>
<div class="flower petal5 flower1 yellowflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
</div>
<div class="tulip flower1 purpleflower">
<div class="peak"></div>
</div>
</div>
<div class="flower petal5 roundpetal flower1">
<div class="petal">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="branch left branch3">
<div class="branch right branch-inner1">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="heart flower1">
</div>
</div>
<div class="branch left branch-inner2">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="tulip flower1">
<div class="peak"></div>
</div>
</div>
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="flower roundpetal petal5 flower1 purpleflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
</div>
<div class="branch right branch4">
<div class="branch left branch-inner1">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="flower petal5 flower1 yellowflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
</div>
<div class="branch right branch-inner2">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="tulip tulip1 flower1 purpleflower">
<div class="peak"></div>
</div>
</div>
<div class="flower petal5 roundpetal flower1">
<div class="petal">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="branch left branch5">
<div class="branch right branch-inner1">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="heart flower1">
</div>
</div>
<div class="branch left branch-inner2">
<div class="leaf leaf1"></div>
<div class="leaf leaf2"></div>
<div class="leaf leaf3"></div>
<div class="tulip flower1 greenflower">
<div class="peak"></div>
</div>
</div>
<div class="flower roundpetal petal5 flower1 blueflower">
<div class="petal">
<div class="petal">
<div class="petal">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
body {
background : #FEFDE3;
}
.slope {
background: #CADC88;
width: 100%;
height: 100px;
border-radius: 50% 50% 0px 0px / 100% 100% 0px 0px;
overflow: hidden;
z-index: -1;
}
.slope:before {
content: "";
background: #F2EDB4;
border-radius: 50%;
width:80px;
height: 30px;
position: absolute;
left:50%;
margin-left: -40px;
top:-5px;
}
.background {
width: 350px;
height: 445px;
position: absolute;
margin: auto;
bottom: 0;
left: -200px;
right: -200px;
}
.background .slope {
position: absolute;
bottom:0;
}
.background>.flower {
width: 25px;
height: 25px;
z-index: 0;
}
.background>.flower1 {
top: 30px;
left: 20%;
}
.background>.flower2 {
top: 50px;
left: 40%;
}
.background>.flower3 {
top: 20px;
left: 60%;
}
.background>.flower4 {
top: 80px;
left: 80%;
}
.background>.flower5 {
top: 80px;
left: 50%;
}
.tree {
/* background: ; */
width:2px;
/* height: 200px; */
border-right: 8px solid transparent;
border-left: 8px solid transparent;
border-bottom: 300px solid #816954;
position: absolute;
left: 50%;
transform-origin: 50% 300px;
top: 50px;
margin-left: -8px;
}
.branch {
position: absolute;
width: 150px;
height: 40px;
border-bottom: 5px solid #816954;
}
.branch:before, .branch:after {
content: "";
position: absolute;
width: inherit;
height: inherit;
border:inherit;
border-radius: inherit;
z-index: 0;
}
.branch:before {
transform: rotate(1deg);
}
.branch:after {
transform: rotate(2deg);
}
.branch.left, .branch.left:before, .branch.left:after {
transform-origin: 0px 0px;
}
.branch.right, .branch.right:before, .branch.right:after {
transform-origin: 100% 0px;
}
.branch.left {
border-bottom-left-radius: 100% 100%;
transform-origin: 100% 100%;
}
.branch.right {
border-bottom-right-radius: 100% 100%;
transform-origin: 0% 100%;
margin-left: 1px;
}
.tree>.branch.left {
transform:rotate(5deg);
}
.tree>.branch.right {
transform:rotate(-5deg);
}
.leaf {
position: absolute;
width: 23px;
height: 23px;
background: #C5EABE;
border-radius: 0px 100%;
z-index: 1;
transform-origin: 0px 0px;
}
.leaf:before {
/* content:"";*/
position: absolute;
width:2px;
height: 2px;
background: #f55;
}
.flower {
position: absolute;
width: 50px;
height: 50px;
z-index: 2;
}
.flower:after {
position: absolute;
content: "";
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
background: #e55;
border-radius: 50%;
width: 30%;
height: 30%;
margin: auto;
}
.flower .petal {
width: 100%;
height: 100%;
position: absolute;
transform: rotate(72deg);
}
.flower .petal::before, .flower .petal::after {
content: "";
position: absolute;
width: 60%;
height: 60%;
background: #F0A5A6;
border-radius: 0px 100px;
top: 50%;
left: 50%;
margin-left: -20%;
margin-top: -20%;
transform-origin: 33% 33%;
}
.flower .petal::after {
transform: rotate(36deg)
}
.flower.petal5 .petal {
transform: rotate(144deg);
}
.flower.petal5 .petal::after {
transform: rotate(-72deg);
}
.flower.petal5>.petal::after {
content:none;
}
.flower.petal6 .petal{
transform: rotate(120deg);
}
.flower.petal6 .petal::after {
transform: rotate(60deg);
}
.flower.petal8 .petal{
transform: rotate(90deg);
}
.flower.petal8 .petal::after {
transform: rotate(45deg);
width: 56%;
height: 56%;
}
.flower.roundpetal .petal:before, .flower.roundpetal .petal:after{
width: 30%;
border-radius: 0px;
margin-left: -15%;
margin-top: 0%;
top: 0%;
height: 50%;
border-radius: 50% 50% 0px 0px;
transform-origin: 50% 100%;
}
.heart {
position:absolute;
width: 50px;
height: 50px;
z-index: 2;
}
.heart:before, .heart:after {
position: absolute;
content: "";
width:80%;
height: 80%;
border-radius: 100% 0%;
background: #F0A5A6;
left: 50%;
top: 20%;
transform-origin: 0% 100%;
}
.heart:before {
transform: rotate(-65deg);
}
.heart:after {
transform: rotate(-25deg);
}
.tulip {
position:absolute;
width: 50px;
height: 50px;
z-index: 2;
transform-origin: 50% 100%;
}
.tulip:before, .tulip:after, .tulip .peak {
position: absolute;
content: "";
width:80%;
height: 80%;
border-radius: 100% 0%;
background: #F0A5A6;
left: 50%;
top: 20%;
transform-origin: 0% 100%;
}
.tulip:before {
transform: rotate(-70deg);
}
.tulip:after {
transform: rotate(-20deg);
}
.tulip .peak {
transform: rotate(-45deg);
}
.redflower:before, .redflower:after, .redflower .peak , .redflower .petal:before, .redflower .petal:after {
background: #F0A5A6;
}
.greenflower:before, .greenflower:after, .greenflower .peak , .greenflower .petal:before, .greenflower .petal:after {
background: #D5E4B6;
}
.blueflower:before, .blueflower:after, .blueflower .peak , .blueflower .petal:before, .blueflower .petal:after {
background: #A7D3ED;
}
.yellowflower:before, .yellowflower:after, .yellowflower .peak , .yellowflower .petal:before, .yellowflower .petal:after {
background: #FEDFBC;
}
.purpleflower:before, .purpleflower:after, .purpleflower .peak , .purpleflower .petal:before, .purpleflower .petal:after {
background: #F0CCFE;
}
.flower:after {
background: #f5f5f5;
}
.branch .branch:after {
content:none;
}
.tree>.leaf1 {
width: 15px;
height: 15px;
transform: rotate(-150deg);
}
.tree>.leaf2 {
width: 15px;
height: 15px;
transform: rotate(-100deg);
}
.branch1 {
top: 190px;
right: 0;
}
.branch1 .branch-inner1 {
width: 60px;
height: 40px;
transform: rotate(35deg);
border-bottom-left-radius: 100% 70%;
left: 50px;
top: 0px;
border-width: 5px;
}
.branch1 .branch-inner2 {
width: 50px;
height: 20px;
transform: rotate(-40deg);
border-bottom-left-radius: 100% 70%;
left: 26px;
top: 13px;
border-width: 4px;
}
.branch1 .branch-inner3 {
width: 20px;
height: 10px;
transform: rotate(40deg);
border-bottom-left-radius: 100% 70%;
left: 16px;
top: 15px;
border-width: 3px;
}
.branch1 .branch-inner1 .leaf1 {
transform: rotate(-150deg);
top: 38px;
left: 40px;
}
.branch1 .branch-inner1 .leaf2 {
width: 17px;height: 17px;
transform: rotate(110deg);
top: 38px;
left: 20px;
}
.branch1 .branch-inner1 .leaf3 {
width: 17px;height: 17px;
transform: rotate(-150deg);
top: 30px;
left: 14px;
}
.branch1 .branch-inner2 .leaf1 {
transform: rotate(80deg);
left: 40px;
top: 24px;
}
.branch1 .branch-inner2 .leaf2 {
width: 20px;height: 20px;
transform: rotate(-160deg);
left: 30px;
top: 20px;
}
.branch1 .branch-inner2 .leaf3 {
width: 17px;height: 17px;
transform: rotate(100deg);
left: 10px;
top: 18px;
}
.branch1 .branch-inner3 .leaf1 {
width: 15px;height: 15px;
transform: rotate(-150deg);
left: 18px;
top: 10px;
}
.branch1 .branch-inner3 .leaf2 {
width: 15px; height: 15px;
transform: rotate(130deg);
left: 9px;
top: 12px;
}
.branch1>.flower1 {
right: 100%;
bottom: 100%;
width: 30px;
height: 30px;
margin-right: -15px;
margin-bottom: -15px;
}
.branch1 .branch-inner1 .flower1 {
width: 18px;
height: 18px;
top: 5px;
left: -12px;
transform: rotate(-25deg);
}
.branch1 .branch-inner2 .flower1 {
width: 20px;
height: 20px;
top: -25%;
left: 0%;
transform: rotate(-55deg);
}
.branch2 {
height: 60px;
top: 130px;
left: 0;
}
.branch2 .branch-inner1 {
width: 60px;
height: 70px;
transform: rotate(90deg);
border-bottom-left-radius: 100% 70%;
left: -26px;
top: -13px;
border-width: 5px;
}
.branch2 .branch-inner2 {
width: 60px;
height: 80px;
transform: rotate(60deg);
border-bottom-right-radius: 100% 70%;
left: 55px;
top: -26px;
border-width: 4px;
}
.branch2 .branch-inner3 {
width: 40px;
height: 30px;
transform: rotate(30deg);
border-bottom-right-radius: 100% 100%;
left: 110px;
top: 10px;
border-width: 3px;
}
.branch2 .branch-inner4 {
width: 20px;
height: 15px;
transform: rotate(180deg);
border-bottom-left-radius: 100% 100%;
left: 0px;
top: 8px;
border-width: 2px;
}
.branch2 .branch-inner1 .leaf1 {
transform: rotate(120deg);
top: 74px;
left: 40px;
}
.branch2 .branch-inner1 .leaf2 {
transform: rotate(220deg);
top: 63px;
left: 30px;
width: 20px;
height: 20px;
}
.branch2 .branch-inner1 .leaf3 {
transform: rotate(150deg);
top: 60px;
left: 14px;
width: 17px;
height: 17px;
}
.branch2 .branch-inner2 .leaf1 {
transform: rotate(-20deg);
top: 84px;
left: 10px;
}
.branch2 .branch-inner2 .leaf2 {
transform: rotate(-120deg);
top: 73px;
left: 25px;
width: 20px;
height: 20px;
}
.branch2 .branch-inner2 .leaf3 {
transform: rotate(-40deg);
top: 65px;
left: 44px;
width: 17px;
height: 17px;
}
.branch2 .branch-inner3>.leaf1 {
transform: rotate(0deg);
top: 32px;
left: 10px;
width: 20px;
height: 20px;
}
.branch2 .branch-inner3 .leaf2 {
transform: rotate(-120deg);
top: 25px;
left: 20px;
width: 20px;
height: 20px;
}
.branch2 .branch-inner3 .leaf3 {
transform: rotate(-50deg);
top: 14px;
left: 37px;
width: 17px;
height: 17px;
}
.branch2 .branch-inner4>.leaf1 {
transform: rotate(150deg);
top: 14px;
left: 6px;
width: 14px;
height: 14px;
}
.branch2>.flower1 {
width: 25px;
height: 25px;
right: -12px;
top: -8px;
}
.branch2 .branch-inner1 .flower1 {
width: 25px;
height: 25px;
left: -10px;
top: 25px;
}
.branch2 .branch-inner2 .flower1 {
transform: rotate(10deg);
width: 20px;
height: 20px;
right: -5px;
bottom: 30px;
}
.branch2 .branch-inner4 .flower1 {
width: 20px;
height: 20px;
left: -10px;
top: -10px;
}
.branch2 .branch-inner3>.flower1 {
transform: rotate(10deg);
width: 15px;
height: 15px;
right: -5px;
top: -5px;
}
.branch3 {
top: 70px;
right: 0;
width: 160px;
height: 70px;
}
.branch3 .branch-inner1 {
width: 60px;
height: 40px;
transform: rotate(-80deg);
border-bottom-right-radius: 100% 100%;
left: 70px;
top: 15px;
border-width: 4px;
}
.branch3 .branch-inner2 {
width: 60px;
height: 60px;
transform: rotate(-40deg);
border-bottom-left-radius: 100% 70%;
left: 36px;
top: 5px;
border-width: 4px;
}
.branch3 .branch-inner1 .leaf1 {
transform: rotate(-30deg);
top: 44px;
left: 15px;
}
.branch3 .branch-inner1 .leaf2 {
width: 17px;height: 17px;
transform: rotate(-95deg);
top: 35px;
left: 23px;
}
.branch3 .branch-inner1 .leaf3 {
width: 17px;height: 17px;
transform: rotate(-50deg);
top: 32px;
left: 44px;
}
.branch3 .branch-inner2 .leaf1 {
transform: rotate(80deg);
left: 50px;
top: 64px;
}
.branch3 .branch-inner2 .leaf2 {
width: 20px;height: 20px;
transform: rotate(-160deg);
left: 35px;
top: 56px;
}
.branch3 .branch-inner2 .leaf3 {
width: 17px;height: 17px;
transform: rotate(100deg);
left: 16px;
top: 50px;
}
.branch3>.leaf1 {
right: 20px;
transform: rotate(200deg);
bottom: -17px;
width: 18px;
height: 18px;
}
.branch3>.leaf2 {
right: 110px;
transform: rotate(220deg);
bottom: 10px;
width: 18px;
height: 18px;
}
.branch3 .flower.petal5 {
right: 100%;
bottom: 100%;
width: 30px;
height: 30px;
margin-right: -15px;
margin-bottom: -15px;
}
.branch3 .branch-inner1 .heart {
width: 18px;
height: 18px;
top: 0px;
left: 50px;
transform: rotate(35deg);
}
.branch3 .branch-inner2 .tulip {
width: 20px;
height: 20px;
top: 20px;
left: 0px;
transform: rotate(-25deg);
}
.branch4 {
width: 120px;
height: 40px;
top: 50px;
left: 0;
}
.branch4 .branch-inner1 {
width: 50px;
height: 60px;
transform: rotate(90deg);
border-bottom-left-radius: 100% 70%;
left: -26px;
top: -25px;
border-width: 5px;
}
.branch4 .branch-inner2 {
width: 50px;
height: 70px;
transform: rotate(60deg);
border-bottom-right-radius: 100% 70%;
left: 55px;
top: -36px;
border-width: 4px;
}
.branch4 .branch-inner1 .leaf1 {
transform: rotate(120deg);
top: 65px;
left: 42px;
}
.branch4 .branch-inner1 .leaf2 {
transform: rotate(220deg);
top: 57px;
left: 30px;
width: 20px;
height: 20px;
}
.branch4 .branch-inner1 .leaf3 {
transform: rotate(150deg);
top: 54px;
left: 14px;
width: 17px;
height: 17px;
}
.branch4 .branch-inner2 .leaf1 {
transform: rotate(-20deg);
top: 74px;
left: 10px;
}
.branch4 .branch-inner2 .leaf2 {
transform: rotate(-120deg);
top: 65px;
left: 20px;
width: 20px;
height: 20px;
}
.branch4 .branch-inner2 .leaf3 {
transform: rotate(-40deg);
top: 60px;
left: 35px;
width: 17px;
height: 17px;
}
.branch4>.flower1 {
width: 25px;
height: 25px;
right: -12px;
top: -8px;
}
.branch4 .branch-inner1 .flower1 {
width: 25px;
height: 25px;
left: -13px;
top: 15px;
}
.branch4 .tulip1 {
transform: rotate(10deg);
width: 20px;
height: 20px;
right: -8px;
bottom: 30px;
}
.branch5 {
top: 20px;
right: 0;
width: 90px;
height: 30px;
}
.branch5 .branch-inner1 {
width: 30px;
height: 30px;
border-bottom-right-radius: 100% 100%;
left: 50px;
top: -5px;
border-width: 4px;
transform: rotate(-60deg);
}
.branch5 .branch-inner2 {
width: 40px;
height: 40px;
transform: rotate(-50deg);
border-bottom-left-radius: 100% 80%;
left: 26px;
top: -10px;
border-width: 4px;
}
.branch5 .branch-inner1 .leaf1 {
transform: rotate(-20deg);
left: 20%;
bottom: -70%;
width: 18px;
height: 18px;
}
.branch5 .branch-inner1 .leaf2 {
width: 16px;height: 16px;
transform: rotate(-120deg);
top: 85%;
left: 40%;
}
.branch5 .branch-inner1 .leaf3 {
width: 14px;height: 14px;
transform: rotate(-50deg);
top: 65%;
left: 80%;
}
.branch5 .branch-inner2 .leaf1 {
transform: rotate(80deg);
left: 70%;
top: 110%;
width: 18px;
height: 18px;
}
.branch5 .branch-inner2 .leaf2 {
width: 16px;height: 16px;
transform: rotate(-140deg);
left: 43%;
top: 85%;
}
.branch5 .branch-inner2 .leaf3 {
width: 14px;height: 14px;
transform: rotate(100deg);
left: 20%;
top: 75%;
}
.branch5 .flower.petal5 {
right: 100%;
bottom: 100%;
width: 30px;
height: 30px;
margin-right: -15px;
margin-bottom: -15px;
}
.branch5 .branch-inner1 .heart {
width: 18px;
height: 18px;
top: -20%;
left:80%;
transform: rotate(35deg);
}
.branch5 .branch-inner2 .tulip {
width: 20px;
height: 20px;
top: 5px;
left: -5px;
transform: rotate(-15deg);
}
var sceneTree = new Scene({
".tree" : {
0: {transform:"scale(0)"},
1.5: {transform:"scale(1)"}
},
".background>.flower": function (i) {
return {
0: {opacity: 0, transform: "translateY(0px) rotate(0deg)"},
1: {opacity: 1},
4: {opacity: 1},
5: {opacity: 0, transform: "translateY(300px) rotate(360deg)"},
options: {
delay: 7 + i,
iterationCount: "infinite"
},
};
},
}, {
selector: true
});
var branchs = document.querySelectorAll(".tree .branch, .tree .leaf, .tree .flower1");
var depths = [0, 0, 0];
for (var i = 0; i < branchs.length; ++i) {
var sceneItem = sceneTree.newItem("item" + i);
var className = branchs[i].className;
if (~className.indexOf("branch-inner")) {
++depths[1];
depths[2] = 0;
} else if (~className.indexOf("branch")) {
++depths[0];
depths[1] = 0;
depths[2] = 0;
} else if (~className.indexOf("leaf") || ~className.indexOf("flower1")) {
++depths[2];
}
sceneItem.setElement(branchs[i]);
sceneItem.setCSS(0, ["transform"]);
var time = 1 + depths[0] * 0.5 + depths[1] * 0.5 + depths[2] * 0.5;
sceneItem.set(time, "transform", "scale", 0);
sceneItem.set(time + 1, "transform", "scale", 1);
}
sceneTree.playCSS();
Also see: Tab Triggers