Using easing equations

Showcase your libraries, tools and other projects that help your fellow love users.
paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

Using easing equations

Post by paclito »

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
(15.24 KiB) Downloaded 368 times
NextPivMaster
Prole
Posts: 5
Joined: Thu Jun 11, 2009 2:26 am

Re: Using easing equations

Post by NextPivMaster »

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

Post by paclito »

offcourse

there is the source and the second version of the program... all for you :-)
Attachments
moves.zip
(15.74 KiB) Downloaded 334 times
moves2.love
(15.4 KiB) Downloaded 328 times
NextPivMaster
Prole
Posts: 5
Joined: Thu Jun 11, 2009 2:26 am

Re: Using easing equations

Post by NextPivMaster »

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.
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: Using easing equations

Post by ljdp »

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
Anim, class based.
(8.59 KiB) Downloaded 347 times

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

Post by paclito »

arghhhhhhhhh superb!!!

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

please please :-)

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?
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: Using easing equations

Post by ljdp »

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()
User avatar
Jake
Prole
Posts: 27
Joined: Sun Jul 20, 2008 2:01 pm

Re: Using easing equations

Post by Jake »

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.
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: Using easing equations

Post by ljdp »

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 :monocle:
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Using easing equations

Post by bartbes »

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).
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests