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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.



Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:


Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO


                   <svg width="100%" viewBox="0 0 1000 1000" id="tile">
<rect id="background" width="1000" height="1000" style="fill:rgba(5,0,20,1)" z=0 />
<g id="starGroup">
<g class="starGroup" id="mStarGroup"></g>





                let x = 1000;
let y = parseInt(1000 * window.innerHeight / window.innerWidth);
let tile = document.getElementById('tile')
tile.setAttribute('viewBox', `0 0 ${x} ${y}`);
tile.querySelector('rect#background').setAttribute('height', y)
tile.querySelector('rect#background').setAttribute('width', x)

//These timelines hold the timelines for each point, allowing them to be grouped together
//For travelling horizontally
let timelineX = new TimelineMax({
            onComplete: function() {
            onReverseComplete: function() {
            repeat: -1,
//For travelling vertically
let timelineY = new TimelineMax({
            onComplete: function() {
            onReverseComplete: function() {
            repeat: -1,

//To control the speed/direction of the travelling
//Accellerate Y to demonstrate point,5,{timeScale:-100})
//X is not required for this, but has similar issue

//The things that get drawn & tweened
let star = (sX, sY, z = Math.random())=> {
                //Draw aspect
                let star = document.createElementNS("", 'rect')
                star.setAttribute('width', 2);
                star.setAttribute('height', 2);
                star.setAttribute('x', sX);
                star.setAttribute('y', sY);
                star.setAttribute('rx', 1);
                star.setAttribute('ry', 1);
       = `fill:rgba(${255},${230}, ${235},${Math.random()})`;
              //Tween/Timeline aspect
              //I wanted these to start in the [sX,sY] position then go to one side, and then return from the other to the original position but it didn't quite work out
                let xPath = new TimelineMax();
                xPath.add(TweenLite.fromTo(star, (x) * z / 5, {
                    x: x  - sX,
                    ease: Linear.easeNone,
                }, {
                    x: 0 - (sX + 1),
                    ease: Linear.easeNone,

                let yPath = new TimelineMax();
                yPath.add(TweenLite.fromTo(star, (y) * z / 5, {
                    y: y  - sY,
                    ease: Linear.easeNone,
                }, {
                    y: 0 - (sY + 1),
                    ease: Linear.easeNone,
				//In the end this seemed to work to get the stars to start in the random places
                timelineX.add(xPath, (0 - sX) * 5); 
                timelineY.add(yPath, (0 - sY) * 5);

          //This populates with the stars
            for (var cX = 0; cX < x; cX++) {
                for (var cY = 0; cY < y; cY++) {
                    if (Math.random() <= (0.0008)) {
                        star(cX, cY)

We'd ask you for an infinite loop joke, but we'd never hear the end of it.