## Using easing equations

paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

### Using easing equations

I've see on the envy framework a lua file that has catch my attention
anim.lua

here there are some functs to move objetcs around the screen, with this demo i'm been trying to make it work, I'll add some more examples when I understand the how to function of all of them.

firs lineal moves..... next angular moves etc etc...
Attachments
moves.love

NextPivMaster
Prole
Posts: 5
Joined: Thu Jun 11, 2009 2:26 am

### Re: Using easing equations

This will be very helpful in my next project, but I can't get the source files. I rename the .love to .zip but WinRAR wouldn't extract it. Could you put the sources in a zip please, this will make alot of peoples games look awsome. Good work.

paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

### Re: Using easing equations

offcourse

there is the source and the second version of the program... all for you :-)
Attachments
moves.zip
moves2.love

NextPivMaster
Prole
Posts: 5
Joined: Thu Jun 11, 2009 2:26 am

### Re: Using easing equations

Oh yay! I Love you(pun intended)! I'm making an animation program, it's going to use tweening, and I wanted to have a easing option, letting the animator have more realistic movements in the final product. This is going to help me so much.

ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

### Re: Using easing equations

However I don't like how everything is based on strings.
So I edited anim.lua to be more class based.
anim.lua
Anim, class based.

Code: Select all

function anim.create( from, to, time, delay, eq, ... )
function anim:start()
function anim:pause()
function anim:callback( delay, func, ... )
function anim:update()
function anim.updateAll()
function anim:get( default )
function anim:destination()
function anim:remove()

--example
buttonanim = anim.create( -200, 60, 0.5, 1, ANIM_QUAD_INOUT )
buttonanim:callback( 0.8, function() love.audio.play( menu.sound_whoosh ) end)
buttonanim:start()

paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

### Re: Using easing equations

arghhhhhhhhh superb!!!

please, can you make a example of this? and explain how the callback work?

It was the next step of the my code but you are the best

thanks thanks thanks ...

and thanks

EDIT: I haven't see the example sorry........ but perhaps you can add an example to the love file isn't?

ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

### Re: Using easing equations

Well I used the edited version in my parametric examples for the menu
http://love2d.org/forum/viewtopic.php?f=5&t=767
it's in menu.lua, but the code is a bit messy at the moment.

I might add an example to the moves lua, but it's not really that much different from the original.
Instead of remembering the string you just use the variable returned by anim.create()

Jake
Prole
Posts: 27
Joined: Sun Jul 20, 2008 2:01 pm

### Re: Using easing equations

ljdp wrote:These functions are definitely helpful.
However I don't like how everything is based on strings.
So I edited anim.lua to be more class based.
anim.lua

Code: Select all

function anim.create( from, to, time, delay, eq, ... )
function anim:start()
function anim:pause()
function anim:callback( delay, func, ... )
function anim:update()
function anim.updateAll()
function anim:get( default )
function anim:destination()
function anim:remove()

--example
buttonanim = anim.create( -200, 60, 0.5, 1, ANIM_QUAD_INOUT )
buttonanim:callback( 0.8, function() love.audio.play( menu.sound_whoosh ) end)
buttonanim:start()
Oh hey that's cool. When I originally wrote this I deliberately made them use strings so I didn't have to manually store the variables myself.

ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

### Re: Using easing equations

I always prefer using a class based system because I would have ending up storing the strings to variables anyway so you end up using more space (although probably negligable). To each his own

bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

### Re: Using easing equations

I wonder which classes are used, as I see a lot of differences on these forums, I myself always use my own system (on the wiki, called SECS). There have been discussion about this on IRC, and we came to the conclusion we should all create (and use) libraries that conform to a certain syntax, to make them interchangeable (or at least, easier to switch).

### Who is online

Users browsing this forum: No registered users and 7 guests