Leaderboard


Popular Content

Showing content with the highest reputation on 03/30/20 in all areas

  1. 1 point
    The title pretty much says it all. I know that that contradicts the documentation, so I am assuming I have done something that is destroying performance. We have a texture atlas which that has 5 textures inside of it. Here is how we create our textures. pixiApp.loader.onComplete.add(async ()=>{ const baseTexture = pixiApp.loader.resources.sprites.texture.baseTexture; const flowers_textures_info = await d3.json('./flowers-textures-1.json'); for (let texture_name in flowers_textures_info.frames) { const frame = flowers_textures_info.frames[texture_name].frame; const texture = new PIXI.Texture( baseTexture, new PIXI.Rectangle(frame.x, frame.y, frame.w, frame.h) ); textures[texture_name.replace('.png','')] = texture; } this.createSprites(); viewBuffer.setDrawList(this.props.data); viewBuffer.drawObjects(container); }) pixiApp.loader.load(); Then we create all of our sprites and load them into one particle container. createSprites(){ if(this.props.unique_IDS == null) { throw new Error("Error - props.unique_IDS is null"); } const tempSpriteList={}; for(const entity in this.props.unique_IDS) { const flower = new Flower(textures[this.props.unique_IDS[entity].category]); flower.x = this.props.unique_IDS[entity].position.x; flower.y = this.props.unique_IDS[entity].position.y; //flower.alpha = 0.0; flower.scale.x = 1/7; flower.scale.y = 1/7; tempSpriteList[entity] = flower; container.addChild(flower); } viewBuffer = new ViewBuffer(tempSpriteList); } Flower is a class that extends sprite. We create our particle container like so: container = new PIXI.ParticleContainer(Object.keys(this.props.unique_IDS).length, { scale: false, position: true, rotation: false, uvs: false, alpha: false, tint: false, }); And here are the profiles. If we use a PIXI.Container we get 30fps while a PIXI.ParticleContainer gets 3 fps. I am honestly at a loss. The only thing that changes in the code is the container creation. I would love some insight, thank you in advance.
  2. 1 point
    ivan.popelyshev

    How to execute every second?

    > but...pixi-timer I don’t understand how to use? Simple. Look in the code , if you like something - take it for your app. Its just someone's two-files plugin.
  3. 1 point
    ivan.popelyshev

    How to execute every second?

    Welcome to the forums! "1 / 60 * delta" or "ticker.deltaMs" https://github.com/pixijs/pixi.js/blob/3ffe52d29aedd79a5a281b4a6032e7c95f5ea98c/packages/ticker/src/Ticker.ts#L493 PixiJs does not have a scheduler, only a basic ticker for RAF. Here's scheduler in a plugin https://github.com/Nazariglez/pixi-timer/ As far as I remember, its detached from PixiJS enough to work with anything >3.0.8 , even with v5. In case you use modern es6 modules, you PIXI in global scope for it to work (like for other pixi vanilla modules, https://github.com/pixijs/pixi-layers#webpack-browserify-angular ) As usual, explanation why dont we have those functions in main package: we really care about size of our packages and dont want to force users on using our API's for trivial things. We provide renderer expertise.