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 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.


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.


                <canvas id="surface"></canvas>





                //Configure canvas
var canvas = document.getElementById('surface')
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
//Get canvas context
var ctx = canvas.getContext('2d')
var particles = []
//The greater this number, the more dazzling, and resource-hungry, this animation will become
var maxParticles = 2200

//Various green hues that can Particles can be
var green = ['#2ECC71', '#58D68D', '#239B56', '#48C9B0', '#117A65', '#239B56', '#82E0AA', '#52BE80']

function init() {
  //Generate Particles up until the limit
  for(var i = 0; i < maxParticles; i++) {
    particles.push(new Particle())

 * Extend array with a method to return a random member
 * @return {Mixed} A random value from the array
Array.prototype.random = function(){
  return this[Math.floor(Math.random() * this.length)]

 * Returns a random number that occurs between the min and max arguments
 * @param  {Number} min The lower bound of the range
 * @param  {Number} max The upper bound of the range
 * @return {Number}     The
function getRandomNumberBetweenRange(min, max) {
  return (Math.floor(Math.random() * (max - min + 1) + min));

 * A single transiting datagram
class Particle {
 constructor() {
 //On instantiation, assign y coordinates, lateral velocity, particle size, and color, all at random
 init() {
  this.x = 0,
  this.y = getRandomNumberBetweenRange(100, 400),
  this.vx = getRandomNumberBetweenRange(1, 40),
  this.radius = getRandomNumberBetweenRange(1, 5),
  this.color = green.random()
 //Draws the Particle according to its current properties
 render() {
  ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, true)
  ctx.fillStyle = this.color
 //Convenience method for determining if a Particle is off-screen
 timeToReset() {
  return this.x > canvas.width

function update() {
  //Wipe entire canvas
  ctx.fillStyle = 'rgba(0, 0, 0, 0.3)' //black background, with slight opacity to generate streaking effect
  ctx.fillRect(0, 0, canvas.width, canvas.height)
  particles.forEach((p) => {
    //If the particle has already transited across
    //the screen, reset its x coordinate to some random position to the left of the viewport
    if (p.timeToReset()) {
      p.x = getRandomNumberBetweenRange(-100, 0)
    } else {
      p.x += p.vx

//Commence matrix-y packet streaming