Jump to content

Using PIXI Projection with ES6


charlie_says
 Share

Recommended Posts

I was just trying some experiments with PIXI Projection, but am not able to get it working...

I think it could be to do with the imports, I know I had to do something a little different than I expected with PIXI.Sound

Can anyone give me any pointers?

(trying this as an import:

import * as Projection from 'pixi-projection'

gives this error:

TypeError: PIXI.BatchShaderGenerator is not a constructor )

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Hi @ivan.popelyshev, apologies for resurrecting this post.

I noticed that npm had been updated and thought I'd get back on this... but, I'm still not having any luck at getting it working.

If I try

import {PIXI_projection} from 'pixi-projection';

and try this:

console.log(PIXI_projection) // returns undefined

I get nothing, similarly any reference to Sprite2D  etc. just generates an error.

I can see the code is there in the node modules, so it must be a referencing error...

(Also, as a further sanity check, is PIXI.projection compatible with pixi.js-legacy?)

Link to comment
Share on other sites

Apologies for answering my own question - but just in case anyone comes across this issue.

You do still need to import the pixi projection module - but you don't use it directly.

I import like this:

import * as PIXI from 'pixi.js';
import unused_pixi_projection from 'pixi-projection';

and then just use as per the examples

this.sprt =new PIXI.projection.Sprite2d(PIXI.Texture.from('playBtn'));

If there is a better/proper way to do this, I'd be happy to hear it!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...