Jump to content

what is the best way to add bunch of images


Recommended Posts

Hello, So I need to add like 500 images and this is How I'm doing it:

class CreateP extends PIXI.Container {
    constructor(id, x, y, width, height)  {

        this.id = id

        this.bla = PIXI.Sprite.fromImage(`blabla.png`) //images/textures are not same
        this.bla.anchor.x = 0.5;
        this.bla.anchor.y = 0.5;
        this.bla.x = x
        this.bla.y = y
        this.bla.width = width
        this.bla.height = height


module.exports = CreateP 


this.blas = new PIXI.Container();
this.blas.addChild(new CreateP(id, x, y, width, height))  

now it kinda effects on performance pretty a lot, well I know this is a big number but I was wondering if there are some ways to improve the performance? maybe there is a better way to add these images?


this doesn't seems normal to me. is this updateTransform and GC normal here? I mean I'm not changing anything about those sprites. they are already added
BTW the sprites never move or change or any thing. they just get destroyed after a while.

Could RenderTexture help here? I read the docs but honestly couldn't understand what is the purpose of 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.

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.


  • Recently Browsing   0 members

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