iTween…. simple, but useful
Posted by Patrick Corkum on April 8, 2010
![]()
Okay, I won’t go into too much detail, but time for me to tech out a little here. If you know what tweening is, skip to the next paragraph, otherwise, keep reading this one. Okay… so either you don’t know what tweening is or you don’t know how to follow instructions. Regardless, let me tell you a little about tweening. Animation is done by quickly swapping out still images. Remember flip-books? Well, it still is the same thing today, even with computers, it’s just all high-tech and accurate and stuff. Anyway, let’s say that I want to move a person across the screen and have it take five seconds. Well, at 60 frames per second (which is about what the human eye can perceive at max) that would be 300 frames that I would have to draw. Well, that’s just annoying and not efficient. So what do we do? We create a tween that uses math to figure out what all the points are and make the computer do our work for us! Now that’s a programmer for you…. figure out how to pass off the work. <to a computer that is>.
Now, Mr. Robert Berkebile…. aka Bob (www.pixelplacement.com)…. created a library… aka API to handle that kinda stuff easily in Unity (www.unity3d.com), which totally rocks, btw. Anyway, what do I care about that? I am a business application using Microsoft guy… right? Well, kinda. I enjoy and can do lots of different things, it is just that most of my professional experience is in the business/Microsoft side of things. So, anyway, back to that Microsoft thing, I took his JavaScript and converted it to C# so that those using C# (you know… the righteous ones
) can have a C# friendly interface and can use intellisense and all that fun jazz. Now, the two, JavaScript and C#, do not take the same parameters for the API calls… (oh yeah… non-tech audience)… umm… you have to do it differently. Anyway, I’ve put a bit of time in refining the C# and updating it and documenting it and putting it on my web site, so if you are a Unity developer or want to check out nice looking code, feel free to check it out at www.insquare.com/iTween. If anyone who is a developer thinks that the code could be better, I’d love to hear their opinion. I personally think everything in there is quite defensible and am always up for a good discussion.