Sprite Keyframe Animation

Monkey Archive Forums/Monkey Projects/Sprite Keyframe Animation

NoOdle(Posted 2012) [#1]
I recently started this project, its something I've been meaning to get around to for a while.

I hate drawing sprites and I hate trying to draw animations even more! I decided it would be much easier to draw separate sprites for the different body parts and then link them. This would allow me to rotate parts of the body to create animations.

At the moment you can create a hierarchy of sprites and then assign keyframes to the bones that make up the skeleton. These keyframes are then interpolated to create a smooth animation.

All sprites can be scaled, positioned and rotated locally and globally. Sprites are also depth sorted and bound culled.

Still to add is position and scale keyframe interpolation. I also intend to add animation blending to blend between two animations smoothly and split animation which will allow, for example, playing one animation on half of the skeleton and a different animation for the other.

This example has a simple hierarchy and 2 keyframes for the bones which I created by hand in code; surprisingly the result is pretty impressive. I do intend to write an editor to make creating skeletons and animations as simple as possible.

Below is a demo and a screenshot:


UPDATE: Demo has been updated, it now includes animation blending and support for split animation altho this is not shown in the demo. The controls for this are Left / Right keys to move the Skelly.


http://www.monkeycoder.co.nz/Apps/app.php?id=132



Skeleton Sprite by hxx2010
Background by flashpotatoes - http://flashpotatoes.deviantart.com/art/Game-Background-114268893


therevills(Posted 2012) [#2]
Cool, sounds like something I did awhile ago on BlitzMax:

http://blitzbasic.com/Community/posts.php?topic=93328




NoOdle(Posted 2012) [#3]
Ah cool, I like the video! Yea it looks pretty similar! Did you attempt animation blending? I'm trying to figure out a user friendly way to implement it!


therevills(Posted 2012) [#4]
Nope, I didnt get to different animations - another project which I got bored with ;)

Hope you keep working on this :)


John McCubbin(Posted 2012) [#5]
That is sweet, it really does create a pleasing style of animation.


Paul - Taiphoz(Posted 2012) [#6]
yeah therevels I recall that post, you got any plans to build that into didy ?


skape(Posted 2012) [#7]
That's awesome. Keep it up. :)


matt(Posted 2012) [#8]
@NoOdle your code causes Safari 5.2 (beta 7535.18.5) Mac to crash


NoOdle(Posted 2012) [#9]
hmm I'm using Safari 5.12 (6534.52.7) and it doesn't crash. I can't see what could cause it to crash, Im not doing anything out of the ordinary.


hardcoal(Posted 2012) [#10]
hi you mean to create an editor like joints for animation?
is that what u intend?

if so its a good idea that i was intending also to do..

great work


NoOdle(Posted 2012) [#11]
hi you mean to create an editor like joints for animation?


Yea thats what I intend to create. I am implementing split animation and hopefully blending later tonight, just hope I have figured out the correct way to do it. Finding articles on it has been hard, I even bought Game Programming Gems 2 after seeing it contained an animation section... only to find out that it doesn't... Google told me otherwise!


hardcoal(Posted 2012) [#12]
will you include the option to turn the result to png animation strip
or user will have to run special module to use your animation strip?


therevills(Posted 2012) [#13]
will you include the option to turn the result to png animation strip


That sounds like a great idea!


NoOdle(Posted 2012) [#14]
will you include the option to turn the result to png animation strip


I like that idea a lot, I was going to only supply a module but I like the idea of exporting an animation strip. You could then touch up the images in photoshop as well if needed.


therevills(Posted 2012) [#15]
How are you coding the editor? Is it in BlitzMax, if so it should be pretty easy to draw the sprite then grab the image to a piximap and save it to a png :)


hardcoal(Posted 2012) [#16]
thankx noodle keep up the good work always glad to help


slenkar(Posted 2012) [#17]
here is an example of how to do keyframe animation in case anyone wants to do their own,

http://monkeycoder.co.nz/Community/posts.php?topic=501

you just have to keep track of rotation,x and y positions of each joint and insert some tweening code to make the animation smooth


NoOdle(Posted 2012) [#18]
you can also track scaling as well to make funkier things happen :)


NoOdle(Posted 2012) [#19]
Just uploaded a newer version of the app, it should be available soon.

I've finally found a few hours tonight to implement split animation and animation blending. It all works rather nicely. I also finished position and scale interpolation.

The next thing to do is the editor...


hardcoal(Posted 2012) [#20]
I will make animation strip software as well one of this days...
for sure but now im too busy with my engine.


NoOdle(Posted 2012) [#21]
Sweet, the app has now been approved. Check the top of this post for a link or check the apps tab.

I will make animation strip software as well one of this days...
for sure but now im too busy with my engine.


Yea it has taken quite a while to get it all working, took a fair amount of planning as well - especially the upcoming editor.

I have the basics of the editor done, move, rotate, scale. You can also set the handle location. This is all done with a nice little axis marker like used in 3d studio max. Heres a screeny of a portion of the editor screen to show what I mean:



Green moves on the x, red on the y, yellow is both x and y movement and the blue is for rotation. Scale is handled by holding shift and using the same axis. Will possibly add in gui buttons to change between these... will have to see what feels more natural.


Jesse(Posted 2012) [#22]
Nice noodle, I haven't worked on the one I was working on Bmax a while ago. I was going to convert it to use the Bmax GUI. but I had a hard time learning how to use it so I left it alone for the time being.
this is what I had with out with my own GUI:

http://www.mediafire.com/?hnxnar7cujrc6jr


its' BlitzMax source. if any body want to compile it and provide the executable for others to try please do. I am on a mac so only if anybody shows some interest I will post the executable.


NoOdle(Posted 2012) [#23]
Wow nice Jesse thats really good! It was also really useful to see what you had done for yours.


misterSquare(Posted 2012) [#24]
Hey NoOdle - this is awesome, any plans to release either the runtime code or the tool publically at any point?