TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
Dragon Ball Op
[打印本页]
作者:
ALKOON
时间:
2015-9-12 23:17:14
标题:
Dragon Ball Op
本帖最后由 ALKOON 于 2015-9-12 23:31 编辑
Hi everyone I just made effect for - Dragon Ball OP- Recently
so I just want to share just a part of my script (Fx_03)=D
link of video :
http://www.dailymotion.com/video/x34wgnn_alkoon-dragon-ball-super-op_music
script :
include("karaskel.lua")
script_name = "Dragon Ball "
script_description = "Dragon Ball OP FX_03"
script_version = "1.2"
script_author = "ALKOON"
function Fx_Dragon(subs)
aegisub.progress.set(0)
aegisub.set_undo_point(script_name)
aegisub.progress.task("Getting header data..")
local meta, styles = karaskel.collect_head(subs)
aegisub.progress.task("Applying Script")
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 then
karaskel.preproc_line(subs, meta, styles, l)
do_fx(subs, meta, l)
l.comment = true
subs[i] = l
else
i = i + 1
end
ai = ai + 1
end
aegisub.progress.set(100)
aegisub.set_undo_point(script_name)
end
function frames(starts, ends, frame_time)
if type(starts) ~= "number" or type(ends) ~= "number" or type(frame_time) ~= "number" or frame_time <= 0 then
error("number, number and number expected", 2)
end
local cur_start_time, i, n = starts, 0, math.ceil((ends - starts) / frame_time)
local function next_frame()
if cur_start_time >= ends then
return nil
end
local return_start_time = cur_start_time
local return_end_time = return_start_time + frame_time <= ends and return_start_time + frame_time or ends
cur_start_time = return_end_time
i = i + 1
return return_start_time, return_end_time, i, n
end
return next_frame
end
function do_fx(subs, meta, line)
local shape = "{\\p2}m 0 0 l 49 49 l 99 0 l 50 50 l 99 100 l 49 51 l -1 100 l 48 50 l 0 0 "
local shape2 = "{\\p2}m 0 0 b 3 -2 7 -2 10 0 b 13 3 13 8 10 10 b 7 13 3 13 0 10 b -3 7 -3 3 0 0 "
local px1 =line.left
local px2 =line.right
local y1, y2 = line.top, line.bottom
local x1, x2 = px1, px2
loops = line.width
local crclx = 360/loops
local radx = (x2-x1) /2
local rady = (y2-y1) /2
for j=1, loops do
local l=table.copy(line)
local csx = math.cos((crclx*j)*(math.pi/350))*radx
local sny = math.sin((crclx*j)*(math.pi*2/350))*rady
local posx, posy = line.center +csx, line.middle+sny +6
local rand = math.random(-45,45)
local xx = math.cos(math.rad(j*10))*math.random(-10,25)
local yy = math.sin(math.rad(j*10))*math.random(-10,25)
local alfa =string.format("alpha&H%02X&",20)
local sizft = (j/loops)
l.start_time=line.start_time - 100 - ((j/loops)-1)*400
l.end_time=line.start_time - ((j/loops)-1)*400 + 300
tt = l.end_time - l.start_time
fs1 = 80
fss = 30
tfr = ((400)-1)*sizft
local textfx = string.format("{\\an5\\shad0\\fad(0,150)\\bord0\\blur0\\1c&Hffffff&\\3c&HffffffB&\\fscx%d\\fscy%d}",fs1,fs1)
l.text= string.format("{\\t(\\1c&HBCE0FE&)\\fr"..tfr.."\\t(\\fscx%d\\fscy%d\\blur6)\\move(%f.01,%f.01,%f.01,%f.01,%d,%d)}",
fss,fss,posx,posy,posx,posy-50, tt-600,tt+600) .. shape
l.text = textfx .. l.text
l.effect = "shape_star"
l.layer = 1
subs.append(l)
fs2 = 60
fs3 = math.random(10,30)
local textfx = string.format("{\\an5\\shad0\\fad(0,150)\\bord1\\blur2\\3a&HCC&\\1c&HFFFDE9&\\3c&HD1C963&\\fscx%d\\fscy%d}",fs2,fs2)
l.text= string.format("{\\t(\\1c&Hffffff&\\3c&Hffffff&)\\fr"..tfr.."\\t(\\fscx%d\\fscy%d)\\move(%f.01,%f.01,%f.01,%f.01,%d,%d)}",
fss,fss,posx,posy-13,posx+xx,posy-13+yy, tt-600,tt+600) .. shape2
l.text = textfx .. l.text
l.effect = "shape_circle"
l.layer = 0
subs.append(l)
end
for i = 1, line.kara.n do
local syl = line.kara[i]
local x = syl.center + line.left
local y = line.middle
local l = table.copy(line)
pos_enter=0
text_length=string.len(syl.text_stripped)
modt=0
for char in unicode.chars(syl.text_stripped) do
char_t = aegisub.text_extents(line.styleref,char)
local x = line.left + syl.left +char_t/2+pos_enter
local y = line.middle
local chars = table.copy(syl)
chars.text = char
start_t=line.start_time+syl.start_time+modt-20
end_t=line.start_time+syl.end_time-(syl.duration/3.8)+modt
if chars.text == "" or chars.text == " " then l.text = "{}" else
c1 = "\\1vc(&HECC885&,&HECC885&,&H916814&,&H916814&)"
c2 = "\\1vc(&H805E10&,&H805E10&,&HF1E1B8&,&HF1E1B8&)"
l.text = string.format("{\\move(%d,%d,%d,%d,0,400)\\fad(150,0)\\fscx30\\fscy30\\t(15,400,\\fscx100\\fscy100)\\an5\\bord1.5\\shad0\\be2"..c1.."}",
640, y-syl.height*1.6, x, y).. chars.text
l.start_time=line.start_time - 450 + syl.i*50
l.end_time= start_t
l.layer = 2
l.effect = "Infade_Fx"
subs.append(l)
for start_t, end_t, i, n in frames(line.start_time + syl.start_time+modt-20, end_t, 21.72 ) do
l.start_time = start_t
l.end_time = end_t
l.text = string.format("{\\an5"..c2.."\\be2\\bord1.5\\shad0\\t(\\fscx140\\fscy140)\\pos(%.3f,%.3f)}",x+math.random(-3,3), y+math.random(-3,3) ) .. chars.text
l.layer=5
l.effect = "text_shake"
subs.append(l)
end
for start_t, end_t, i, n in frames(line.start_time + syl.start_time+modt-20, end_t, 21.72 ) do
l.start_time = start_t
l.end_time = end_t
l.text = string.format("{\\an5"..c2.."\\fad(%d,%d)\\be1\\1a&HFF&\\bord2\\fscx110\\fscy110\\shad0\\t(\\fscx160\\fscy160)\\pos(%.3f,%.3f)}",
math.random(20,40),math.random(30,60),x+math.random(-3,3), y+math.random(-3,3) ) .. chars.text
l.layer=5
l.effect = "text_shake_bord"
subs.append(l)
end
end
if syl.duration <= 75 then
modt=modt+100/(text_length*2)
elseif syl.duration <= 100 then
modt=modt+250/(text_length*2)
elseif syl.duration <= 250 then
modt=modt+500/(text_length*2)
elseif syl.duration <= 1100 then
modt=modt+700/(text_length*2)
elseif syl.duration < 2000 then
modt=modt+800/(text_length*2)
elseif syl.duration >= 3000 then
modt=modt+1100/(text_length*2)
else
modt=modt+1200/(text_length*2)
end
modt=modt+syl.duration/10
pos_enter=pos_enter+char_t
end
end
end
aegisub.register_macro(script_name, script_description, Fx_Dragon)
复制代码
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2