Simple Peanut Animator

Now with new GALLERY

Moderators: Hagus, SeanWolf

Post Reply
User avatar
Frooxius
Posts: 311
Joined: Tue Jul 28, 2009 6:00 pm
Contact:

Simple Peanut Animator

Post by Frooxius »

Hello,
I was just experimenting with skeleton keyframing animation system (well, trying to create a very simple one), for studying purposes (you may have a great idea about some algorithm, but usually only practical implementation would help you to find all the flaws), because I never programmed such system.

However, since I'm currently without a graphics designer, I used image of Peanut, since I like this character a lot (probably as many people here). I hope Rick wouldn't get angry because of that, I'm not publishing it anywhere (except for here) and it's just programming experiment of my own (type, that usually doesn't see light of the world in it's original form).

I thought that you might find it interesting and perhaps a little entertaining to create simple peanut animations. Animation system is very primitive, created in about three-four days, similar to Pivot Stickfigure Animator, but with support for keyframing (you set start and end position and application calculates all frames between).

Program is also more "programmer-friendly" than "user-friendly", so don't expect nice user interface or many "anti-stupid-user protections", so there's high probability that it starts behaving weirdly, for example when you select different keyframe/load different file while playing animation. Most of them can be repaired by a few lines of code, but I was just lazy doing that, focusing only on animation system itself :) But if you find it interesting, I may redesign it's interface and even add more functions.

As I already mentioned, application can load and save animations, in very simple binary format (2 bytes for each element, 14 bits are used in each 2 bytes, 2 bits are ignored, total 36 bytes are used for one keyframe), so you can even post your animations here, since files are very small. Simple format also means there's no protection against errors, no file format flag (thus you can load any file you have in computer, resulting in weird animation - but only small files (few dozen KB max) or it would take very, very much time to load), no easy future feature enhancement with backwards compatibility and so on.

Application is created in simple scripting language (it doesn't even have classes :? ), with existing engine for various tasks - file IO, sprite rendering... It's just small experiment, and if I used C++ for example (technically, that's an extreme example), it would take a lot more to create, than three days and that doesn't just make sense for this kind of application. However there is one drawback - that particular engine has trouble with combination of images with alpha channel and antialiasing, so I disabled the second one, resulting in not very much alias.

A little to "user interface": New frame is added by the green plus symbol (you can add only frames at the and) and the frame has initially same values as last frame created. Frames can be also removed, but only the last one. All keyframes are listed at the top, you can select one by clicking on it, so you can modify it's properties. To scroll the list, click at first/last frame listed. Pressing the yellow arrow starts animation from current keyframe, orange rectangle stops it. Remaining symbols are for opening/saving files (warning - it rewrites existing file if selected!). The rest are value controls, just press left mouse button and move the slider. Right click for animation algorithm (most valuable are linear and sine (sinus)). Don't forget to increase frame duration, to utilize keyframing.

I hope you would like it, even despite its simplicity and certain "user-hostility". You may consider it as a different form of fan art :D , my fan art stories would be a very... weird for Housepets, so be glad you don't have to read them :-)
Program has a quickly created built-in animation, that starts playing when you execute it. (just press stop and delete all frames to create your own). Funny thing is, that I spend a few days trying to make it work, but when it finally works, I don't have time to play with it and create some interesting animations, so maybe would have that time :)

EDIT: By the way, you can animate Peanut's head, arm, front/back hand (lower part of arm, not palm), tail, front/back thigh, leg (lower part) and foot. You can change is position and angle, but you can't change angle of his body (to bend him forwards). The reason is, that all named parts consist of single joints, body contains a spine which is practically several dozens joints. I would need to cut image of his body to many parts, edit them, write proper algorithm for displaying for every single joint. That would take a lot of time, but wouldn't bring much benefits. Also I cannot create only one or two joints for body, because that would look too unnatural.

EDIT2: If anyone is interested where I took a Peanut image for this animator, here a little info: Various parts of his body are cut from several strips (I used Paint.Net editor) - not all of them are from same strip (and many strips were used just for observation, how are parts connected under varying angles). It's harder to find suitable parts, because in needed them to be from profile (just like in a classic platform games). I mainly used "There Went Nothing" for head and body and part of the arm. For hand, image from "No Excuses" was used (well it's rather a fist, I couldn't find suitable free palm). I had a little trouble finding suitable legs, which I can extract from a strip, since in most of them , but at the end, I used just horizontally mirrored and slightly changed arm image. But the biggest problem was the foot. I didn't found any suitable in correct angle, belonging to Peanut. However, Grape at the Cast page has foot displayed in the exact angle I needed, so I just recolored it, so technically, you have Peanut with Grape's foot :)

Here is small screenshot:
Image

Simple Peanut Animator can be downloaded here (ZIP, 1.2 MB).

Also: Sorry if my English is not correct, I'm not native speaker and still high school student. But if you tell what mistakes I made, I would appreciate it. (yay, this year we've got a native American speaker from Kansas as a English teacher in the school :D )
Last edited by Frooxius on Thu Sep 03, 2009 3:31 pm, edited 1 time in total.
Image
hug_overflow.asm wrote: LOOP: HUG #Peanut, #Grape
PUSH ACC
JMP LOOP
User avatar
Dylan
Box Fox
Posts: 2275
Joined: Fri Jul 10, 2009 12:31 am
Location: Austin, Texas

Re: Simple Peanut Animator

Post by Dylan »

Looks great I'm going to try it out right now.

By the way your English is better then most people I know. :)


EDIT: Whoa! its great!!!
The only problem I had was the when I was scrolling with the bars.
(I tend to accidentally click other bars.) :?

