Media Avatar - phreaknation/phaserwebcomponents GitHub Wiki

Photo component typically used to show profile photos or avatars.

new this.game.PhaserWebComponents.components.Media.Avatar({
  game: this.game,
  // attach to an HTML component. Will replace what ever selector you have
  target: htmlNode.querySelector('[data-replace="avatar"]'),
  // attach to a phaser object.
  // owner: PhaserObject,
  options: {
    // Used as a default image for any avatars that fail to load.
    defaultSource: '/url/to/default_avatar.png',
    // The image to show for the avatar.
    source: '/url/to/base_avatar.png',
    // Size of the avatar in any CSS format.
    size: '64px',
  }
})