Closed kirillbunin closed 6 years ago
I played with it some more, and found out that ball.setScale(0.5)
will be always relative to the current size of the ball
. Therefore, reapplying it, will always cut the size to the half of the current size. ball.setScale(1)
does nothing.
Is this on purpouse? I would think, it would be more intuitive if ball.setScale(1)
return the size of the object to it's original size, and ball.setScale(0.5)
would be always half of the original size.
I noticed there is ScaleMode
but I'm yet to find out how it works.
I'm afraid this is how Matter itself scales bodies. When you scale via setScale
it simply passes those values onto Matter to use. I'm not sure there's an easy way to change this behavior, as looking at the Matter code the scale is applied across the board to all vertices with no previous sizes retained in order to have a 'base' scale. Open to suggestions for this one, but might just have to be a case of "that's how it works".
Just to say that we finally addressed this and you can find the fix in the master branch, it will be part of the 3.12 release.
I'm trying to tween scale of an matter.js image object, code goes like this:
From working with Matter.js, I was used to tween props of an object (using TweenLite) like this:
Using plain object as a middle man, because
setScale
preforms more than just replacesscaleX
andscaleY
props of an object. With Phaser 3.1.0, it resolves in memory leak.If I try to tween just the props:
Object disappears and game crashes.