Does anyone know how to maintain an image height (of say 50%) at every possible angle? Because the way the engine works is that the height is only really "the height" when the angle is 0 degrees, as the height is spun with the angle (making it more like the "width" when rotated).
<img src="http://i.imgur.com/DnsC4Ee.png" border="0">
What construct does:
<img src="http://i.imgur.com/lrslBPB.png" border="0">
What I want it to do:
<img src="http://i.imgur.com/AbcPS5d.png" border="0">
I've tried several ways to do this (using sin/cos on height and width) but I don't think its possible, but just incase someone knows how that would be cool!
What you're trying to do I don't believe will work. It will always pivot around your origin and that's why you get the result you do, you'd need some sort of 3D plugin to do something like this. Maybe it's worth just making a sprite with an animation of it spinning and then start the animation when you need it?
I was trying to do this for a while too for an objective indicator. What I wound up doing is I broke it into two parts, the oval and the line. Then I just set the angle of the line towards my objective and masked where it crossed out of the oval with a third sprite.
Develop games in your browser. Powerful, performant & highly capable.
Doesnt it help if you rotate it firts, then change the height?
I'm pretty sure there must be a mathematical way to do this with a super advanced calculation. In the meantime; just use an animation. Specially since the calculation would only work on flat images, and anything representing volume would look super weird.
here's how you'd do it EXAMPLE
There's no way to do it by just changing the width and height of the object. I saw your other post and agree it would be useful to be able to scale layers axis separately.
Currently the only ways I can think of is using a pre-rendered animation, by a shader effect, or pasting the sprite to a canvas and resizing it:
Resize Example 01
Thanks guys, yeah I'll just have to settle for "prerendered".
Soooo, did anyone find a solution to this issue?
I almost got it working using abs(cos(object.Angle))*height however cosine only works for half of the quadrant, I guess?
Any math genius out there willing to take a stab at this?
purplemonkey I'm not sure what you're trying to do, as Animmaniac pointed out you can't actually do what I was going for without using something like the Canvas plugin.
no math genius here but ellipse equation worked pretty well
https://dl.dropboxusercontent.com/u/231 ... index.html
Capx: https://dl.dropboxusercontent.com/u/231 ... lipse.capx
There is no magic formula to this. The scaling must be done on the layer axis and not the sprite's. Only way to achieve this right now is to use an intermediate object (paster/canvas) that will contain the rotated sprite.
See this thread for an example :