sonic-radiance/sonic-radiance.love/birb/modules/transitions/parent.lua

42 lines
1 KiB
Lua
Raw Normal View History

2021-04-02 19:33:56 +02:00
local TransitionParent = Object:extend()
local TweenManager = require "game.modules.tweenmanager"
function TransitionParent:new(func, ox, oy, fadeOut, easeIn, easeOut, duration, wait)
self.tween = TweenManager(self)
self:loadResources()
self.func = func
self.ox = ox or 0
self.oy = oy or 0
self.fadeOut = fadeOut
if (self.fadeOut) then
self.value = 1
self.tween:newTween(wait, duration, {value = 0}, easeOut)
else
self.value = 0
self.tween:newTween(0, duration, {value = 1}, easeIn)
end
self.tween:newTimer(duration + wait, "isOver")
end
function TransitionParent:loadResources()
--vide par defaut
end
function TransitionParent:update(dt)
2021-04-22 23:41:20 +02:00
self.tween:update(dt * 1.5)
2021-04-02 19:33:56 +02:00
end
function TransitionParent:timerResponse(timer)
if (timer == "isOver") then
if (self.func ~= nil) then
self.func()
end
core.screen:transitionOver(self.fadeOut)
end
end
function TransitionParent:draw()
end
return TransitionParent