Page 1 of 1
creating animations using transformations
Posted: Mon Feb 06, 2012 4:07 am
by Ryne
Soo. Let's see if I can make you guys understand what I want to do.
Basically, for my characters and enemies, I want:
- to have single images for 8 directions. Down, Up, Left-Down, Right-Down, etc. These images wouldn't be animated ahead of time.
- to create animations using transformations in LOVE.
I want to create an effect kind of like this:
http://dl.dropbox.com/u/60256761/anims/likethis.gif
except smoother, less ugly, for all 8 directions, and using LOVE transformations like scale and rotate.
Ideas? Thank's guys.
Re: creating animations using transformations
Posted: Mon Feb 06, 2012 5:01 am
by verilog
I think that kind of "dynamic" transformations (cropping, translation, skewing) would require pixel-level manipulations, something achievable maybe using ImageData. For a certain, fixed area in your image you would require to copy/get certain pixels, add an x/y offset, for example (a linear transformation, in the simplest case), and them paste them back in a new image. You would need to do this for every frame that composes the entire animation. This is my initial guess, maybe someone more experienced in the area can expand upon this
Re: creating animations using transformations
Posted: Mon Feb 06, 2012 5:37 am
by slime
0.8.0 has shear parameters to love.graphics.draw, however I'm not sure if that's enough for what you want.
Re: creating animations using transformations
Posted: Mon Feb 06, 2012 5:43 am
by Ryne
Hmm. I was just wondering if it were possible, and hopefully easy. I suppose not :p
thanks anyway!
Re: creating animations using transformations
Posted: Mon Feb 06, 2012 6:20 am
by Taehl
verilog wrote:cropping, translation, skewing
You mean
Quad,
love.graphics.translate, and
Shear? Though I think you can translate with the right shear matrix (I admit that the math is over my head).
Re: creating animations using transformations
Posted: Mon Feb 06, 2012 7:53 am
by verilog
Yes! That’s right, applying (convolute) a transformation matrix to a pixel’s position or set of positions. For the shear transformation something like
this would do. You can actually apply a set of transformations by combining (multiplying) each transformation matrix, so you can create your own "custom" transformation, for large images (and without hardware co-processing) it would be pretty computive-intensive, though. That shear code you got there uses some fancy math, a 2D transformation would be a little bit simpler. I'm honestly not sure if Ryne's problem would be solvable combing love.graphics.translate/scale/rotate as he would need to operate on each pixel position individually.