cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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.

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

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

<svg xmlns="http://www.w3.org/2000/svg" id="constellation" viewBox="0 0 800 600">
  
 <!--  PASTE YOUR SVG HERE  -->
<g id="draw" fill="#ffffff" fill-rule="nonzero" stroke="#ff0000" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><circle cx="189.77083" cy="64.77083" r="2" id="circle_24" opacity="0.5"></circle><circle cx="233.77083" cy="55.77083" r="2" id="circle_28" opacity="0.5"></circle><circle cx="237.77083" cy="85.77083" r="2" id="circle_33" opacity="0.5"></circle><circle cx="171.77083" cy="88.77083" r="2" id="circle_39" opacity="0.5"></circle><circle cx="211.77083" cy="84.77083" r="2" id="circle_46" opacity="0.5"></circle><circle cx="189.77083" cy="96.77083" r="2" id="circle_54" opacity="0.5"></circle><circle cx="225.77083" cy="95.77083" r="2" id="circle_63" opacity="0.5"></circle><circle cx="208.77083" cy="143.77083" r="2" id="circle_73" opacity="0.5"></circle><circle cx="232.77083" cy="138.77083" r="2" id="circle_84" opacity="0.5"></circle><circle cx="234.77083" cy="195.77083" r="2" id="circle_96" opacity="0.5"></circle><circle cx="203.77083" cy="187.77083" r="2" id="circle_109" opacity="0.5"></circle><circle cx="179.77083" cy="225.77083" r="2" id="circle_123" opacity="0.5"></circle><circle cx="239.77083" cy="233.77083" r="2" id="circle_138" opacity="0.5"></circle></g>
 <!--  END PASTED CODE -->
  
</svg>
            
          
!
            
              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;
}

.starscape {
  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;
}

#shooting-star {
  fill: #FADFAA;
}

#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;
}

            
          
!
            
              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("shooting-star");

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);
  }
}

drawing();

var t1 = new TimelineMax({
  onReverseComplete: reverseRepeat,
  onReverseCompleteParams: ['{self}'],
  onComplete: complete,
  onCompleteParams: ['{self}']
});

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.timeScale(4);

// PASTE YOUR JAVASCRIPT HERE
// Copy and paste this JS code into the "// PASTE YOUR JAVASCRIPT HERE" section of the JavaScript panel of the CodePen template

