From 9c2c5b5424abd2c61a3d293c2c578134fe1de9ba Mon Sep 17 00:00:00 2001 From: garret Date: Mon, 5 Apr 2021 16:03:24 +0100 Subject: initial commit --- blur-fade.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 blur-fade.lua (limited to 'blur-fade.lua') diff --git a/blur-fade.lua b/blur-fade.lua new file mode 100644 index 0000000..9f60077 --- /dev/null +++ b/blur-fade.lua @@ -0,0 +1,44 @@ +script_name="Blur Fade" +script_description="Makes fade with blur." +script_author="garret" +script_version="2021-04-05" +include("utils.lua") + +-- TODO: add proper fade as well + +function l(i) + aegisub.log(i) + aegisub.log("\n") +end -- for debugging + +function make_lines(sub, sel, i, fill, bord, shad) + local line=sub[sel[i]] + line.effect = "" + local text = line.text + local fill_layer = util.copy(line) -- copy + local bord_layer = util.copy(line) -- the + local shad_layer = util.copy(line) -- line + fill_layer.layer=2 -- set + bord_layer.layer=1 -- correct + shad_layer.layer=0 -- layers + fill_layer.text = fill..fill_layer.text.." {fill}" -- add + bord_layer.text = bord..bord_layer.text.." {bord}" -- the + shad_layer.text = shad..shad_layer.text.." {shad}" -- tags + sub[sel[i]] = fill_layer -- put + sub.insert(sel[i]+1,bord_layer) -- in + sub.insert(sel[i]+2,shad_layer) -- script +end + +function main(sub, sel) -- TODO: make code less shit + for i=#sel,1,-1 do + local line=sub[sel[i]] + if line.effect == "blurin" then + -- make_lines(sub, sel, i, "in fill ", "in bord ", "in shad ") + make_lines(sub, sel, i, "{\\blur100\\bord0\\shad0\\t(\\blur0)}", "{\\blur100\\t(\\blur0)\\1a&FF&\\3a&FF&\\shad0.01}", "{\\blur100\\shad1.5\\1aFF\\bord0\\t(\\blur0)}") + elseif line.effect == "blurout" then + -- make_lines(sub, sel, i, "out fill ", "out bord ", "out shad ") + make_lines(sub, sel, i, "{\\bord0\\shad0\\t(\\blur100)}", "{\\t(\\blur100)\\1a&FF&\\3a&FF&\\shad0.01}", "{\\shad1.5\\1aFF\\bord0\\t(\\blur100)}") + end + end +end +aegisub.register_macro(script_name, script_description, main) -- cgit v1.2.3-70-g09d2