You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
746 B
27 lines
746 B
13 years ago
|
Effects = {}
|
||
13 years ago
|
|
||
13 years ago
|
function Effects.fadeIn(widget, time, elapsed)
|
||
13 years ago
|
if not elapsed then elapsed = 0 end
|
||
13 years ago
|
if not time then time = 250 end
|
||
13 years ago
|
widget:setOpacity(math.min((255*elapsed)/time, 255))
|
||
13 years ago
|
if elapsed < time then
|
||
|
scheduleEvent(function()
|
||
13 years ago
|
Effects.fadeIn(widget, time, elapsed + 30)
|
||
13 years ago
|
end, 30)
|
||
|
end
|
||
|
end
|
||
|
|
||
13 years ago
|
function Effects.fadeOut(widget, time, elapsed)
|
||
13 years ago
|
if not elapsed then elapsed = 0 end
|
||
13 years ago
|
if not time then time = 250 end
|
||
13 years ago
|
widget:setOpacity((255*(time - elapsed))/time)
|
||
13 years ago
|
if elapsed < time then
|
||
|
scheduleEvent(function()
|
||
13 years ago
|
Effects.fadeOut(widget, time, elapsed + 30)
|
||
13 years ago
|
end, 30)
|
||
|
else
|
||
|
widget:destroy()
|
||
|
end
|
||
|
end
|
||
|
|