Page 1 of 1

tweening

Posted: Sat Aug 15, 2009 5:08 pm
by Pliskin09
i think the abillity to set 2 values for a single property (image alpha, x position, y position etc) and have the engine tween those 2 together and run it would be usefull. for example

tween = love.something.tween(0,30,5)

ball:setX(tween)

the tween would continue to loop from 0 to 30 every 5 seconds (so -> 6, 12, 18, 24, 30 and repeat). leaving it like that would make the ball move right from 0 to 30 over and over again. in the balls update step, we could check the status of the tween and do stuff accordingly.

if tween:status == "loopend" then...etc

i havnt thought it out very well but i just wanted to put the idea out there. i see its main uses in gui's and background effects. other uses could be for platforms in 2d games for example. since the tween would simply return a number, it isnt restricted to only altering the x and y of an object as well. you could combine it with anything that requires a number as a parameter.

anywho, tell me your ideas.

edit:

technocats video is a good example of how it could be used for a menu. see how most of the "buttons" move about? on the main menu for example, clicking on "music" hides everything else and smoothly animates the text from its current possition to the very top, increasing its size at the same time. you could achieve this with 3 tweens - ones for size, x coords and y coords .

Re: tweening

Posted: Sat Aug 15, 2009 5:24 pm
by Robin
I had an idea for a library for love to do things like that: Fling (or FLash INspired Graphics). Haven't done anything for it yet.

Re: tweening

Posted: Sat Aug 15, 2009 5:33 pm
by bartbes
Seems like something that can be easily done from a user-created library. (in pure lua)

Re: tweening

Posted: Sat Aug 15, 2009 5:35 pm
by Robin
bartbes wrote:Seems like something that can be easily done from a user-created library. (in pure lua)
== Fling

Re: tweening

Posted: Sun Aug 16, 2009 3:02 am
by TechnoCat
Robin wrote:
bartbes wrote:Seems like something that can be easily done from a user-created library. (in pure lua)
== Fling
Fling: a library Robin's thread.