schemagroup Posted May 7, 2018 Share Posted May 7, 2018 Hi All, I'm having this weird issue with the PixiJS ParticleContainer for some reason when I apply a color tint to it using TweenMax it glitches. I've pasted my code for reference if you see any issue in my code. // HERE IS WHERE I CREATE MY PARTICLES USING THE PARTICLE CONTAINER function createParticles() { console.log("createParticles()"); particleContainer = new PIXI.particles.ParticleContainer(particleData.length, {scale: true, position: true, tint:true, rotation: true, alpha: true }); particleContainer.x = app.renderer.width / 2; particleContainer.y = app.renderer.height / 2; bkg = new PIXI.Graphics().beginFill(0x000000).drawCircle(0, 0, 300); bkg.x = app.renderer.width / 2 +10; bkg.y = app.renderer.height / 2 +10; var graphics = new PIXI.Graphics().beginFill(0x4c9f91).drawCircle(0, 0, 10); var texture = graphics.generateCanvasTexture(); for (var i = 0; i < particleData.length; i++) { var particle = new PIXI.Sprite(texture); particle.pivot.set(5, 5); particleArray.push({particle: particle, xpos: particleData[i].xpos, ypos: particleData[i].ypos}); particle.alpha = 0; particle.x = 0; particle.y = 0; particle.scale.set(Math.random() * 1 - 0.25); particleContainer.addChild(particle); } contentContainer.addChildAt(bkg, 0); contentContainer.addChild(particleContainer); } // CHANGES COLOR OF THE PARTICLE CONTAINER, ONCE THIS GETS FIRED IT TURNS BLACK AND THEN CHANGES BACK TO THE COLOR ON WHICH IT APPLIES, LOOKS LIKE A GLITCH. function cyleColors() { tlColor.to(particleContainer, 3, {pixi:{tint:0x4ec7f2}}) .to(particleContainer, 3, {pixi:{tint:0xe6df36}}) .to(particleContainer, 3, {pixi:{tint:0x4c9f91}}) .to(particleContainer, 3, {pixi:{tint:0xf98331}}) .to(particleContainer, 3, {pixi:{tint:0xde1272}}); } Thanks, Quote Link to comment Share on other sites More sharing options...
botmaster Posted May 7, 2018 Share Posted May 7, 2018 For TweenMax this is just a number that you are tweening, it can't know if this is a hex color that you are tweening to and from. The common way of tweening hex color in tween engines that support it is by passing a string instead or by the use of specific plugins. If tweenmax supports it try to pass your color as a string, if it doesn't I'm sure there's a plugin that you can activate in there that is meant to do just that. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 7, 2018 Share Posted May 7, 2018 Which version of pixi do you use? Quote Link to comment Share on other sites More sharing options...
schemagroup Posted May 16, 2018 Author Share Posted May 16, 2018 No worries figured it out, it was the background, that was causing the issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.