Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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.

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.

HTML

              
                
              
            
!

CSS

              
                body {
	background-color: black;
}
              
            
!

JS

              
                // https://codepen.io/dagostinelli/pen/WLpXYY
// LICENSE -- MIT - Darryl T. Agostinelli
// http://www.darrylagostinelli.com

function getRandom(min, max) {
	return Math.random() * (max - min) + min;
}

function resetParticle(particle) {
	particle.velocity.x = getRandom(10, 150);
	particle.velocity.y = -getRandom(10, 300);

	particle.x = getRandom(-300, 200);
	particle.y = getRandom(-500, 500);
	particle.z = getRandom(-200, 200);
}

function letitsnow() {

	// Set the scene size.
	var WIDTH = window.innerWidth;
	var HEIGHT = window.innerHeight;

	var maxHeight = 200;
	var maxWidth = 250;
	
	var ROTATIONAL_VELOCITY_Y = 0.15;

	// Set some camera attributes.
	const VIEW_ANGLE = 45;
	const ASPECT = WIDTH / HEIGHT;
	const NEAR = 0.1;
	const FAR = 10000;

	// Get the DOM element to attach to
	const container = document.querySelector("body");

	// Create a WebGL renderer, camera
	// and a scene
	const renderer = new THREE.WebGLRenderer();
	const camera = new THREE.PerspectiveCamera(VIEW_ANGLE, ASPECT, NEAR, FAR);

	const scene = new THREE.Scene();

	// place the camera at z of 100
	camera.position.z = 100;

	// Add the camera to the scene.
	scene.add(camera);

	// Start the renderer.
	renderer.setSize(WIDTH, HEIGHT);

	renderer.setSize(window.innerWidth, window.innerHeight);
	renderer.domElement.style.position = "absolute";
	renderer.domElement.style.top = 0;
	renderer.domElement.style.left = 0;
	renderer.domElement.style.opacity = 0.5;
	renderer.domElement.style.zIndex = -10;
	renderer.domElement.style.height = "100%";

	// Attach the renderer-supplied
	// DOM element.
	container.appendChild(renderer.domElement);

	var particleCount = 1800;
	var particles = new THREE.Geometry();
	var pMaterial = new THREE.PointsMaterial({
		size: 5.0,
		map: new THREE.TextureLoader().load(
			"https://raw.githubusercontent.com/dagostinelli/assets/master/flake2.png"
		),
		transparent: true,
		blending: THREE.AdditiveBlending,
		fog: false,
		depthTest: false
	});

	for (var p = 0; p < particleCount; p++) {
		particle = new THREE.Vector3();
		particle.velocity = new THREE.Vector3();
		resetParticle(particle);

		// add it to the geometry
		particles.vertices.push(particle);
	}

	// create the particle system
	var particleSystem = new THREE.Points(particles, pMaterial);

	// add it to the scene
	scene.add(particleSystem);

	var clock = new THREE.Clock();

	function update() {
		delta = clock.getDelta();

		// add some rotation to the system
		particleSystem.rotation.y += ROTATIONAL_VELOCITY_Y * delta;

		var pCount = particleCount;
		while (pCount--) {
			var particle = particles.vertices[pCount];

			if (particle.y < -maxHeight) {
				particle.y = maxHeight;
				resetParticle(particle);
			}

			if (particle.x > maxWidth) {
				particle.x = -maxWidth;
				resetParticle(particle);
			}

			particle.x += particle.velocity.x * delta;
			particle.y += particle.velocity.y * delta;
			particle.z += particle.velocity.z * delta;
		}

		particles.normalsNeedUpdate = true;
		particles.verticesNeedUpdate = true;

		// Draw!
		renderer.render(scene, camera);

		// Schedule the next frame.
		requestAnimationFrame(update);
	}

	function onWindowResize() {
		camera.aspect = window.innerWidth / window.innerHeight;
		camera.updateProjectionMatrix();

		renderer.setSize(window.innerWidth, window.innerHeight);
	}

	window.addEventListener("resize", onWindowResize, false);

	// Schedule the first frame.
	requestAnimationFrame(update);
}

letitsnow();

              
            
!
999px

Console