Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Auto Save

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

              
                .editor-text
.scanlines
              
            
!

CSS

              
                @import "bourbon";

@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono);

$text-color: #9F9;
$shadow: #0F0;

body {
  background: #010;
  @include filter(blur(1px));
  overflow: hidden;
}

.scanlines {
  pointer-events: none; // Thanks to  @long-lazuli for this tip.
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  
  // @ryanmcnz thought this bit up.
  @include background-image(linear-gradient(#020 0%, transparent 25%));
	background-size: 4px 4px;
}

.editor-text {
  color: $text-color;
  font-size: 3em;
  text-shadow: 1px 0px 5px $shadow, 
    -1px 0px 2px $shadow;
    
  font-family: Ubuntu Mono;
  font-weight: light;
  line-height: 2em;
  
  margin: 100px;
}
              
            
!

JS

              
                var $text = $('.editor-text');

function set(txt) {
  $text.html(txt);
}

function slicer(str) {
  var sliced = [];
  for (var i = 0; i <= str.length; i++) {
    sliced.push(str.slice(0, i));
  }
  
  return sliced;
}

function pause (str, time) {
  // Return an array with time copies of str
  
  var strings = [];
  for (var i = 0; i < time; i++) {
    strings.push(str);
  }
  return strings;
}

function assemble(statements) {
  var slices = [];
  
  statements.forEach(function (stmt) {
    var sliced = slicer(stmt);
    var interstatementPause = pause("", 3);
    slices = slices.concat(sliced);
    
    // Pause on the completed statement
    slices = slices.concat(pause(stmt, 30));
    
    // Backspace it away
    // slices = slices.concat(sliced.reverse());
    slices = slices.concat(interstatementPause);
  });
  return slices;
}

var statements = [
  "Wake up, Neo...",
  "The Matrix has you...",
  "Follow the white rabbit.",
  "Knock, knock, Neo."
]

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

var slices = assemble(statements);

function animate() {
  var current = slices.shift();
  set(current);
  slices.push(current);
  setTimeout(animate, rand(50, 250));
}

animate()
              
            
!
999px

Console