|
|
這裡以aegisub工具的代碼為例,其他先不討論,代碼為2001的clip粒子代碼。- code syl all,function char_counter(ref) ci[ref] = ci[ref] + 1; return "" end
- code line all,ci = { 0 }; cn = _G.unicode.len(orgline.text_stripped:gsub(" ",""))
- code once,math.randomseed(8317)
- code once,temp = {}
- code once,function set_temp(ref,val) temp[ref] = val; return val; end
複製代碼 這裡是Lua特效腳本,為後面特效使用。和設置ci,用以計算音節數,Ci是用於計算字幕行的單字個數;
template char loop 8,!retime("postline",-$syln*100+syl.i*100,-$syln*100+syl.i*100+1500)!{\fad(0,300)\blur1.8\an5\move($center,$middle,!$center+set_temp("xpos",math.random(300,600)-$dur*0.1)!,!$middle+set_temp("ypos",math.random(-70,-10))!,!set_temp("time",math.random(0,500))!,1500)\clip(!$left+(j-1)*5!,$top,!$left+j*5!,!$top+5!)\t(!temp.time!,1500,\clip(!$left+temp.xpos+(j-1)*5!,!$top+temp.ypos!,!$left+temp.xpos+j*5!,!$top+temp.ypos+5!))}
這個是粒子效果的重點,以其中一行loop為例,加註釋:
!retime("postline",-$syln*100+syl.i*100,-$syln*100+syl.i*100+1500)!
”postline”為retime語句裡的一種模式,效果為在一行Karaoke字幕結束後加入特效時間。
為開始校正時間,syln為字幕的字節數,i 為字節的個數符號,
-$syln*100+syl.i*100+1500
為校正結束時間。
\move($center,$middle,!$center+set_temp("xpos",math.random(300,600)-$dur*0.1)!
此為定義為字符的運動軌跡,set_temp 在此處定義了”xpos”,並儲存了各字符的運動軌跡。
\clip(!$left+(j-1)*5!,$top,!$left+j*5!,!$top+5!)
定義變化前的支解範圍
\t(!temp.time!,1500,\clip(!$left+temp.xpos+(j-1)*5!,!$top+temp.ypos!,!$left+temp.xpos+j*5!,!$top+temp.ypos+5!))
這個是使clip的效果隨字符一起移動,j為所處的循環次數。
|
|