css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

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.

<canvas id="sky"></canvas> 

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600" class="constellation">
  <circle id="star2" cx="100.4" cy="150.4" r="1.8" style="fill: #FADFAA; opacity: 0" />

<svg xmlns="http://www.w3.org/2000/svg" id="horse" viewBox="0 0 800 600">
  <circle class="dots" style="fill: #FADFAA;" cx="51" cy="203" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="159" cy="181" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="268" cy="180" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="359" cy="131" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="409" cy="93" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="378" cy="100" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="430" cy="119" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="465" cy="153" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="357" cy="247" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="417" cy="264" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="450" cy="303" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="460" cy="327" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="367" cy="368" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="355" cy="367" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="345" cy="326" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="332" cy="269" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="200" cy="251" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="144" cy="259" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="99" cy="309" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="92" cy="363" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="15" cy="339" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="24" cy="348" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="43" cy="341" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="76" cy="297" r="2.2" /><circle class="dots" style="fill: #FADFAA;" cx="110" cy="266" r="2.2" />

<svg xmlns="http://www.w3.org/2000/svg" id="horse2" viewBox="0 0 800 600">
<circle id="c0" class="dots" style="fill: #FADFAA;" cx="16" cy="343" r="2.2" /><circle id="c1" class="dots" style="fill: #FADFAA;" cx="44" cy="343" r="2.2" /><circle id="c2" class="dots" style="fill: #FADFAA;" cx="74" cy="296" r="2.2" /><circle id="c3" class="dots" style="fill: #FADFAA;" cx="100" cy="369" r="2.2" /><circle id="c4" class="dots" style="fill: #FADFAA;" cx="88" cy="362" r="2.2" /><circle id="c5" class="dots" style="fill: #FADFAA;" cx="95" cy="311" r="2.2" /><circle id="c6" class="dots" style="fill: #FADFAA;" cx="146" cy="253" r="2.2" /><circle id="c7" class="dots" style="fill: #FADFAA;" cx="48" cy="205" r="2.2" /><circle id="c8" class="dots" style="fill: #FADFAA;" cx="172" cy="173" r="2.2" /><circle id="c9" class="dots" style="fill: #FADFAA;" cx="315" cy="170" r="2.2" /><circle id="c10" class="dots" style="fill: #FADFAA;" cx="425" cy="112" r="2.2" /><circle id="c11" class="dots" style="fill: #FADFAA;" cx="461" cy="168" r="2.2" /><circle id="c12" class="dots" style="fill: #FADFAA;" cx="464" cy="136" r="2.2" /><circle id="c13" class="dots" style="fill: #FADFAA;" cx="379" cy="96" r="2.2" /><circle id="c14" class="dots" style="fill: #FADFAA;" cx="355" cy="250" r="2.2" /><circle id="c15" class="dots" style="fill: #FADFAA;" cx="420" cy="268" r="2.2" /><circle id="c16" class="dots" style="fill: #FADFAA;" cx="449" cy="298" r="2.2" /><circle id="c17" class="dots" style="fill: #FADFAA;" cx="459" cy="327" r="2.2" /><circle id="c18" class="dots" style="fill: #FADFAA;" cx="374" cy="370" r="2.2" /><circle id="c19" class="dots" style="fill: #FADFAA;" cx="356" cy="365" r="2.2" /><circle id="c20" class="dots" style="fill: #FADFAA;" cx="343" cy="321" r="2.2" />
              html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;