var circle_24 = $("#circle_24");
var circle_28 = $("#circle_28");
var circle_33 = $("#circle_33");
var circle_39 = $("#circle_39");
var circle_46 = $("#circle_46");
var circle_54 = $("#circle_54");
var circle_63 = $("#circle_63");
var circle_73 = $("#circle_73");
var circle_84 = $("#circle_84");
var circle_96 = $("#circle_96");
var circle_109 = $("#circle_109");
var circle_123 = $("#circle_123");
var circle_138 = $("#circle_138");
t1.to(circle_24, 0.5, {attr:{cx:189.77083, cy:64.77083}}, "frame_000")
.to(circle_28, 0.5, {attr:{cx:233.77083, cy:55.77083}}, "frame_000")
.to(circle_33, 0.5, {attr:{cx:237.77083, cy:85.77083}}, "frame_000")
.to(circle_39, 0.5, {attr:{cx:171.77083, cy:88.77083}}, "frame_000")
.to(circle_46, 0.5, {attr:{cx:211.77083, cy:84.77083}}, "frame_000")
.to(circle_54, 0.5, {attr:{cx:189.77083, cy:96.77083}}, "frame_000")
.to(circle_63, 0.5, {attr:{cx:225.77083, cy:95.77083}}, "frame_000")
.to(circle_73, 0.5, {attr:{cx:208.77083, cy:143.77083}}, "frame_000")
.to(circle_84, 0.5, {attr:{cx:232.77083, cy:138.77083}}, "frame_000")
.to(circle_96, 0.5, {attr:{cx:234.77083, cy:195.77083}}, "frame_000")
.to(circle_109, 0.5, {attr:{cx:203.77083, cy:187.77083}}, "frame_000")
.to(circle_123, 0.5, {attr:{cx:179.77083, cy:225.77083}}, "frame_000")
.to(circle_138, 0.5, {attr:{cx:239.77083, cy:233.77083}}, "frame_000")
.to(circle_24, 0.5, {attr:{cx:186.77083, cy:86.77083}}, "frame_001")
.to(circle_28, 0.5, {attr:{cx:235.77083, cy:85.77083}}, "frame_001")
.to(circle_33, 0.5, {attr:{cx:245.77083, cy:113.77083}}, "frame_001")
.to(circle_39, 0.5, {attr:{cx:175.77083, cy:113.77083}}, "frame_001")
.to(circle_46, 0.5, {attr:{cx:209.77083, cy:91.77083}}, "frame_001")
.to(circle_54, 0.5, {attr:{cx:194.77083, cy:109.77083}}, "frame_001")
.to(circle_63, 0.5, {attr:{cx:226.77083, cy:104.77083}}, "frame_001")
.to(circle_73, 0.5, {attr:{cx:209.77083, cy:151.77083}}, "frame_001")
.to(circle_84, 0.5, {attr:{cx:230.77083, cy:148.77083}}, "frame_001")
.to(circle_96, 0.5, {attr:{cx:237.77083, cy:200.77083}}, "frame_001")
.to(circle_109, 0.5, {attr:{cx:204.77083, cy:199.77083}}, "frame_001")
.to(circle_123, 0.5, {attr:{cx:191.77083, cy:231.77083}}, "frame_001")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_001")
.to(circle_24, 0.5, {attr:{cx:181.77083, cy:114.77083}}, "frame_002")
.to(circle_28, 0.5, {attr:{cx:242.77083, cy:111.77083}}, "frame_002")
.to(circle_33, 0.5, {attr:{cx:235.77083, cy:144.77083}}, "frame_002")
.to(circle_39, 0.5, {attr:{cx:192.77083, cy:143.77083}}, "frame_002")
.to(circle_46, 0.5, {attr:{cx:211.77083, cy:105.77083}}, "frame_002")
.to(circle_54, 0.5, {attr:{cx:199.77083, cy:121.77083}}, "frame_002")
.to(circle_63, 0.5, {attr:{cx:224.77083, cy:119.77083}}, "frame_002")
.to(circle_73, 0.5, {attr:{cx:203.77083, cy:163.77083}}, "frame_002")
.to(circle_84, 0.5, {attr:{cx:228.77083, cy:159.77083}}, "frame_002")
.to(circle_96, 0.5, {attr:{cx:238.77083, cy:198.77083}}, "frame_002")
.to(circle_109, 0.5, {attr:{cx:201.77083, cy:200.77083}}, "frame_002")
.to(circle_123, 0.5, {attr:{cx:191.77083, cy:231.77083}}, "frame_002")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_002")
.to(circle_24, 0.5, {attr:{cx:197.77083, cy:141.77083}}, "frame_003")
.to(circle_28, 0.5, {attr:{cx:234.77083, cy:144.77083}}, "frame_003")
.to(circle_33, 0.5, {attr:{cx:228.77083, cy:176.77083}}, "frame_003")
.to(circle_39, 0.5, {attr:{cx:205.77083, cy:172.77083}}, "frame_003")
.to(circle_46, 0.5, {attr:{cx:215.77083, cy:115.77083}}, "frame_003")
.to(circle_54, 0.5, {attr:{cx:193.77083, cy:131.77083}}, "frame_003")
.to(circle_63, 0.5, {attr:{cx:230.77083, cy:128.77083}}, "frame_003")
.to(circle_73, 0.5, {attr:{cx:200.77083, cy:176.77083}}, "frame_003")
.to(circle_84, 0.5, {attr:{cx:221.77083, cy:175.77083}}, "frame_003")
.to(circle_96, 0.5, {attr:{cx:238.77083, cy:202.77083}}, "frame_003")
.to(circle_109, 0.5, {attr:{cx:204.77083, cy:207.77083}}, "frame_003")
.to(circle_123, 0.5, {attr:{cx:191.77083, cy:231.77083}}, "frame_003")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_003")
.to(circle_24, 0.5, {attr:{cx:201.77083, cy:149.77083}}, "frame_004")
.to(circle_28, 0.5, {attr:{cx:234.77083, cy:156.77083}}, "frame_004")
.to(circle_33, 0.5, {attr:{cx:247.77083, cy:192.77083}}, "frame_004")
.to(circle_39, 0.5, {attr:{cx:208.77083, cy:175.77083}}, "frame_004")
.to(circle_46, 0.5, {attr:{cx:221.77083, cy:111.77083}}, "frame_004")
.to(circle_54, 0.5, {attr:{cx:202.77083, cy:127.77083}}, "frame_004")
.to(circle_63, 0.5, {attr:{cx:230.77083, cy:128.77083}}, "frame_004")
.to(circle_73, 0.5, {attr:{cx:200.77083, cy:178.77083}}, "frame_004")
.to(circle_84, 0.5, {attr:{cx:221.77083, cy:175.77083}}, "frame_004")
.to(circle_96, 0.5, {attr:{cx:234.77083, cy:208.77083}}, "frame_004")
.to(circle_109, 0.5, {attr:{cx:207.77083, cy:211.77083}}, "frame_004")
.to(circle_123, 0.5, {attr:{cx:191.77083, cy:231.77083}}, "frame_004")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_004")
.to(circle_24, 0.5, {attr:{cx:186.77083, cy:154.77083}}, "frame_005")
.to(circle_28, 0.5, {attr:{cx:247.77083, cy:151.77083}}, "frame_005")
.to(circle_33, 0.5, {attr:{cx:224.77083, cy:177.77083}}, "frame_005")
.to(circle_39, 0.5, {attr:{cx:195.77083, cy:166.77083}}, "frame_005")
.to(circle_46, 0.5, {attr:{cx:224.77083, cy:104.77083}}, "frame_005")
.to(circle_54, 0.5, {attr:{cx:204.77083, cy:124.77083}}, "frame_005")
.to(circle_63, 0.5, {attr:{cx:233.77083, cy:125.77083}}, "frame_005")
.to(circle_73, 0.5, {attr:{cx:173.77083, cy:180.77083}}, "frame_005")
.to(circle_84, 0.5, {attr:{cx:266.77083, cy:169.77083}}, "frame_005")
.to(circle_96, 0.5, {attr:{cx:232.77083, cy:202.77083}}, "frame_005")
.to(circle_109, 0.5, {attr:{cx:193.77083, cy:199.77083}}, "frame_005")
.to(circle_123, 0.5, {attr:{cx:171.77083, cy:234.77083}}, "frame_005")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_005")
.to(circle_24, 0.5, {attr:{cx:182.77083, cy:131.77083}}, "frame_006")
.to(circle_28, 0.5, {attr:{cx:257.77083, cy:122.77083}}, "frame_006")
.to(circle_33, 0.5, {attr:{cx:221.77083, cy:165.77083}}, "frame_006")
.to(circle_39, 0.5, {attr:{cx:195.77083, cy:166.77083}}, "frame_006")
.to(circle_46, 0.5, {attr:{cx:222.77083, cy:96.77083}}, "frame_006")
.to(circle_54, 0.5, {attr:{cx:203.77083, cy:113.77083}}, "frame_006")
.to(circle_63, 0.5, {attr:{cx:237.77083, cy:114.77083}}, "frame_006")
.to(circle_73, 0.5, {attr:{cx:157.77083, cy:149.77083}}, "frame_006")
.to(circle_84, 0.5, {attr:{cx:280.77083, cy:136.77083}}, "frame_006")
.to(circle_96, 0.5, {attr:{cx:223.77083, cy:197.77083}}, "frame_006")
.to(circle_109, 0.5, {attr:{cx:188.77083, cy:192.77083}}, "frame_006")
.to(circle_123, 0.5, {attr:{cx:164.77083, cy:230.77083}}, "frame_006")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_006")
.to(circle_24, 0.5, {attr:{cx:179.77083, cy:104.77083}}, "frame_007")
.to(circle_28, 0.5, {attr:{cx:247.77083, cy:95.77083}}, "frame_007")
.to(circle_33, 0.5, {attr:{cx:227.77083, cy:153.77083}}, "frame_007")
.to(circle_39, 0.5, {attr:{cx:203.77083, cy:157.77083}}, "frame_007")
.to(circle_46, 0.5, {attr:{cx:219.77083, cy:87.77083}}, "frame_007")
.to(circle_54, 0.5, {attr:{cx:201.77083, cy:105.77083}}, "frame_007")
.to(circle_63, 0.5, {attr:{cx:236.77083, cy:99.77083}}, "frame_007")
.to(circle_73, 0.5, {attr:{cx:158.77083, cy:97.77083}}, "frame_007")
.to(circle_84, 0.5, {attr:{cx:258.77083, cy:88.77083}}, "frame_007")
.to(circle_96, 0.5, {attr:{cx:223.77083, cy:197.77083}}, "frame_007")
.to(circle_109, 0.5, {attr:{cx:189.77083, cy:191.77083}}, "frame_007")
.to(circle_123, 0.5, {attr:{cx:166.77083, cy:232.77083}}, "frame_007")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_007")
.to(circle_24, 0.5, {attr:{cx:179.77083, cy:81.77083}}, "frame_008")
.to(circle_28, 0.5, {attr:{cx:240.77083, cy:81.77083}}, "frame_008")
.to(circle_33, 0.5, {attr:{cx:229.77083, cy:150.77083}}, "frame_008")
.to(circle_39, 0.5, {attr:{cx:205.77083, cy:152.77083}}, "frame_008")
.to(circle_46, 0.5, {attr:{cx:213.77083, cy:82.77083}}, "frame_008")
.to(circle_54, 0.5, {attr:{cx:197.77083, cy:96.77083}}, "frame_008")
.to(circle_63, 0.5, {attr:{cx:231.77083, cy:94.77083}}, "frame_008")
.to(circle_73, 0.5, {attr:{cx:156.77083, cy:64.77083}}, "frame_008")
.to(circle_84, 0.5, {attr:{cx:253.77083, cy:63.77083}}, "frame_008")
.to(circle_96, 0.5, {attr:{cx:227.77083, cy:194.77083}}, "frame_008")
.to(circle_109, 0.5, {attr:{cx:191.77083, cy:193.77083}}, "frame_008")
.to(circle_123, 0.5, {attr:{cx:173.77083, cy:234.77083}}, "frame_008")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_008")
.to(circle_24, 0.5, {attr:{cx:179.77083, cy:81.77083}}, "frame_009")
.to(circle_28, 0.5, {attr:{cx:237.77083, cy:71.77083}}, "frame_009")
.to(circle_33, 0.5, {attr:{cx:231.77083, cy:148.77083}}, "frame_009")
.to(circle_39, 0.5, {attr:{cx:208.77083, cy:150.77083}}, "frame_009")
.to(circle_46, 0.5, {attr:{cx:213.77083, cy:82.77083}}, "frame_009")
.to(circle_54, 0.5, {attr:{cx:197.77083, cy:96.77083}}, "frame_009")
.to(circle_63, 0.5, {attr:{cx:229.77083, cy:91.77083}}, "frame_009")
.to(circle_73, 0.5, {attr:{cx:178.77083, cy:51.77083}}, "frame_009")
.to(circle_84, 0.5, {attr:{cx:247.77083, cy:48.77083}}, "frame_009")
.to(circle_96, 0.5, {attr:{cx:227.77083, cy:194.77083}}, "frame_009")
.to(circle_109, 0.5, {attr:{cx:197.77083, cy:194.77083}}, "frame_009")
.to(circle_123, 0.5, {attr:{cx:176.77083, cy:233.77083}}, "frame_009")
.to(circle_138, 0.5, {attr:{cx:238.77083, cy:237.77083}}, "frame_009")
// end pasted code


            
          
!
999px
🕑 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 ..................

Console