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="testCanvas" width="550" height="500"></canvas>
<a href="" target="_blank"><div class="logo white"></div></a>

<div id="badges">
  <div class="badge click white"></div>


                canvas {
  cursor: pointer;


                var canvas = document.getElementById("testCanvas"),
    stage = new createjs.Stage(canvas);

// Preload the image
var image = new Image();
image.onload = function() { stage.update(); }
image.src = "";

// Create the ScaleBitmap instance
// We already know the size of the rectangle
var sb = new createjs.ScaleBitmap(image, 
  new createjs.Rectangle(12, 12, 5, 10));
sb.setDrawSize(200, 100); // Set an initial draw size.

// On mousedown, change the size, and center it.
stage.on("stagemousedown", function(e) {
    This is the magic sauce. Just set a new size and you are good to go!!!
    Math.random() * Math.min(600, canvas.width-200) + 100 | 0, // Random size
    Math.random() * Math.min(500, canvas.height-100) + 60 | 0

// Centered in the canvas
function center() {
  sb.x = canvas.width - sb.drawWidth >> 1;
  sb.y = canvas.height - sb.drawHeight >> 1;

// On resize, just redraw
function handleResize(event) {
  canvas.width = window.innerWidth;
  canvas.height = window.innerHeight;
window.addEventListener("resize", handleResize);