Jump to content

How to add pixi layers to a project


Cran
 Share

Recommended Posts

I am new to pixi and I can't seem to find any tutorials of how to install pixi - layers, there are pieces of what i need to do, in the main file the dist folder containing the compressed files, and running npm i pixi-layers, but i don't know how to set up the files so that command will run, i also think i may need an import command in my script, but i don't know the syntax i would need.

Sorry this is a really silly question but I can't seem to find a way to set this up, even if there was a video or tutorial that explains this that would be awesome.

Link to comment
Share on other sites

Well, it depends on whether you're old JQuery coder or new React one :)

Two ways.

1. You use vanillajs, no imports, no webpacks -  just download "distp/pixi-layers.js" add <script src = "pixi-layers.js"></script> after pixi.js in html page.

2. es6 import. Weppack, rollup, parcel - `npm i pixi-layers`, then https://github.com/pixijs/pixi-spine#webpack-and-angular 

Why not just make it like "react-xxx-plugin" ? Well, try to make a WebGL library that can work both with old vanilla js and imports, and supports TypeScript at the same time. Those who made "imports" in ES6 just didn't care about hardcore stuff.

One of downsides of npm packets-based architecture is that it can spawn two instances of PixiJS and they concurrent for texture cache, webgl resources and other stuff. That's why I recommend to actually know have some experience with imports before you use them. Stick to plain JS <script> tag if its possible.

 

Edited by ivan.popelyshev
Link to comment
Share on other sites

Thanks! That seems obvious now, but I had no idea how to add that, the first method should work for me, the dist folder has 3 files in it though, i assume those need to stay together in a folder so they can reference each other?

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