Fade in and fade out effects...

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Arthes
Prole
Posts: 10
Joined: Fri Dec 30, 2011 10:52 am

Fade in and fade out effects...

Post by Arthes »

Hi.
How to do the fade in and fade out effects in Love2D? Is it possible?
Very thanks for replies.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Fade in and fade out effects...

Post by Robin »

I think you can use lQuery for that, but I don't know how it works.

You can do it manually by controlling the alpha:

Code: Select all

love.graphics.setColor(255, 255, 255, a)
love.graphics.draw(something, ...)
You would change a over time.
Help us help you: attach a .love.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Fade in and fade out effects...

Post by kikito »

I can't type much from here (mobile phone) try putting the alpha in a table and using tween.lua .
When I write def I mean function.
User avatar
GijsB
Party member
Posts: 380
Joined: Wed Jul 20, 2011 10:19 pm
Location: Netherlands

Re: Fade in and fade out effects...

Post by GijsB »

Code: Select all

A = 255
How_long_it_will_take_in_seconds = 5

function love.update(dt)
A = A-(255/How_long_it_will_take_in_seconds*dt)
end

function love.draw()
--something with A as alpha
end
I hope that gives you a idea of how it works :D
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 5 guests