<canvas id="main"></canvas>
* {padding: 0; margin: 0}
const app = new PIXI.Application({
  view: document.getElementById('main'),
  width: 500,
  height: 500,
  antialias: true,
  transparent: false,
  backgroundColor: 0x00CC99,
});

const container = new PIXI.Container();
app.stage.addChild(container);

const loader = new PIXI.Loader();
loader
  .add('fakeimg','https://i.imgur.com/j5QyG2t.png')
  .load((loader, resource)=> {
    console.log('Done');
    init(resource);
  })
function init(item) {
  console.log(item);
  const sprite = new PIXI.Sprite(item.fakeimg.texture);
  container.addChild(sprite);
}

app.ticker.add(() => {
  container.x = app.renderer.plugins.interaction.mouse.global.x;
  container.y = app.renderer.plugins.interaction.mouse.global.y;
});




External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/pixi.js/5.1.3/pixi.min.js