Files
PyTaikoGreen/Scripts/background/bg_collabs/yokai_tokoroten.lua
T

68 lines
3.3 KiB
Lua

local Yokai = require("background/bg_objects/yokai")
local Timing = require("background/bg_objects/timing")
local steps = Timing.steps
local enter, leave, squash = Yokai.enter, Yokai.leave, Yokai.squash
-- Dancers: Fumika, USApyon, Keita and Jibanyan (Fumika and USApyon land with a lighter squash)
-- dance an 8-beat routine: a quick squash, three bars of four poses (long, short, long, short),
-- the squash again and a stretch. Poses are offsets of their feet (texture.json y 686).
local ORIGIN = { 96, 312 }
local function dip(frame)
return { frame, 0.15, to = { nil, nil, "out", sy = 0.96 } },
{ frame, 0.125, sy = 0.96, to = { nil, nil, "in", sy = 1 } }
end
local function routine(sq, a, b, c, d, alt, st)
local bar = { { a, 0.625 }, { b, 0.375 }, { c, 0.625 }, { d, 0.375 } }
local first = { dip(sq) }
first[1].x, first[1].y, first[3] = 0, 0, { sq, 0.725 }
return steps(first,
bar, bar, { { a, 0.625 }, { b, 0.375 }, { c, 0.625 }, { alt, 0.375 } },
{ dip(sq) }, { { sq, 0.225 } }, { squash(st, 1.04, 0.25, 0.05, 0.2) })
end
-- Whisper floats over the routine: his outline and body loops, arm outlines (under the body)
-- and fills (over it) on the dancers' bars, and a cheering picture on top for the first beat
-- and the last squash. All of it bobs like the original's and squashes with the others; it
-- pivots 14px under his centre (texture.json y 544), where the original's does.
local WHISPER = { 96, 142 }
local WHISPER_MOVE = { length = 8,
{ 0, 0, 0, 10, to = { 0, 11.5, "out", sy = 0.96 } },
{ 0.15, 0, 0, 11.5, sy = 0.96, to = { 0, 7.25, "in", sy = 1 } },
{ 0.275, 0, 0, 7.25, to = { 0, 0 } },
{ 1, 0, 0, 0, to = { 0, 10 } }, { 2, 0, 0, 10, to = { 0, 0 } }, { 3, 0, 0, 0, to = { 0, 10 } },
{ 4, 0, 0, 10, to = { 0, 0 } }, { 5, 0, 0, 0, to = { 0, 10 } }, { 6, 0, 0, 10, to = { 0, 0 } },
{ 7, 0, 0, 0, to = { 0, 4.5, "out", sy = 0.96 } },
{ 7.15, 0, 0, 4.5, sy = 0.96, to = { 0, 2.75, "in", sy = 1 } },
{ 7.275, 0, 0, 2.75, to = { 0, 5 } },
{ 7.5, 0, 0, 5, to = { 0, 7.5, "out", sy = 1.04 } },
{ 7.75, 0, 0, 7.5, sy = 1.04, to = { 0, 8, sy = 1.04 } },
{ 7.8, 0, 0, 8, sy = 1.04, to = { 0, 10, "in", sy = 1 } },
}
local function arms(key)
local bar = { { 1, 0.625 }, { 2, 0.375 }, { 3, 0.625 }, { 4, 0.375 } }
local last = { { 1, 0.625 }, { 2, 0.375 }, { 3, 0.625 }, { 5, 0.375 } }
local layer = steps({ { 0, 1 } }, bar, bar, last, { { 0, 1 } })
layer.key = key
return layer
end
local CHEER = { key = "_cheer", { 0, 0, 0, 0 }, { 1, 0, hide = true }, { 7, 0, 0, 0 }, { 7.5, 0, hide = true } }
return Yokai.background("background/collab/yokai_tokoroten", {
[0] = { origin = ORIGIN, enter = enter(1, 0, 0.96), leave = leave(8), dance = routine(2, 3, 4, 5, 6, 7, 0) },
[1] = {
origin = WHISPER, enter = enter(1, 8), leave = leave(10),
dance = { beats = 8, move = WHISPER_MOVE,
Yokai.cycle(8, 0, "_outline"), arms("_arms"), Yokai.cycle(8, 2, "loop"), arms("_hands"), CHEER },
},
[2] = { origin = ORIGIN, enter = enter(1, 0, 0.96), leave = leave(8), dance = routine(2, 3, 4, 5, 6, 7, 0) },
[3] = { origin = ORIGIN, enter = enter(1), leave = leave(8), dance = routine(2, 3, 4, 5, 6, 7, 0) },
-- centre: never removed
[4] = { origin = ORIGIN, enter = enter(0), dance = routine(1, 2, 3, 4, 5, 6, 7) },
})