## Fling: a library

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Fling: a library

I was recently thinking about a LÖVE plug-in for Firefox. I decided that it is something that could be done, but not by me. However, that got me thinking about Flash (because, well, I don't really need to explain that, do I?), and thus was Fling born: a FLash INspired Graphics library. It's still in it's infancy, so it might change radically, and you can't do a lot with it (run the .love file to see what is).

I think the LPCL is appropriate here.

See latest post for new version.
Attachments
flingtest.love
Last edited by Robin on Thu Sep 10, 2009 3:34 pm, edited 1 time in total.

Tenoch
Citizen
Posts: 76
Joined: Mon Jul 21, 2008 7:49 am

### Re: Fling: a library

Interesting, this way of scripting the animation once, and letting the engine doing the rest. I'm not sure how interactive this can be made. More for cutscenes or something like that perhaps?
"When in doubt, use brute force." Ken Thompson

TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

### Re: Fling: a library

I really like this idea. Sometimes you just want a scripted animation in your menus that don't necessarily need to be adaptable to anything.

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

### Re: Fling: a library

That looks great, though you might want to move

Code: Select all

update = fling.update
draw = fling.draw

out of fling, and into the main.lua. Another thing, is there a way to draw a single animated image? Like fling.draw(img1)?

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Fling: a library

bartbes wrote:That looks great, though you might want to move

Code: Select all

update = fling.update
draw = fling.draw

out of fling, and into the main.lua.
Why? I added those two lines so it would use fling.update() and fling.draw() if no update() and draw() were defined. That way, any .love using Fling would be an animation by default, unless they added some interactive code by themselves.

For the record, fling.update() and fling.draw() can be used for animating cutscenes and the like:

Code: Select all

function update(dt)
if cutscene then
fling.update(dt)
if #fling.queue == 0 then cutscene = false end
else
-- all the usual stuff
if x > 100 then
-- prepare cutscene
cutscene = true
end
end
end
function draw(dt)
if cutscene then
fling.draw()
else
-- draw the usual
end
end
bartbes wrote:Another thing, is there a way to draw a single animated image? Like fling.draw(img1)?
Good idea. I'll start implementing it right away.
Tenoch wrote:I'm not sure how interactive this can be made.
Me neither. But we'll find out along the way.

TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

### Re: Fling: a library

I library like this needs easing in the motion.
like so: jQuery Easing Plugin (version 1.3)

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Fling: a library

TechnoCat wrote:I library like this needs easing in the motion.
like so: jQuery Easing Plugin (version 1.3)
Interesting... I think you're right. I will try to implement it.

TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

### Re: Fling: a library

Whoa, definitely bookmarking that.

EDIT: Don't forget to check out the jQuery Easing v1.3 source.
EDIT2: That pdf was an interesting read. Almost makes it look easy. The author's humor was also appreciated by me.

Pliskin09
Citizen
Posts: 89
Joined: Fri Jul 24, 2009 8:30 am

### Re: Fling: a library

looks very nice robin. exactly what i had in mind as well when i made a thread. i dont have the know how to do it though :p

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Fling: a library

New version!

I've implemented fling.draw(img1), started with callbacks (for example a function will be called if a certain key is pressed), and the easing functions.

Especially with the last I'm having some difficulties. I think it might be due to the way I implemented the rest of Fling.
Attachments
flingtest2.love