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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.




                body {
	margin: 0; // get rid of default margin
	overflow: hidden; // get rid of scrollbars

div {
  position: absolute;
	padding: 50vmin;  // initial dot size
  border-radius: 50%; // round dot
  transform-origin: 0 0 // keep dots within viewport at all times


                const _DOTS = document.querySelectorAll('div');

// helper function to generate
// a random number between a min and a max
// also has an int flag (if true returns an integer)
function rand(max = 1, min = 0, int = false) {
	let gen = min + (max - min)*Math.random();
	return int ? ~~gen : gen

function move() {
	_DOTS.forEach(c => {
		let sf = rand(1, .1); // random scale factor
		// set a transition of duration between .9s and 1s = `${rand(1, .9)}s`
		// set position and size = 
			`translate(calc(${rand()}*(100vw - ${sf}*100%)), 
								 calc(${rand()}*(100vh - ${sf}*100%))) 
		// set background = 
			`rgb(${rand(255)}, ${rand(255)}, ${rand(255)}, ${rand(1, .5)})`;

window.setInterval(move, 1000); // change dots every second