Pixi.js: Tinting an AnimatedSprite displays errors on a canvas renderer

Created on 4 May 2017  路  12Comments  路  Source: pixijs/pixi.js

https://pixijs.github.io/examples/?v=dev#/basics/spritesheet.js
Change top line to

var app = new PIXI.Application({ forceCanvas: true } );

And add

anim.tint = 0xFF0000;

after the play call

I know there was a fix for static sprites https://github.com/pixijs/pixi.js/pull/3985 which doesn't fix this scenario I'm afraid

馃捑 v4.x (Legacy) 馃暦 Bug

Most helpful comment

Ok great, I checkout out that branch and linked it to my game and things seem to work as expected. Cheers!!

All 12 comments

this issue occurred with 4.5.0. Version 4.4.4 was working.

I managed to fix the issue for myself by modifying line 129 of https://github.com/pixijs/pixi.js/blob/dev/src/core/sprites/canvas/CanvasSpriteRenderer.js
with the following

if (sprite.cachedTint !== sprite.tint || sprite.tintedTexture.tintId !== sprite._texture._updateID || sprite.constructor.name !== 'AnimatedSprite')

I doubt this is ideal, but it shows where the issue is with the Tint Caching.

Sidenote: While I was testing the consequences I noticed that the TilingSprite class will not tint at all on pointerover with Canvas

Lets test this thing: https://pixijs.download/dev-canvas-animated-tint/pixi.js , please test both cases.

Ok one of the conclusions I have made is false. 4.4.4 doesn't nessecarily work because forceCanvas: true is ignored and WebGL prevails.

Will check what you sent

AnimatedSprite caching tint - https://jsfiddle.net/brenwell/62qub9vn/4/
TilingSprite not tinting - https://jsfiddle.net/brenwell/yo2Lz9dc/1/

Both appear to be working now, did you update the build files??

Fixed both. Look at them again ;)

Yeah, files are updated automatically as I push commits to the PR.

Ok great, I checkout out that branch and linked it to my game and things seem to work as expected. Cheers!!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings