Flash animation in LÖVE

Showcase your libraries, tools and other projects that help your fellow love users.
intAligned
Prole
Posts: 11
Joined: Thu Jun 30, 2016 12:07 pm

Flash animation in LÖVE

Post by intAligned »

Hi! Today i'm publishing my Flump runtime for LÖVE2D.
For those who don't know it, Flump allows to export animations made in Flash into a texture + json format.
This allows for smooth animation, low memory footprint, and generally makes it possible to follow a Flash-based workflow when working with LÖVE.

You can find the library here: https://github.com/sixFingers/lump
You find Flump tools here: https://github.com/tconkling/flump

I'm available for support and suggestions, just open an issue / PR on Github.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Flash animation in LÖVE

Post by bobbyjones »

Your lib is dependent on globals. I did not try it out yet but looking at the code you use globals and the lib depends on globals. Both of which is generally not good design for a library. The library will not work as is in a new project.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Flash animation in LÖVE

Post by zorg »

Also, not really familiar with what kind of transforms are in flash, but löve does support shearing, and i believe you can "combine" transforms to get what you want, within one lg.push level; granted it needs a bit more math than just manually giving all values of a 4x4 matrix, but should still be possible.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
intAligned
Prole
Posts: 11
Joined: Thu Jun 30, 2016 12:07 pm

Re: Flash animation in LÖVE

Post by intAligned »

bobbyjones wrote:Your lib is dependent on globals. I did not try it out yet but looking at the code you use globals and the lib depends on globals. Both of which is generally not good design for a library. The library will not work as is in a new project.
Hi bobbyjones, thanks for your comments. The library has been extracted from a game of mine, and still needs some work. Take it as a first, very rough iteration. Some things i'm already fixing are:

- collapse the library in a single file
- try to fix that "globals" problem. As it is now, the two globals being utilized are JSON and Class. I'm still not sure if it's worth it to incorporate both; i may let the developer take care of decoding JSON, so he/she can choose which JSON library to use; while i don't really know how to remove the dependency on Class. Any suggestion is really welcomed.
intAligned
Prole
Posts: 11
Joined: Thu Jun 30, 2016 12:07 pm

Re: Flash animation in LÖVE

Post by intAligned »

zorg wrote:Also, not really familiar with what kind of transforms are in flash, but löve does support shearing, and i believe you can "combine" transforms to get what you want, within one lg.push level; granted it needs a bit more math than just manually giving all values of a 4x4 matrix, but should still be possible.
Yep, i know, but after a long while, i couldn't find a way to calculate it. The strangeness begins with Flash, which exports rotation _and_ skew in just two values (instead of three). I really think it's possible, but was unable to come up with a solution. Again, any hints are really appreciated :)
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Flash animation in LÖVE

Post by Nixola »

intAligned wrote:while i don't really know how to remove the dependency on Class. Any suggestion is really welcomed.
You could just use Class Commons; it's a set of common features/API supported by a variety of libraries, so the user can just use any one of those and your lib should just work.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: Flash animation in LÖVE

Post by pgimeno »

intAligned wrote:Yep, i know, but after a long while, i couldn't find a way to calculate it. The strangeness begins with Flash, which exports rotation _and_ skew in just two values (instead of three). I really think it's possible, but was unable to come up with a solution. Again, any hints are really appreciated :)
Do you have any pointer to the file format where these values are specified?
intAligned
Prole
Posts: 11
Joined: Thu Jun 30, 2016 12:07 pm

Re: Flash animation in LÖVE

Post by intAligned »

pgimeno wrote:
intAligned wrote:Yep, i know, but after a long while, i couldn't find a way to calculate it. The strangeness begins with Flash, which exports rotation _and_ skew in just two values (instead of three). I really think it's possible, but was unable to come up with a solution. Again, any hints are really appreciated :)
Do you have any pointer to the file format where these values are specified?
pgimeno, Flump exports a plain JSON. You can find a non-modified, standard Flump json in the demo directory at the link I provided. That's the very same file read by all other runtimes available for other languages. What Flump does is reading transforms from the SWF you publish from Flash. So the problem is inherent to Flash itself. More info on the issue can be deduced from https://github.com/tconkling/flump/issues/6. If you want to play and see if you get it working, again the demo is enough, as it has some skews, which my runtime can't handle. As an hint, you can detect which frames are skewing by looking at the values for the "rotation" field. When they're different, one of them (always the same, still can't figure it out) is the rotation, the other the skew. If they're equal, there's no skew but just rotation.
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: Flash animation in LÖVE

Post by pgimeno »

I don't have any Flash testcases to experiment with, sorry. I'd like to know what the two values are for:
  • a figure without any rotation
  • a figure with a 30° rotation
  • a figure where the vertical axis remains vertical, but the horizontal axis is rotated by 30°
My current hypothesis is that the two values may be the angles of the axes of the transformation basis, with respect to the original axes. If that's the case, then my prediction is that the values will be, respectively:
  • 0 and 0 for a figure with a 0° rotation
  • 0.523 and 0.523 for a figure with a 30° rotation
  • 0.523 and 0 for the rhomboidal figure described above
It will be interesting to figure out the skew transform if that's the case.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest