add the current progress done

This commit is contained in:
jill 2020-12-30 21:45:08 +00:00
parent 2939eb8db5
commit d548048ccc

248
plugins/mirinda_ease.xml Normal file
View file

@ -0,0 +1,248 @@
<Mods LoadCommand = "%xero(function(self)
--[[
+ - tested, implemented, works fine
/ - implemented, but not tested
- - not implemented, not tested
-- c2l
+c2l(start, ending, trunc) -- makes a chart2lua of a segment and uses that
-- start: start beat
-- ending: ending beat
-- trunc: whether to include the notes at beat (ending)
-c2l(notedata) -- uses an existing chart2lua
-- notedata: notitg format notedata, like the automatically generated notedata from 'save area to lua'
-- beat
-beat(table) -- raw beat input
-- table: beat table of every beat to fire on
-- forl
+forl(start, ending, add) -- acts as a for loop
-- start, ending and add act like arguments to a for loop
-- ways to interact with a beatobj
+beatobj:wiggle([perc], mod) -- wiggles a mod back and forth
-beatobj:sharpwiggle([perc], mod) -- wiggle(), but the ease is aligned with the start
+beatobj:bounce([perc], mod) -- bounces a mod up and down
+beatobj:onoff([perc], mod) -- turns a mod on and off
+ beatobj:wiggle0([perc], mod)
-beatobj:sharponoff([perc], mod) -- onoff(), but the ease is aligned with the start
- beatobj:sharpwiggle0([perc], mod)
-beatobj:kick([perc], mod) -- does a createReverse() version of the mod, for making kicks
- beatobj:reverse([perc], mod)
-beatobk:velocitymap([perc], mod) -- kick(), but without aligning the ease at 0
-beatobj:temp([perc], mod) -- does a createTemp() version of the mod
/beatobj:addm([perc], mod) -- adds a mod value every beat, useful for offsets
-- perc: mod percentage, defaults to 100
-- mod: mod name
/beatobj:f(function(beat, i, off, len) end) -- for custom mods, runs a function for each beat
-- beat: guess
-- i: index of beat
-- off: offset, is equal to i%2*2-1
-- len: length until next beat
/beatobj:ease(ease) -- sets an ease function for trailing functions to use
-- ease: ease function
/beatobj:align(a) -- aligns all ease functions with the snapping/fastest point at a
-- a: snapping point
/beatobj:mixease(ease1, ease2, a) -- does :ease(mixEase(ease1, ease2, a)) and :align(a)
-- ease1: in easing function
-- ease2: out easing function
-- a: snapping point
/beatobj:setl(a) -- sets a to the length of each ease
-- a: length
+beatobj:add(beatobj) -- merges another beatobj table
-- beatobj: the merged beatobj
/beatobj:clone(beat) -- clones the beat timings from the first beat onward to the beat
-- beat: the beat to copy the rhythm to
/beatobj:forclone(start, ending, add) -- clone(), but as a for loop
-- start, ending and add act like arguments to a for loop
/beatobj:filter(filterfunc) -- filters the beatobj with a filter function, return true to keep the element and false to discard it
-- filterfunc(value, index): the filter function
/beatobj:filtermines() -- remove all mines from the c2l
]]
local function copyTable(datatable)
local tblRes = {}
if type(datatable) == 'table' then
for k,v in pairs(datatable) do tblRes[k]=copyTable(v) end
else
tblRes=datatable
end
return tblRes
end
local function mixEase(e1, e2, point)
if not point then point = 0.5 end
return function(a)
if a < point then
return e1(a / point) * point
else
return e2((a - point) / (1 - point)) * (1 - point) + point
end
end
end
local beatobjTemplate = {
_beats = {},
_ease = inOutCirc,
_align = 0.5,
_length = 1,
-- setters
setl = function(self, a) self._length = a; return self end,
ease = function(self, a) self._ease = a; return self end,
align = function(self, a) self._align = a; return self end,
-- almost setters but not quite
add = function(self, add)
for i,b in ipairs(add._beats) do
table.insert(self._beats, b)
end
return self
end,
mixease = function(self, e1, e2, a)
self._ease = mixEase(e1, e2, a)
self._align = a
end,
-- meta / manipulators
filter = function(self, filterfunc)
local beats = {}
for i,v in ipairs(self._beats) do
local check = filterfunc(v, i)
if check then table.insert(beats, v) end
end
self._beats = beats
return self
end,
filtermines = function(self)
self = self:filter(function(v) v[3] ~= 'M' end)
return self
end,
f = function(self, forfunc)
for i,v in ipairs(self._beats) do
-- function(beat, i, off, len)
forfunc(v[1], i, i%2*2-1, (self._beats[i + 1] or {v[1] + self._length})[1] - v[1])
end
return self
end,
clone = function(self, beat)
local newbeats = self._beats
for i,v in ipairs(self._beats) do
local newv = {}
newv[1] = v[1] - self._beats[1][1] + beat
table.insert(newbeats, newv)
end
self._beats = newbeats
return self
end,
forclone = function(self, start, ending, add)
add = add or 1
local oldself = copyTable(self)
for i = start, ending, add do
self = oldself:clone(i)
end
return self
end,
-- mods
wiggle = function(self, perc, mod)
if mod == nil then mod = perc; perc = 100 end
for i,v in ipairs(self._beats) do
local len = self._length
local off = i%2*2-1
ease {v[1] - len / (1 / self._align), len, self._ease, perc * off, mod}
end
return self
end,
onoff = function(self, perc, mod)
if mod == nil then mod = perc; perc = 100 end
for i,v in ipairs(self._beats) do
local len = self._length
local off = i%2
ease {v[1] - len / (1 / self._align), len, self._ease, perc * off, mod}
end
return self
end,
wiggle0 = beatobjTemplate.onoff,
addm = function(self, perc, mod)
if mod == nil then mod = perc; perc = 100 end
for i,v in ipairs(self._beats) do
local len = self._length
add {v[1] - len / (1 / self._align), len, self._ease, perc, mod}
end
return self
end
bounce = function(self, perc, mod)
if mod == nil then mod = perc; perc = 100 end
local function bounceease(a)
if a < 0.5 then
return (self._ease(a + 0.5) - 0.5) / 0.5
else
return 1 - (self._ease(a - 0.5) / 0.5)
end
end
for i,v in ipairs(self._beats) do
local len = self._length
ease {v[1], len, bounceease, perc, mod}
end
return self
end
}
function c2l(start, ending, trunc)
local self = copyTable(beatobjTemplate)
self._beats = P1:GetNoteData(start, ending)
return self
end
function forl(start, ending, add)
add = add or 1
local self = copyTable(beatobjTemplate)
local v = {}
for i = start, ending, add do
table.insert(v, {i})
end
self._beats = v
return self
end
end)"
Type = "ActorFrame"/>