grapefrukt / grapefrukt-export

a set of actionscript tools to export animations and graphic assets made in flash authoring to other formats.
197 stars 29 forks source link

How do you handle skews? #5

Closed tsaizhenling closed 12 years ago

tsaizhenling commented 12 years ago

cool exporter you've got here :) I'm using the animation extractor

I'm wondering how you handle skews. Because in DancingDarwin, there a symbol that is indicated as skewed(specifically rarm)

https://github.com/tsaizhenling/stuff/blob/master/Screen%20Shot%202012-09-07%20at%203.30.30%20PM.png

but in animations.xml, single rotation values are generated, just like all other components. I have parsed the data into an iOS project, everything looks right except that component. I'm guessing that I should not be skewing the movie clips at all.

grapefrukt commented 12 years ago

You are correct that skews are simply ignored by the exporter, partly because I don't use them very much, but mostly to keep the data complexity down.

The truth of the matter is that skewing and rotation are very much related. So much that certain transformations will make objects appear as if they were skewed even though they weren't really.

There has been multiple requests for skew support, so I did actually add it a while ago. It requires exporting the entire transform matrix (thus loosing a discrete rotation-value). But, depending on your engine it might even be easier to apply transforms like that.

Code is here: https://github.com/grapefrukt/grapefrukt-export/tree/matrix-export

tsaizhenling commented 12 years ago

cool! that worked out great for me! thanks! and if anyone is wondering, it's fewer lines of code to apply the transform like that :)