diff --git a/Scripts/global/transition.lua b/Scripts/global/transition.lua index 8b0d0c1..ceb5fe0 100644 --- a/Scripts/global/transition.lua +++ b/Scripts/global/transition.lua @@ -712,7 +712,23 @@ function SongTransition.new(title, subtitle, is_second) return self end +-- timeline the engine reads (rainbow rise for the dan art, done); wall clock, not the movie's +local RISE_MS, RISE_DIST = 300.0, 1224 +local SCENE1_MS, SCENE2_MS = 2983.3333333333335, 516.6666666666666 +function SongTransition:state() + local t = self.rt or 0 + local rise = RISE_DIST * math.max(0, math.min(1, t / RISE_MS)) ^ 3 + if self.is_second then + return { rainbow_up = rise, fade_out = math.max(0, 1 - t / SCENE2_MS), finished = t >= SCENE2_MS } + end + return { rainbow_up = rise, fade = math.min(1, t / SCENE1_MS), finished = t >= SCENE1_MS } +end + +function SongTransition:start() self.rt0 = nil end + function SongTransition:update(current_ms, rainbow_up, info_fade) + if not self.rt0 then self.rt0 = current_ms end + self.rt = current_ms - self.rt0 if self.last_ms then self.t = self.t + math.max(0, math.min(MAX_DT, current_ms - self.last_ms)) end