#sky {
  background: -webkit-linear-gradient(#00111e 30%, #033d5e);
  background: -moz-linear-gradient(#00111e 30%, #033d5e);
  background: -o-linear-gradient(#00111e 30%, #033d5e);
  background: linear-gradient(#00111e 30%, #033d5e);
  overflow: hidden;

.constellation {
    width: 100%;
    height: 100%;
    margin-right: 0px;
    font: 1em source-sans-pro, Source Sans Pro, Helvetica, sans-serif;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 1000;

#star2 {
  fill: #FADFAA;

#horse {
  width: 100%;
    height: 100%;
    margin-right: 0px;
    font: 1em source-sans-pro, Source Sans Pro, Helvetica, sans-serif;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 1000;

#horse2 {
  width: 100%;
    height: 100%;
    margin-right: 0px;
    font: 1em source-sans-pro, Source Sans Pro, Helvetica, sans-serif;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 1000;
              function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
// Line up some sky vars
var c = document.getElementById('sky');
var ctx = c.getContext('2d');
var xMax = c.width = window.screen.availWidth;
var yMax = c.height = window.screen.availHeight;
var hmTimes = Math.round(xMax + yMax);	

var star2 = document.getElementById("star2");
var tl = new TimelineLite();

for(var i=0; i<=hmTimes; i++) {
  var x = getRandomInt(300,xMax/4);
  var y = getRandomInt(-100,yMax/4);
  var r = Math.floor((Math.random()*2)+1);//getRandomInt(0.5,2);
  tl.to(star2, Math.random(), {x:x,y:y,r:r,delay:Math.random()})
    .to(star2, 1, {x:y,y:x,autoAlpha:1})
    .to(star2, .5, {autoAlpha:0},"-=0.5");

function drawing() {
	for(var i=0; i<=hmTimes; i++) {
	  var randomX = Math.floor((Math.random()*xMax)+1);
	  var randomY = Math.floor((Math.random()*yMax)+1);
	  var randomSize = Math.floor((Math.random()*2)+1);
	  var randomOpacityOne = Math.floor((Math.random()*9)+1);
	  var randomOpacityTwo = Math.floor((Math.random()*9)+1);
	  var randomHue = Math.floor((Math.random()*360)+1);
    if(randomSize>1) {
      ctx.shadowBlur = Math.floor((Math.random()*15)+5);
      ctx.shadowColor = "white";
    ctx.fillStyle = "hsla("+randomHue+", 30%, 80%, ."+randomOpacityOne+randomOpacityTwo+")";
	  ctx.fillRect(randomX, randomY, randomSize, randomSize);

var c0 = $("#c0");
var c1 = $("#c1");
var c2 = $("#c2");
var c3 = $("#c3");
var c4 = $("#c4");
var c5 = $("#c5");
var c6 = $("#c6");
var c7 = $("#c7");
var c8 = $("#c8");
var c9 = $("#c9");
var c10 = $("#c10");
var c11 = $("#c11");
var c12 = $("#c12");
var c13 = $("#c13");
var c14 = $("#c14");
var c15 = $("#c15");
var c16 = $("#c16");
var c17 = $("#c17");
var c18 = $("#c18");
var c19 = $("#c19");
var c20 = $("#c20");

var t1 = new TimelineMax({

function reverseRepeat(tl) {
  tl.reverse(0); // 0 sets the playhead at the end of the animation

function complete(tl) {
  tl.restart(); // 0 sets the playhead at the end of the animation

t1.to(c7, 0.5, {attr:{cx:55, cy:211}}, "frame1")
.to(c8, 0.5, {attr:{cx:186, cy:177}}, "frame1")
.to(c2, 0.5, {attr:{cx:81, cy:284}}, "frame1")
.to(c1, 0.5, {attr:{cx:45, cy:333}}, "frame1")
.to(c0, 0.5, {attr:{cx:20, cy:331}}, "frame1")
.to(c5, 0.5, {attr:{cx:102, cy:290}}, "frame1")
.to(c6, 0.5, {attr:{cx:159, cy:256}}, "frame1")
.to(c4, 0.5, {attr:{cx:64, cy:358}}, "frame1")
.to(c3, 0.5, {attr:{cx:66, cy:372}}, "frame1")
.to(c20, 0.5, {attr:{cx:313, cy:322}}, "frame1")
.to(c19, 0.5, {attr:{cx:308, cy:364}}, "frame1")
.to(c14, 0.5, {attr:{cx:356, cy:261}}, "frame1")
.to(c17, 0.5, {attr:{cx:464, cy:339}}, "frame1")
.to(c16, 0.5, {attr:{cx:446, cy:333}}, "frame1")
.to(c15, 0.5, {attr:{cx:408, cy:300}}, "frame1")
.to(c10, 0.5, {attr:{cx:434, cy:121}}, "frame1")
.to(c11, 0.5, {attr:{cx:466, cy:175}}, "frame1")
.to(c13, 0.5, {attr:{cx:387, cy:107}}, "frame1")
.to(c2, 0.5, {attr:{cx:92, cy:265}}, "frame2")
.to(c1, 0.5, {attr:{cx:70, cy:318}}, "frame2")
.to(c0, 0.5, {attr:{cx:42, cy:324}}, "frame2")
.to(c7, 0.5, {attr:{cx:65, cy:209}}, "frame2")
.to(c8, 0.5, {attr:{cx:186, cy:170}}, "frame2")
.to(c13, 0.5, {attr:{cx:395, cy:101}}, "frame2")
.to(c10, 0.5, {attr:{cx:432, cy:122}}, "frame2")
.to(c11, 0.5, {attr:{cx:462, cy:178}}, "frame2")
.to(c12, 0.5, {attr:{cx:466, cy:146}}, "frame2")
.to(c14, 0.5, {attr:{cx:354, cy:261}}, "frame2")
.to(c15, 0.5, {attr:{cx:391, cy:322}}, "frame2")
.to(c16, 0.5, {attr:{cx:416, cy:361}}, "frame2")
.to(c19, 0.5, {attr:{cx:262, cy:356}}, "frame2")
.to(c18, 0.5, {attr:{cx:273, cy:371}}, "frame2")
.to(c20, 0.5, {attr:{cx:284, cy:316}}, "frame2")
.to(c6, 0.5, {attr:{cx:169, cy:262}}, "frame2")
.to(c5, 0.5, {attr:{cx:109, cy:276}}, "frame2")
.to(c4, 0.5, {attr:{cx:63, cy:344}}, "frame2")
.to(c3, 0.5, {attr:{cx:38, cy:347}}, "frame2")
.to(c7, 0.5, {attr:{cx:76, cy:216}}, "frame3")
.to(c10, 0.5, {attr:{cx:426, cy:131}}, "frame3")
.to(c12, 0.5, {attr:{cx:464, cy:152}}, "frame3")
.to(c11, 0.5, {attr:{cx:464, cy:184}}, "frame3")
.to(c14, 0.5, {attr:{cx:340, cy:263}}, "frame3")
.to(c15, 0.5, {attr:{cx:339, cy:330}}, "frame3")
.to(c16, 0.5, {attr:{cx:348, cy:367}}, "frame3")
.to(c19, 0.5, {attr:{cx:251, cy:357}}, "frame3")
.to(c18, 0.5, {attr:{cx:225, cy:369}}, "frame3")
.to(c20, 0.5, {attr:{cx:292, cy:320}}, "frame3")
.to(c2, 0.5, {attr:{cx:111, cy:261}}, "frame3")
.to(c0, 0.5, {attr:{cx:115, cy:321}}, "frame3")
.to(c3, 0.5, {attr:{cx:93, cy:332}}, "frame3")
.to(c1, 0.5, {attr:{cx:75, cy:331}}, "frame3")
.to(c4, 0.5, {attr:{cx:55, cy:327}}, "frame3")
.to(c6, 0.5, {attr:{cx:190, cy:256}}, "frame4")
.to(c2, 0.5, {attr:{cx:129, cy:272}}, "frame4")
.to(c0, 0.5, {attr:{cx:160, cy:326}}, "frame4")
.to(c3, 0.5, {attr:{cx:150, cy:345}}, "frame4")
.to(c1, 0.5, {attr:{cx:111, cy:322}}, "frame4")
.to(c4, 0.5, {attr:{cx:88, cy:337}}, "frame4")
.to(c5, 0.5, {attr:{cx:110, cy:256}}, "frame4")
.to(c7, 0.5, {attr:{cx:73, cy:226}}, "frame4")
.to(c14, 0.5, {attr:{cx:321, cy:271}}, "frame4")
.to(c15, 0.5, {attr:{cx:303, cy:331}}, "frame4")
.to(c16, 0.5, {attr:{cx:294, cy:368}}, "frame4")
.to(c20, 0.5, {attr:{cx:310, cy:338}}, "frame4")
.to(c19, 0.5, {attr:{cx:265, cy:348}}, "frame4")
.to(c18, 0.5, {attr:{cx:239, cy:342}}, "frame4")
.to(c13, 0.5, {attr:{cx:385, cy:105}}, "frame4")
.to(c10, 0.5, {attr:{cx:420, cy:136}}, "frame4")
.to(c11, 0.5, {attr:{cx:461, cy:184}}, "frame4")
.to(c12, 0.5, {attr:{cx:464, cy:154}}, "frame4")
.to(c9, 0.5, {attr:{cx:320, cy:169}}, "frame4")
.to(c7, 0.5, {attr:{cx:79, cy:232}}, "frame5")
.to(c2, 0.5, {attr:{cx:161, cy:293}}, "frame5")
.to(c0, 0.5, {attr:{cx:204, cy:330}}, "frame5")
.to(c3, 0.5, {attr:{cx:204, cy:354}}, "frame5")
.to(c1, 0.5, {attr:{cx:153, cy:319}}, "frame5")
.to(c4, 0.5, {attr:{cx:140, cy:338}}, "frame5")
.to(c5, 0.5, {attr:{cx:129, cy:266}}, "frame5").to(c6, 0.5, {attr:{cx:194, cy:250}}, "frame5").to(c20, 0.5, {attr:{cx:341, cy:331}}, "frame5").to(c19, 0.5, {attr:{cx:298, cy:341}}, "frame5").to(c18, 0.5, {attr:{cx:273, cy:329}}, "frame5").to(c15, 0.5, {attr:{cx:291, cy:321}}, "frame5").to(c16, 0.5, {attr:{cx:255, cy:364}}, "frame5").to(c12, 0.5, {attr:{cx:457, cy:162}}, "frame6").to(c11, 0.5, {attr:{cx:449, cy:183}}, "frame6").to(c13, 0.5, {attr:{cx:378, cy:106}}, "frame6").to(c10, 0.5, {attr:{cx:412, cy:138}}, "frame6").to(c8, 0.5, {attr:{cx:192, cy:172}}, "frame6").to(c20, 0.5, {attr:{cx:374, cy:308}}, "frame6").to(c19, 0.5, {attr:{cx:345, cy:335}}, "frame6").to(c18, 0.5, {attr:{cx:319, cy:325}}, "frame6").to(c15, 0.5, {attr:{cx:308, cy:342}}, "frame6").to(c16, 0.5, {attr:{cx:261, cy:360}}, "frame6").to(c0, 0.5, {attr:{cx:236, cy:339}}, "frame6").to(c3, 0.5, {attr:{cx:246, cy:360}}, "frame6").to(c2, 0.5, {attr:{cx:197, cy:313}}, "frame6").to(c5, 0.5, {attr:{cx:153, cy:286}}, "frame6").to(c1, 0.5, {attr:{cx:201, cy:326}}, "frame6").to(c4, 0.5, {attr:{cx:196, cy:347}}, "frame6").to(c15, 0.5, {attr:{cx:340, cy:324}}, "frame7").to(c16, 0.5, {attr:{cx:297, cy:337}}, "frame7").to(c20, 0.5, {attr:{cx:392, cy:286}}, "frame7").to(c15, 0.5, {attr:{cx:386, cy:322}}, "frame7").to(c18, 0.5, {attr:{cx:364, cy:337}}, "frame7").to(c5, 0.5, {attr:{cx:184, cy:302}}, "frame7").to(c0, 0.5, {attr:{cx:237, cy:324}}, "frame7").to(c3, 0.5, {attr:{cx:243, cy:343}}, "frame7").to(c4, 0.5, {attr:{cx:270, cy:372}}, "frame7").to(c1, 0.5, {attr:{cx:209, cy:327}}, "frame7").to(c2, 0.5, {attr:{cx:212, cy:285}}, "frame7").to(c8, 0.5, {attr:{cx:193, cy:180}}, "frame7").to(c7, 0.5, {attr:{cx:71, cy:230}}, "frame7").to(c20, 0.5, {attr:{cx:402, cy:278}}, "frame8").to(c15, 0.5, {attr:{cx:412, cy:321}}, "frame8").to(c18, 0.5, {attr:{cx:408, cy:341}}, "frame8").to(c19, 0.5, {attr:{cx:371, cy:314}}, "frame8").to(c16, 0.5, {attr:{cx:337, cy:332}}, "frame8").to(c13, 0.5, {attr:{cx:377, cy:117}}, "frame8").to(c10, 0.5, {attr:{cx:415, cy:138}}, "frame8").to(c11, 0.5, {attr:{cx:444, cy:188}}, "frame8").to(c12, 0.5, {attr:{cx:458, cy:170}}, "frame8").to(c7, 0.5, {attr:{cx:57, cy:214}}, "frame8").to(c0, 0.5, {attr:{cx:263, cy:334}}, "frame8").to(c3, 0.5, {attr:{cx:279, cy:353}}, "frame8").to(c5, 0.5, {attr:{cx:207, cy:307}}, "frame8").to(c2, 0.5, {attr:{cx:183, cy:327}}, "frame8").to(c1, 0.5, {attr:{cx:208, cy:369}}, "frame8");

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................