Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

Chrome Browser Action Set Icon With PixiJS Sprite

$
0
0

I am attempting to set a PixiJS animated sprite as a chrome browser extension icon, but running into quite a few issues.

Setting the app.view or app.stage as image data returns this error:

Quote

The imageData property must contain an ImageData object or dictionary of ImageData objects

I attempted to use new PIXI.CanvasExtract and new PIXI.CanvasRenderer to extract the pixels but they are now deprecated?

Quote

'CanvasExtract' is not exported from 'pixi.js'

Is there any insight on how I can get this to work? I can get the sprite to render as a normal react component, but not as the browser extension icon.

Here is my code snippet

componentDidMount() {
  const app = new PIXI.Application({ backgroundColor: 0x1099bb, height: 16, width: 16})
  
  const logo = PIXI.Sprite.from('/logo_16.png');
  app.stage.addChild(logo);

  chrome.browserAction.setIcon({imageData: app.view});
 }

 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>