Len Posted July 10, 2017 Share Posted July 10, 2017 Hey, I've been looking for a solution for transforming a sprite using a matrix instead of individual properties like scale, skew and rotation. I have a matrix like [0.9120710740479713, 0.05900771211381309, -0.05900771211381309, 0.9120710740479713, 651.3628605915601, 93.3129853864424]. I know that is is possible to calculate from a matrix but doing doesn't always result in the exact scale, skew, rotation that I'm looking for. I want to be able to add this transform directly to the sprite like how it is done normally in canvas. Does Phaser support anything like this or does anyone have a solution to this? I've tried my best to google a solution but I haven't had any luck. Link to comment Share on other sites More sharing options...
samme Posted July 14, 2017 Share Posted July 14, 2017 You can set a transformCallback property on the sprite. Link to comment Share on other sites More sharing options...
Len Posted July 14, 2017 Author Share Posted July 14, 2017 This works perfectly, thank you. I figured the transformCallback just returned a read-only matrix, not one that you can update. Link to comment Share on other sites More sharing options...
mcolman Posted October 6, 2017 Share Posted October 6, 2017 @Len you say it works perfectly but I assume it doesn't support skew right? Link to comment Share on other sites More sharing options...
samid737 Posted October 6, 2017 Share Posted October 6, 2017 @mcolman Skewing by shearing in x or/and y is possible. You have to modify either wt.b or/and wt.c, which are the k's (see shearing part): mcolman 1 Link to comment Share on other sites More sharing options...
mcolman Posted October 8, 2017 Share Posted October 8, 2017 oh cool! Thanks! samid737 1 Link to comment Share on other sites More sharing options...
Recommended Posts