Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Tweener Class with Easing functions and more

edited June 2012 in Code Sharing Posts: 11

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 :)

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 :)

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


  • Posts: 2,820

    Thanks and welcome to Codea!

  • Posts: 11

    Thank you @Zoyt :)

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

  • Posts: 536

    Nice. I've used a bit. Just change "local tween = " to "tween = ".

  • edited June 2012 Posts: 11

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

    I made a video of the examples:

    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.

  • Posts: 154

    @MdMbunny code?

  • Posts: 580

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

  • Posts: 154


  • Posts: 11

    @Connorbot999 here it is:

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

    @toadkick thanks :)

  • Posts: 18

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

  • Posts: 536

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

  • Posts: 202

    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 ...

  • Posts: 202

    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.

  • SimeonSimeon Admin Mod
    Posts: 5,782

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

  • edited June 2012 Posts: 11

    @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...

  • Posts: 11

    @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 :)

  • Posts: 437

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

  • Posts: 11

    @juaxix I'm really happy for that! thanks :)

  • Posts: 11

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

  • Posts: 437

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

  • Posts: 11

    @juaxix great! I'll look forward to it, thanks :)

Sign In or Register to comment.