[library] cron.lua - time management for LÖVE - v2.0 is out!

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: cron.lua

Post by Jasoco »

This might be useful for me. I had been wondering how to do timing correctly for a while. Especially for stuff like cinematics where stuff needs to be moving and disappearing and appearing at specific times.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: cron.lua

Post by kikito »

Hi jasoco!

Definitively, it can help with the "measure time" part. For resolving the whole cinematics thing you will need different stuff.

It's actually funny that you mention it, I've been thinking about cinematics in lua since I read a question about them in stack overflow two weeks ago. Open another thread if you need help with them; I might be able to surprise you.
When I write def I mean function.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: cron.lua

Post by Jasoco »

kikito wrote:Hi jasoco!

Definitively, it can help with the "measure time" part. For resolving the whole cinematics thing you will need different stuff.

It's actually funny that you mention it, I've been thinking about cinematics in lua since I read a question about them in stack overflow two weeks ago. Open another thread if you need help with them; I might be able to surprise you.
Thing is I was hoping to create something that works along the lines of Apple's "Core Animation" where you have objects and can tell them to animate from one place to another and have stuff happen when they're finished or all of them finish or whatever. If you use OS X or iOS a lot, you know what I mean. Everything is animated via Core Animation in OS X/iOS.

Of course I'd tried simple methods before, but nothing really solid. Plus I don't have any content.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: cron.lua

Post by BlackBulletIV »

Jasoco wrote:
kikito wrote:Hi jasoco!

Definitively, it can help with the "measure time" part. For resolving the whole cinematics thing you will need different stuff.

It's actually funny that you mention it, I've been thinking about cinematics in lua since I read a question about them in stack overflow two weeks ago. Open another thread if you need help with them; I might be able to surprise you.
Thing is I was hoping to create something that works along the lines of Apple's "Core Animation" where you have objects and can tell them to animate from one place to another and have stuff happen when they're finished or all of them finish or whatever. If you use OS X or iOS a lot, you know what I mean. Everything is animated via Core Animation in OS X/iOS.

Of course I'd tried simple methods before, but nothing really solid. Plus I don't have any content.
Ah ha, you're wanting a tweening library with the ability to tween properties. You're about to release a library to do that aren't you kikito?

Something that I think would help cinematics is a timeline library, like Greensock's TimelineLite/TimelineMax for Flash.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: cron.lua

Post by Jasoco »

BlackBulletIV wrote:
Jasoco wrote:Thing is I was hoping to create something that works along the lines of Apple's "Core Animation" where you have objects and can tell them to animate from one place to another and have stuff happen when they're finished or all of them finish or whatever. If you use OS X or iOS a lot, you know what I mean. Everything is animated via Core Animation in OS X/iOS.

Of course I'd tried simple methods before, but nothing really solid. Plus I don't have any content.
Ah ha, you're wanting a tweening library with the ability to tween properties. You're about to release a library to do that aren't you kikito?

Something that I think would help cinematics is a timeline library, like Greensock's TimelineLite/TimelineMax for Flash.
Basically something like this:
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: cron.lua

Post by BlackBulletIV »

Wow that's pretty cool. Yeah a tweening library would be best for that job.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: cron.lua

Post by kikito »

I agree. A tweening library would be very good for performing things like those "zoom in/zoom out" operations (as well as fade-ins, gradual color changes, gradual volume up/down in music, etc).

As BlackBulletIV was saying, I was planning to implement a library for making tweening easy in Lua, as I've got a bank holiday next monday.

My lib is going to be inspired in jquery's animate function (scroll down to see some examples). Mine will probably have less functionality though.

The interface is already defined and it's going to be very minimalistic, like in memoize, cron and inspect: 2 main functions, with 2 additional ones for extra stuff that will not be used most of the time.

All in all, note that there are already some solutions out there for tweeing out there:
When I write def I mean function.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: cron.lua

Post by kikito »

Quick update: I've made a couple small changes in cron.lua
  • It now liberates more memory than before (not all of it, but still)
  • It supports funcTables (tables with a _call metamethod) in addition to functions
I'm working on my tweening library, and it is nearly finished. I just need to make it a bit cooler and it'll be ready.

EDIT: the tweening library was released months ago, but I forgot to update this thread. Here it is: tween.lua
When I write def I mean function.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: cron.lua

Post by kikito »

cron.lua update!

I've released a new version (1.2)

The big change in cron.lua 1.2 is a new method, cron.tagged. It allows tagging time entries, as well as updating them/cancelling them in groups:

Code: Select all

local cron = require 'cron'

cron.tagged('main-menu','menu').after(5, showMenu)

...

cron.tagged('main-menu').update(dt)
cron.tagged('menu').cancel()
Other changes:
  • Minor changes/optimizations (contributed by hahawoo
  • Tests have been improved
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: [library] cron.lua - time management for LÖVE

Post by bartbes »

If you use cron.update, does it update all tags too?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest