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

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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                let width = 480;
let height = 240;
let sprites = {};
let xpos = 16;

// create app
let app = new PIXI.Application({
  width: width,
  height: height,
  antialias: true,
  backgroundColor: 0xeeeeee
});

// add canvas to HTML document
document.body.appendChild(app.view);

// use the pre-created instance offered by pixi
const loader = PIXI.Loader.shared;

// check loader' signals
loader.onProgress.add((loader, resource) => {
  // called once for each file
  console.log("progress: " + loader.progress + "%");
});
loader.onError.add((message, loader, resource) => {
  // called once for each file, if error
  console.log("Error: " + resource.name + " " + message);
});
loader.onLoad.add((loader, resource) => {
  // called once per loaded file
  console.log(resource.name + " loaded");
});
loader.onComplete.add((loader, resources) => {
  // called once all queued resources has been loaded
  // triggered before load method callback
  console.log("loading complete!");
});

// add resources to load and process
loader
  /*
  // another format
  .add([
    {
      name: "coffee",
      url: "https://i.ibb.co/M547g7R/coffee-cup.png",
      crossOrigin: "anonymus"
    }
  ])
  */
  .add("coffee", "https://i.ibb.co/M547g7R/coffee-cup.png")
  .add("muffin", "https://i.ibb.co/MPQS7xP/muffin.png")
  .add("ice-cream", "https://i.ibb.co/k3xfjZM/ice-cream.png")
  .add("lollipop", "https://i.ibb.co/kKCYwmX/lollipop.png")
  .load((loader, resources) => {
    // this callback function is optional
    // it is called once all resources have loaded.
    // similar to onComplete, but triggered after
    console.log("all assets loaded OK");
  })
  .use((resource, next) => {
    // middleware to process each resource
    sprites[resource.name] = new PIXI.Sprite(resource.texture);
    sprites[resource.name].y = 16;
    sprites[resource.name].x = xpos;

    app.stage.addChild(sprites[resource.name]);
    xpos += 72;
    next(); // <- mandatory
  });

              
            
!
999px

Console