Tweener Class with Easing functions and more

Hello everyone, I’m not a programmer (plus I talk broken English) but I like to mess up with Codea. I built this Class to easily add some movements to my projects. I also added some Plugins and Easing functions, converting some ActionScript to Codea (I’m not able to make such calculations). If you like I’d be glad to receive suggestions on how to write better code :slight_smile:

With Tweener you can iterate any numerical property of your objects.

Running the Main file you can see Tweener in action through some examples.
You can change some parameters as well.

In this package you can find some more Classes I wrote:

SpriteObj and TextObj are basically classes to create Objects with usefull properties (x, y, width, height, etc) and methods (setSize, setPos, setColor, etc). They’re handy if used with the Tweener Class.

Drawer is a class to manage draw() and touched() methods of your objects (i.e. let you call the draw method just once for every objects stored in a Drawer instance). You can add, remove, substitute or change depth to any object stored in it.

I tried to write some instructions and comments into each class, but as I wrote, I talk broken English, plus I don’t know technical terminology, so please let me know what is correct and what is not.

I hope you’ll enjoy it :slight_smile:

https://dl.dropbox.com/u/81603445/tweener%201.1.0.codea.zip

PS I tried to use GitHub but I have some problems using Git, so I uploaded it on Dropbox. If someone wants to help me with Git, just let me know, thanks

Thanks and welcome to Codea!

Thank you @Zoyt :slight_smile:

Please let me know what do you think about my Class, I need suggestions to improve myself

Nice. I’ve used https://github.com/kikito/tween.lua a bit. Just change "local tween = " to "tween = ".

oh nice, thanks @tnlogy!
I could take a look at the code to see how to improve my class :slight_smile:

I made a video of the examples:

http://www.youtube.com/watch?v=W8MOWn6MDSw

quality is not good and video recording make everything slower than it is.
Actually it runs at 60 FPS

While the examples run I did change parameters like speed, reverse and such things.

@MdMbunny code?

@Connorbot999: look at his first post again. He linked to a .zip file containing the code.

Ok

@Connorbot999 here it is:

https://dl.dropbox.com/u/81603445/tweener%201.1.0.codea.zip

it contains the original codea folder with all the classes I wrote (plus some LuaBit functions I found on the web)

@toadkick thanks :slight_smile:

@ChrisF the line on row 7. just change it to tween = {} to make the value tween visible outside the file.

@tnlogy I apologize if this is a stupid question, but which ‘local tween =’ do you change to ‘tween =’

Wow, looks like a missing link appeared, a demo to show and test many of Codea’s graphical features (and in my case with regard to loveCodea).

Strange thing in TweenerPlugin when run with loveCodea, however: I get complaints about e.g. self:changeOrient(…) with changeOrient being nil; I had to rewrite it as TweenerPlugin.changeOrient(self, …). Same for hasProp. Is there something I do not understand about the object system? Looking into it …

Sleeping over it was a good idea. I need to include TweenerPlugin before all other files, because it is used as a base class. Otherwise the other classes would derive from nil.

@MdMbunny that’s a brilliant library. Love the example video.

@Simeon thank you very much.
I added a few things such a ShapeObj Class and a PauseAll methods in the Tweener Class, but unfortunatelly I’m not able to use GitHub, so it’s not so handy to update it for everyone…

@Codeslinger I’m sorry you had issues with it, as I said I’m not a real programmer, so I built it with a own logic, just to make it works with my projects. If you have any suggestion to improve it, I’d really appreciate it :slight_smile:

I really love this ,thank you very much for sharing, i’m using this in my games :slight_smile:

@juaxix I’m really happy for that! thanks :slight_smile:

@juaxix I’d really appreciate if you’ll show me something made with it :slight_smile:

Ok, my next game will include some magic combinations using the tweener class :slight_smile: expect the video! :smiley: