All pastes #448759 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-04-19 21:19 UTC
rendered paste body
include("karaskel.lua")
include("karaskel-adv.lua")

script_name = "test"
script_description = "test"

function new_windy_blur(subs)
	aegisub.progress.task("Getting header data...")
	local meta, styles = karaskel.collect_head(subs)
	
	aegisub.progress.task("Applying effect...")
	local i, ai, maxi, maxai = 1, 1, #subs, #subs
	while i <= maxi do
		aegisub.progress.task(string.format("Applying effect (%d/%d)...", ai, maxai))
		aegisub.progress.set((ai-1)/maxai*100)
		local l = subs[i]
		if l.class == "dialogue" and
				not l.comment and
				l.style == "Romanji" then
			karaskel.preproc_line(subs, meta, styles, l)
			do_fx(subs, meta, l)
			maxi = maxi - 1
			subs.delete(i)
		else
			i = i + 1
		end
		ai = ai + 1
	end
	aegisub.progress.task("Finished!")
	aegisub.progress.set(100)
end

-->-- x and y coordination definition
  local x=syl.center + line.centerleft + 10
  local y=line.styleref.margin_v + 13
--<-- end def

function do_fx(subs, meta, line)
	local l = table.copy(line)
   	l.layer=25
   	l.text = string.format("{\\an5\\move(%d,%d,%d,%d)\\alpha&HFF&\\t(\\alpha&HDF&)}%s", x+math.random(-7,7), y+math.random(-7,7), x+math.random(-1,1), y+math.random(-1,1), syl.text)
   	l.end_time = line.start_time
   	l.start_time = l.end_time - 50
	ble = line.end_time + 40
	bla = ble - 50
   	l.layer=2
   	l.text = string.format("{\\an5\\move(%d,%d,%d,%d)\\alpha&HDF&\\t(\\alpha&HFF&)\\1c&H292929\\3c&HE6E6E8&}%s", x+math.random(-1,1), y+math.random(-1,1), x+math.random(-7,7), y+math.random(-7,7), syl.text)
   	l.start_time = bla
   	l.end_time = ble
	subs.append(l)
	
	for i = 1, line.kara.n do
		local syl = line.kara[i]
		if syl.duration > 0 then
			local l = table.copy(line)
			l.start_time = line.start_time + syl.start_time
			if syl.duration < 750 then
				l.end_time = l.start_time + 1500
			else
				l.end_time = l.start_time + syl.duration * 1.5
			end
			l.layer = 2
			local temp = string.format("{\\be1\\move(%d,%d,%%d,%%d)\\1a&Hd0\\bord0\\shad0\\t(0.6,\\1a&HFF&)}%s", line.left+syl.center, line.styleref.margin_t, syl.text_stripped)
			for j = -8, 8 do
				l.text = string.format(temp, line.left+syl.center+math.cos(math.rad(j*4))*30, line.styleref.margin_t+math.sin(math.rad(j*4))*30)
				subs.append(l)
			end
		end
	end
end

aegisub.register_filter("Future Windy Blur", "", 2000, new_windy_blur)