EDIT EDIT: downloaded newest one. :D
Last edited by Dylan on Mon Aug 31, 2009 5:49 pm, edited 5 times in total.
Image
Make Pasta not war.
User avatar
Frooxius
Posts: 311
Joined: Tue Jul 28, 2009 6:00 pm
Contact:

Re: Simple Peanut Animator

Post by Frooxius »

Thank you. When you are not a native speaker and still a student of particular language, without a feedback from native speakers (or just more fluent speakers), you don't know whether your posts are full of errors (grammatical or just weird and unusual phrases) or not. Unlike many programming languages, English has no syntax checker :)

By the way, I've just discovered a small error while loading animation from file, which corrupts one frame (loads one twice actually, source file is left intact if you don't save it again). I uploaded fixed version. You can download it from original link.
Image
hug_overflow.asm wrote: LOOP: HUG #Peanut, #Grape
PUSH ACC
JMP LOOP
Ebly
Posts: 4246
Joined: Sun Oct 26, 2008 10:01 am
Location: Imagination!

Re: Simple Peanut Animator

Post by Ebly »

This looks very promising, and I'd love to check it out. I'm using an Apple computer, so I can't open it, but I will definitely look at it when I have access to a Windows computer.
I was going to make a joke but then I did.
User avatar
Frooxius
Posts: 311
Joined: Tue Jul 28, 2009 6:00 pm
Contact:

Re: Simple Peanut Animator

Post by Frooxius »

Dylan: Scollbars (they're more like sliders) - you need to move mouse more carefully. Maybe I'll fix it, but those sliders are implemented as a special function (only one for all slider), which I call with different parameters (min value, max value, value id it changes, displayed name), so I don't have to write code for each variable. Problem is, this function doesn't retain variable values between calls, so I would need to create several global variables outside function and that's just horrible, since it's against encapsulation principle and decreases easy code portability. That language unfortunately lacks several beneficial OOP principles (on the other side it's very easy and has large built-in function library, which makes developing really fast). Maybe if I use outer checking box, to detect if mouse is already pressed? Hmm I'll go rather sleep now, it's too late.

Ebly: Sorry, I don't develop for Mac OS X. I hope you find a suitable Windows computer soon :)
Image
hug_overflow.asm wrote: LOOP: HUG #Peanut, #Grape
PUSH ACC
JMP LOOP
User avatar
Anonymous_Pyro
Posts: 240
Joined: Thu Jan 15, 2009 3:49 pm
Location: Internet

Re: Simple Peanut Animator

Post by Anonymous_Pyro »

Woah, I didn't saw this thread.

downloading...

Ok, i tried it but i was like "ok, what is this?"

At first Peanut was walking reeeeaaallyyy slooowww, I said "mmhh it looks ok", then i pressed a button and he dissapeared, i said "wtf", press another button and he was flying (lolwat), i closed the program and i said "this guy just started doing this thing, he needs more time".
Gentlemen.
User avatar
Dylan
Box Fox
Posts: 2275
Joined: Fri Jul 10, 2009 12:31 am
Location: Austin, Texas

Re: Simple Peanut Animator

Post by Dylan »

Anonymous_Pyro wrote:Woah, I didn't saw this thread.

downloading...

Ok, i tried it but i was like "ok, what is this?"

At first Peanut was walking reeeeaaallyyy slooowww, I said "mmhh it looks ok", then i pressed a button and he dissapeared, i said "wtf", press another button and he was flying (lolwat), i closed the program and i said "this guy just started doing this thing, he needs more time".
Are we both using the same program?

Well anyway you must of "pressed" the left end of the Duration bar. This tends to make peanut "fly"(and lose a few limbs) but its fixed once you hit pause and play again. or you just "pressed" the X and Y bars...
Image
Make Pasta not war.
User avatar
Frooxius
Posts: 311
Joined: Tue Jul 28, 2009 6:00 pm
Contact:

Re: Simple Peanut Animator

Post by Frooxius »

Oh, I noticed, that when I was in hurry fixing that frame corrupt problem yesterday, I didn't fix it completely. I uploaded third version, where it should be OK now in all situations. When I was at it, I also improved these sliders, as Dylan asked, using combination of built-in function that remotely resembles static local variables from C++ :? Updated version is again in the original link.

Anonymous_Pyro: I mentioned it in first post - I really didn't focus on user friendliness, as it was mere experiment that I created for myself, to gain basic experience with programming simple skeleton animation system. I also said, that when you press something while animation is playing, it could start behaving weirdly. However, I made a simple adjustment, so instead of "totally weirdly" is just "not as weirdly". By the way, that built in animation is more test of that utility (slow walking is because I can watch if everything behaves correctly), than trying to achieve as much as real natural movement as possible (but that don't means it's not possible, it's just more time consuming).

It also serves as simple example for everybody, so they can see how keyframes can be created. If you don't like slow walking, you can adjust it yourself :-) Just select walking keyframes and set duration to lower value (you must change them one by one), to make it look how do you like it :)
Image
hug_overflow.asm wrote: LOOP: HUG #Peanut, #Grape
PUSH ACC
JMP LOOP
User avatar
Dylan
Box Fox
Posts: 2275
Joined: Fri Jul 10, 2009 12:31 am
Location: Austin, Texas

Re: Simple Peanut Animator

Post by Dylan »

Tails++ wrote:I also improved these sliders, as Dylan asked, using combination of built-in function that remotely resembles static local variables from C++ :? Updated version is again in the original link.
Thanks, it just got a lot easier to use. Also I don't see anything acting strange.
Image
Make Pasta not war.
Post Reply