• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by ivan.popelyshev

  1. @KanikaMehra That's thread of 2013 year and very old pixiJS version. If you searched some more time you could stumble across modern PixiJS docs: http://pixijs.download/dev/docs/PIXI.Renderer.html and "view" parameter. Please, before you do that again, read the docs and wiki: https://github.com/pixijs/pixi.js/wiki, and next time specify PixiJS version that you are using, and don't bump 5 year old threads.
  2. In general: handle animations, events and cleanups separately. app.ticker.add(() => { //code that updates ALL MY ANIMATIONS MANUALLY }); app.ticker.add(() => { // suppose we want to clear someContainer let children = someContainer.children; let j = 0; for (let i=0;i<children.length;i++) { var child = children[i]; if (child.dead) { //delete it somehow, remove from list of animations and so on } else { children[j++] = i; } } children.length = j; }); Of course it has to be adapted to your style of coding and your case. I know that most people when they start something more than stupid demo stumble across the problem, and I provided PR in PixiJS that adds API but it was too experimental for our team, it was rejected. I'll try to make it again this summer. It was about `detachChild` thing that handles actual removal later, after all events.
  3. I have solution for that thing - custom GlowFilter, but i dont want to publish it without extra preparations, because there are several filters i want to move to special plugin, filters that emulate Flash. I'm afraid that my queue of "who to help and make simple hack in 15 minutes" is too big right now Until then, I suggest to use make progress-bar sprite-basd and prerender everything you can in several frames in photoshop.
  4. i have a complex thing that cuts sprites to solve that, but I didnt upload it because im lazy. Need to dig it out and port to v4-v5.. huh.. so many things to do.
  5. PixiJS philosophy allows to use webgl hacks when you really know what are you doing and how it affects PixiJS state. You can hack "apply" function of the filter or "applyFilter" function of FilterManager: bind the shader there and assign your uniforms How filterManager handles it : https://github.com/pixijs/pixi.js/blob/v4.x/src/core/renderers/webgl/managers/FilterManager.js#L242 How filter calls filterManager: https://github.com/pixijs/pixi.js/blob/v4.x/src/filters/displacement/DisplacementFilter.js#L64 It looks like "syncUniforms" is the best place to apply the hack: shader is already bound. Just in case if you need whats inside GLShader: https://github.com/pixijs/pixi-gl-core/blob/master/src/GLShader.js#L40 var oldSyncUniforms = renderer.filterManager.syncUniforms; renderer.filterManager.syncUniforms = function(shader, filter) { oldSyncUniforms.call(this, shader, filter); if (filter.syncUniforms) { filter.syncUniforms(shader); } } myFilter.syncUniforms = function(shader) { var gl = shader.gl; gl.uniform1f(...); }
  6. OK, I made it to the dead end. Now I asked @Mat Groves if he can fix my demos. He owns most of code regarding uniforms. If we succeed, result will be here: <PLAYGROUND DOENST WORK > No guarantees about v4 though, I just dont remember if anyone discussed uniform struct in it.
  7. wait a moment, making a demo. I believe we have something like that in v5, i dont remember about v4.
  8. Look, I specified in https://github.com/pixijs/pixi.js/pull/5555 that we have 5 different spaces for coordinates. Its hell. There is u_resolution (sometimes called `dimensions`) that is needed for conversion between some of them, and it has special name in v5, but in v4 you have to add a hack to "Filter.apply" method to use it. The problem is discussed so many times that I really dont have time to discuss it right now unless you have a demo for me to fix. All that links I posted should help you to make your case, then I can help you to fix it "container.filterArea = renderer.screen" makes everything significantly easier, because all normalized coords are in screen, maybe that helps you.
  9. If it worked in pixi-v3 and doesnt work in v5, I have to ask - is this the same code? OR did he use "pixi-display" for v3 that doesnt exist for v5 yet? Its the first thread regarding new v5 zIndex feature so please provide more information, we have no examples about it, there's no collection of user cases that I can use my telepathy on.
  10. Its a very big problem, once I consulted @Velith several days on it. Basically, all your objects need anchor (0.5, 1.0) , and then.. magic. Huge amount of magic. I have special algo that i didnt publish yet that solves such cases but its not wrapped for newbies use, its only for people who already implemented something like it.
  11. heh, so its still a thing. bad As for spine, we have some problems with latest , please report your case if its wrong.
  12. > I know it's not directly linked by PIXI but still I need help. You're very humble, I pinged people who have experience with videos in pixijs to help you
  13. Two-part answer u_resolution u_resolution is actually part of filter uniforms that depend on temporary pow2-sized texture. In v5 its available under another name for all filters. https://github.com/pixijs/pixi.js/wiki/v4-Creating-Filters v5: http://pixijs.download/dev/docs/PIXI.Filter.html working on new docs: https://github.com/pixijs/pixi.js/pull/5555 one of latest filter-related threads : u_time In v5 its possible to add stuff to global uniforms. Related code: https://github.com/pixijs/pixi.js/search?q=globalUniforms&unscoped_q=globalUniforms Maybe you can put something in "renderer.globalUniforms" before you create the shader. I did not test this approach so I do not know additional actions are required for it. You have to guess and debug.
  14. What version of PixiJS do you use? I remember that I fixed serious precision problem somewhere in 4.8.3
  15. setting width is actually changing scale. Unlike Flash, PixiJS doesnt have auto-scaled lines, lineWidth works in local coordinates, so vertical lines become very thin if your scale is small. If you have only a few bars (20 or so) you can just clear() them and refill again with the other drawRect width param. Judging by your labels that's the case
  16. 5neia_opo2@google-mail.ooo has been sent to the library for a week. Try build pixi yourself: https://github.com/pixijs/pixi.js Read articles and look for other people projects: https://github.com/pixijs/pixi.js/wiki/v4-Gotchas https://github.com/pixijs/pixi.js/wiki/Boilerplate https://github.com/cursedcoder/awesome-pixijs here is JS guide in case you didnt have it, you can buy it or find somewhere: https://www.amazon.com/JavaScript-Definitive-Guide-Activate-Guides/dp/0596805527 Kormen, in case you need some basic algos: https://en.wikipedia.org/wiki/Introduction_to_Algorithms , same, look up the book in google. I hope when a week pass you'll be able to produce some quality content for the forum
  17. You also have perfect timing. I'm gonna add physics in the list of my specialisations in pixijs team, so I'm ready to help people more on this subject. ITs like "ok, I solved most of Filter-related problems that people have, whats next" If you do something and it doesnt (or does) work please share, I'll help to find bugs.
  18. Yep, you've got it right. I can also recommend to watch out for "width" in containers with children, its a tricky calculated value. "getBounds().width" is fine, "sprite.width" is fine when sprite has no children. And at some point if you have many objects you'll see major garbage collecting when you profile app, and you'll have to remove extra object creations. Also watch out that "getBounds()" and "containsPoint()" are the only things that returns global (screen) coords, everything else is local stuff, you have to be aware in which coord system they work.
  19. In general: Its not obvious , because you are basically making simple arcade phys engine, and PixiJS has only a few functions that you can rely on for it: "getBounds()", "containsPoint()", "contains()" (that one is about Point but for shapes), and when you look inside element you have to dig out its geometry, its difficult to produce readable code because of that. We are only a renderer lib - we dont know what people want from their physics. We dont have enough expertise to provide physics for newbies, we are all about graphics. Some people integrate existing libs like "p2.js" or "matter.js" with pixi and the result is awesome - when you do that means you know pixi on a good level. Sadly, we still dont have docs about it because people who did that before mostly kept it to themselves. I'm working on a article that explains that but i cant share it yet. All we have are threads in this subforum that are difficult to search but they contain simple physics, and I cant say that code is readable. I've spent many hours helping people to fix solutions that they wanted for their games. Your case: Lets see https://github.com/kittykatattack/bump/blob/master/src/bump.js#L1350 First that I see is it spawns many functions , and you call it several times in a frame - it can be a performance problem in case of 100 and more sprites. I suggest to copy that lib locally and change it the way you need.
  20. @5neia_opo2@google-mail.ooo You should be more careful with your words. Its not that we have special ideology, its that we all come from different tech backgrounds and ideologies: we put something in PixiJS only if many people agree that our apps benefit from it, not because it looks cool. Make a plugin that adds chaining and you'll satisfy all jquery-lovers, eh... if you find them here. Chaining is unnecessary but if we integrate it we will be very difficult to remove it from the project in favor of more advanced coding styles. Many API's walked into that trap.
  21. @botmaster PixiJS is a Library
  22. "renderer.plugins.interaction.mouse.global" or "app.interaction.mouse.global"
  23. i think that editor was for phaser2, and phaser2 was built on pixi so you can do something like that , even take some code. I can ask mightyfingers if they are ready to share their old work
  24. because pixi does redraw it every frame. Surprise! https://github.com/pixijs/pixi.js/wiki/v5-Custom-Application-GameLoop You can make your own Application class, or somehow override the original by adding extra flag inside"render()" method so it doesnt run every frame. I suggest to make your own. Application is mashup made for demos, to show people that pixi is easy. In reality, all projects need their own implementations of this class. Here it is for v4: https://github.com/pixijs/pixi.js/blob/v4.x/src/core/Application.js It can be made much easier if you remove all those options.