tween.lua

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: tween.lua

Post by kikito »

Oh, ok. Fixed that too, thanks a lot!
When I write def I mean function.
User avatar
KingRecycle
Prole
Posts: 44
Joined: Thu May 24, 2012 1:01 am

Re: tween.lua

Post by KingRecycle »

It seems for me the callback is being called right away and not when the tween is finished.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: tween.lua

Post by kikito »

What code are you using? Have you seen the demo?
When I write def I mean function.
User avatar
KingRecycle
Prole
Posts: 44
Joined: Thu May 24, 2012 1:01 am

Re: tween.lua

Post by KingRecycle »

Oh...so that is how you do it. Whoops. Thanks.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: tween.lua

Post by kikito »

:) no problemo
When I write def I mean function.
User avatar
mangadrive
Prole
Posts: 32
Joined: Sat Nov 17, 2012 10:26 pm

Re: tween.lua

Post by mangadrive »

I've been messing with this for the past 30 mins and I cannot get anything to draw. I'm fairly certain I have it hooked up right, but even the basic demo examples won't work.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: tween.lua

Post by kikito »

mangadrive wrote:I've been messing with this for the past 30 mins and I cannot get anything to draw. I'm fairly certain I have it hooked up right, but even the basic demo examples won't work.
Hello there.

I'd like to help you, but I'm afraid your message is too vage. By reading this, all I can tell you is "Sorry, you must be doing something wrong in your code".

In order to give you a more helpful answer, I'd need more. Something that helps me see the problem. Reading the code that you wrote would almost certainly help. The whole .love file, even if it draws nothing, would be even better.
When I write def I mean function.
User avatar
mangadrive
Prole
Posts: 32
Joined: Sat Nov 17, 2012 10:26 pm

Re: tween.lua

Post by mangadrive »

I'm using your coded examples from your git. Maybe not correctly but it's your code.

Code: Select all

function love.load()



local tween = require 'tween'


end


function love.draw()

local backgroundColor = {255,255,255}
tween(2, backgroundColor, {0,0,0}, 'linear', print, "hello!")



local label = { x=200, y=0, text = "hello" }
tween(4, label, { y=300 }, 'outBounce')


end


function love.update(dt)
  
tween.update(dt)


end
Using require tween with local gives a nil value.. If I remove local it runs, and when you call the console it prints, but I see no tweens. I've required "tween" as in pointing to the lua file itself. I've set the background different colors, I've run with and without bat. I've put the globals in load, i've put them in draw. I've divided the code up every which way.. Your "traffic light" example on the git doesn't work either due to syntax. I'm still kind of new to Love 2d and LUA. I respect that you aren't entitled to teach people these things to use your library, but either I translated the information poorly (more likely) or there wasn't enough.

I hope that didn't sound disrespectful. Just meaning I didn't know how to use the code or examples you provide without getting erroneous results.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: tween.lua

Post by kikito »

Oh, I see.

In general (like 95% of the time), require statements are at the beginning of each file, and outside all functions.

Try putting the `local tween = require 'tween'` line outside of love.load:

Code: Select all

local tween = require 'tween'

function love.load()
 -- whatever else you want to put here
end

function love.draw()
  -- same as before
end
When I write def I mean function.
User avatar
mangadrive
Prole
Posts: 32
Joined: Sat Nov 17, 2012 10:26 pm

Re: tween.lua

Post by mangadrive »

I guess I'm missing something very valuable here or my super_noob status is level 9k+

Code: Select all

local tween = require 'tween'


function love.draw()

love.graphics.setColor(255,255,255,255)
love.graphics.print("test",0,0)


local label = { x=200, y=0, text = "hello" }
tween(4, label, { y=300 }, 'outBounce')


end


function love.update(dt)
  
tween.update(dt)

end
Still just a black screen with "test". No tweens.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest