TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
[Seek] 罪恶王冠 Guilty Crown OP2
[打印本页]
作者:
Seekladoom
时间:
2021-7-16 02:18:26
标题:
[Seek] 罪恶王冠 Guilty Crown OP2
本帖最后由 Seekladoom 于 2021-7-18 23:45 编辑
最近复习了一下TCAX的用法,用夏天前辈分享的代码(
[附加效果] ext_fluf002
)改了下配合彗星体中日匹配做了罪恶王冠OP2的特效,太久没人做动画这块的科幻风歌词特效了。。。_(:з」∠)_
另外这六边形代码我暂时还没找到精简的方法,做两段效果时复制粘贴了一次,不知道有没有方法只留一段六边形代码然后跨行给多个ass_main行使用(找到方法了我还会再改的)。。。_(:з」∠)_
内附ass、py、tcc文件以及字体文件的下载链接:
[Seek] 罪恶王冠 Guilty Crown OP2.rar
(0 Bytes, 下载次数: 2799)
2021-7-18 23:45:44 上传
下载次数: 2799
在线预览:
【歌词特效】罪恶王冠 OP2
注:以后我自己写的中日双语特效,tcc文件中的字体名称一律使用Sarasa Gothic J Semibold(更纱黑体日文版的Semibold字重),这个字体的字数足够多(换成微软雅黑、黑体、楷体、平方等字数在27000以上的字体也行,没有的话就把字体装上。),因此可以确保TCAX运行时不会因为TCC中的日文或中文字体缺字而无法正常运行,具体的中日字体名称修改可以放到py脚本中去修改即可,就像下面这样:
fn('FOT-Comet Std B')
fn('MZhiHei PRC UltraBold')
复制代码
如此一来也算是让TCAX在字体上挣脱了必须在TCC文件中修改字体名称且只能用英文名称的限制了。
单段特效:红色文字和六边形
from tcaxPy import *
def tcaxPy_Init():
global _FD # frame duration, in millisecond
global _Blur, _Bord
global _FS
_FD = 1000 / GetVal(val_FXFPS)
_Blur = GetVal(val_Blur)
_Bord = GetVal(val_Bord)
_FS = GetVal(val_FontSize)
def tcaxPy_Fin():
pass
def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):
ASS_BUF = [] # used for saving ASS FX lines
# ----------OPJP----------
if _i < 12:
ass_main(ASS_BUF, SubL(_start+_j*3-20,_start+_elapk,1,'OPJP'), pos(_x,_y)+color1('1F20EF')+color3('FFFFFF')+b(1)+blur(4)+fad(200,0)+fn('FOT-Comet Std B'), _txt) #入场特效 - start2syl
ass_main(ASS_BUF, SubL(_start+_elapk,_start+_elapk+_k,1,'OPJP'), pos(_x,_y)+color1('1F20EF')+color3('FFFFFF')+t(color1('FFFFFF')+color3('1F20EF'))+b(1)+blur(4)+fn('FOT-Comet Std B'), _txt) #卡拉OK特效 - syl
ass_main(ASS_BUF, SubL(_start+_elapk+_k,_end-(_n-_j-1)*3+20,1,'OPJP'), pos(_x,_y)+color1('FFFFFF')+color3('1F20EF')+b(1)+blur(4)+fad(0,200)+fn('FOT-Comet Std B'), _txt) #退场特效 - syl2end
hexagon = 'm -6 -10 l 6 -10 l 12 0 l 6 10 l -6 10 l -12 0 l -6 -10 '
clist = []
able = []
f = 10
zoom1 = 45
zoom2 = 52
initx = int(GetVal(5) // 2 - _n / 2 * _FS - 55)
lastx = int(GetVal(5) // 2 + _n / 2 * _FS + 55)
inity = int(_y - _FS)
for x in range(initx - f * 1 , lastx + _a + f * 2, f * 2):
for y in range(inity - f * 0, _y + _FS + f * 1, f):
clist.append((x, y))
for x in range(initx - f * 2 , lastx + _a + f * 1, f * 2):
for y in range(inity - f // 2 - f * 0, _y + _FS - f // 2 + f * 1, f):
clist.append((x, y))
for (px, py) in clist:
if (px - _x) ** 2 + (py - _y) ** 2 <= 30 ** 2:
able.append((px, py))
count = int(_k * 1.6)
for i in range(count):
pt = choice(able)
px = pt[0]
py = pt[1]
st = randint(_start + _elapk - 10, _start + _elapk + _k)
et = st + randint(55, 75)
if st >= _start + _elapk + _k - 5:
et = st + randint(70, 100)
dur = et - st - 10
transp = 50
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP'), pos(px, py+10) + color3('FFFFFF') + color1('1F20EF') + alpha1(255) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom1, zoom1), r'{\\p1}'+ hexagon +'{\\p0}')
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP'), pos(px, py+10) + color3('FFFFFF') + color1('1F20EF') + alpha1(100) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom2, zoom2), r'{\\p1}'+ hexagon +'{\\p0}')
# ----------OPCN----------
if _i > 11:
ass_main(ASS_BUF, SubL(_start+_j*3-20,_end-(_n-_j-1)*3+20,1,'OPCN'), pos(_x,_y+993)+color1('FFFFFF')+color3('1F20EF')+blur(4)+fad(200,200)+fax(-0.11)+fn('MZhiHei PRC UltraBold')+fs(66)+fscx(85)+'\\fsp11', _txt) #整体特效 - line
return (ASS_BUF, None)
复制代码
两段特效:红色文字和六边形+蓝色文字和六边形
写法1:直接复制粘贴
from tcaxPy import *
def tcaxPy_Init():
global _FD # frame duration, in millisecond
global _Blur, _Bord
global _FS
_FD = 1000 / GetVal(val_FXFPS)
_Blur = GetVal(val_Blur)
_Bord = GetVal(val_Bord)
_FS = GetVal(val_FontSize)
def tcaxPy_Fin():
pass
def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):
ASS_BUF = [] # used for saving ASS FX lines
# ----------OPJP----------
if _i < 6:
ass_main(ASS_BUF, SubL(_start+_j*3-20,_start+_elapk,1,'OPJP'), pos(_x,_y)+color1('1F20EF')+color3('FFFFFF')+b(1)+blur(4)+fad(200,0)+fn('FOT-Comet Std B'), _txt) #入场特效 - start2syl
ass_main(ASS_BUF, SubL(_start+_elapk,_start+_elapk+_k,1,'OPJP'), pos(_x,_y)+color1('1F20EF')+color3('FFFFFF')+t(color1('FFFFFF')+color3('1F20EF'))+b(1)+blur(4)+fn('FOT-Comet Std B'), _txt) #卡拉OK特效 - syl
ass_main(ASS_BUF, SubL(_start+_elapk+_k,_end-(_n-_j-1)*3+20,1,'OPJP'), pos(_x,_y)+color1('FFFFFF')+color3('1F20EF')+b(1)+blur(4)+fad(0,200)+fn('FOT-Comet Std B'), _txt) #退场特效 - syl2end
hexagon = 'm -6 -10 l 6 -10 l 12 0 l 6 10 l -6 10 l -12 0 l -6 -10 '
clist = []
able = []
f = 10
zoom1 = 45
zoom2 = 52
initx = int(GetVal(5) // 2 - _n / 2 * _FS - 55)
lastx = int(GetVal(5) // 2 + _n / 2 * _FS + 55)
inity = int(_y - _FS)
for x in range(initx - f * 1 , lastx + _a + f * 2, f * 2):
for y in range(inity - f * 0, _y + _FS + f * 1, f):
clist.append((x, y))
for x in range(initx - f * 2 , lastx + _a + f * 1, f * 2):
for y in range(inity - f // 2 - f * 0, _y + _FS - f // 2 + f * 1, f):
clist.append((x, y))
for (px, py) in clist:
if (px - _x) ** 2 + (py - _y) ** 2 <= 30 ** 2:
able.append((px, py))
count = int(_k * 1.6)
for i in range(count):
pt = choice(able)
px = pt[0]
py = pt[1]
st = randint(_start + _elapk - 10, _start + _elapk + _k)
et = st + randint(55, 75)
if st >= _start + _elapk + _k - 5:
et = st + randint(70, 100)
dur = et - st - 10
transp = 50
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP'), pos(px, py+10) + color3('FFFFFF') + color1('1F20EF') + alpha1(255) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom1, zoom1), r'{\\p1}'+ hexagon +'{\\p0}')
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP'), pos(px, py+10) + color3('FFFFFF') + color1('1F20EF') + alpha1(100) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom2, zoom2), r'{\\p1}'+ hexagon +'{\\p0}')
# ----------OPJP2----------
if _i > 5 and _i < 12:
ass_main(ASS_BUF, SubL(_start+_j*3-20,_start+_elapk,1,'OPJP2'), pos(_x,_y)+color1('FFBC11')+color3('FFFFFF')+b(1)+blur(4)+fad(200,0)+fn('FOT-Comet Std B'), _txt) #入场特效 - start2syl
ass_main(ASS_BUF, SubL(_start+_elapk,_start+_elapk+_k,1,'OPJP2'), pos(_x,_y)+color1('FFBC11')+color3('FFFFFF')+t(color1('FFFFFF')+color3('FFBC11'))+b(1)+blur(4)+fn('FOT-Comet Std B'), _txt) #卡拉OK特效 - syl
ass_main(ASS_BUF, SubL(_start+_elapk+_k,_end-(_n-_j-1)*3+20,1,'OPJP2'), pos(_x,_y)+color1('FFFFFF')+color3('FFBC11')+b(1)+blur(4)+fad(0,200)+fn('FOT-Comet Std B'), _txt)
hexagon = 'm -6 -10 l 6 -10 l 12 0 l 6 10 l -6 10 l -12 0 l -6 -10 '
clist = []
able = []
f = 10
zoom1 = 45
zoom2 = 52
initx = int(GetVal(5) // 2 - _n / 2 * _FS - 55)
lastx = int(GetVal(5) // 2 + _n / 2 * _FS + 55)
inity = int(_y - _FS)
for x in range(initx - f * 1 , lastx + _a + f * 2, f * 2):
for y in range(inity - f * 0, _y + _FS + f * 1, f):
clist.append((x, y))
for x in range(initx - f * 2 , lastx + _a + f * 1, f * 2):
for y in range(inity - f // 2 - f * 0, _y + _FS - f // 2 + f * 1, f):
clist.append((x, y))
for (px, py) in clist:
if (px - _x) ** 2 + (py - _y) ** 2 <= 30 ** 2:
able.append((px, py))
count = int(_k * 1.6)
for i in range(count):
pt = choice(able)
px = pt[0]
py = pt[1]
st = randint(_start + _elapk - 10, _start + _elapk + _k)
et = st + randint(55, 75)
if st >= _start + _elapk + _k - 5:
et = st + randint(70, 100)
dur = et - st - 10
transp = 50
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP2'), pos(px, py+10) + color3('FFFFFF') + color1('FFBC11') + alpha1(255) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom1, zoom1), r'{\\p1}'+ hexagon +'{\\p0}')
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP2'), pos(px, py+10) + color3('FFFFFF') + color1('FFBC11') + alpha1(100) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom2, zoom2), r'{\\p1}'+ hexagon +'{\\p0}')
# ----------OPCN----------
if _i > 11 and _i < 18:
ass_main(ASS_BUF, SubL(_start+_j*3-20,_end-(_n-_j-1)*3+20,1,'OPCN'), pos(_x,_y+993)+color1('FFFFFF')+color3('1F20EF')+blur(4)+fad(200,200)+fax(-0.11)+fn('MZhiHei PRC UltraBold')+fs(66)+fscx(85)+'\\fsp11', _txt) #整体特效 - line
# ----------OPCN2----------
if _i > 17:
ass_main(ASS_BUF, SubL(_start+_j*3-20,_end-(_n-_j-1)*3+20,1,'OPCN2'), pos(_x,_y+993)+color1('FFFFFF')+color3('FFBC11')+blur(4)+fad(200,200)+fax(-0.11)+fn('MZhiHei PRC UltraBold')+fs(66)+fscx(85)+'\\fsp11', _txt) #整体特效 - line
return (ASS_BUF, None)
复制代码
写法2:
为节省代码行数,把绘图代码的if代码块写进for循环
from tcaxPy import *
def tcaxPy_Init():
global _FD # frame duration, in millisecond
global _Blur, _Bord
global _FS
_FD = 1000 / GetVal(val_FXFPS)
_Blur = GetVal(val_Blur)
_Bord = GetVal(val_Bord)
_FS = GetVal(val_FontSize)
def tcaxPy_Fin():
pass
def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):
ASS_BUF = [] # used for saving ASS FX lines
# ----------tcax line----------
hexagon = 'm -6 -10 l 6 -10 l 12 0 l 6 10 l -6 10 l -12 0 l -6 -10 '
hlist = []
able = []
f = 10
zoom1 = 45
zoom2 = 52
initx = int(GetVal(5) // 2 - _n / 2 * _FS - 55)
lastx = int(GetVal(5) // 2 + _n / 2 * _FS + 55)
inity = int(_y - _FS)
for x in range(initx - f * 1 , lastx + _a + f * 2, f * 2):
for y in range(inity - f * 0, _y + _FS + f * 1, f):
hlist.append((x, y))
for x in range(initx - f * 2 , lastx + _a + f * 1, f * 2):
for y in range(inity - f // 2 - f * 0, _y + _FS - f // 2 + f * 1, f):
hlist.append((x, y))
for (px, py) in hlist:
if (px - _x) ** 2 + (py - _y) ** 2 <= 30 ** 2:
able.append((px, py))
count = int(_k * 1.6)
for i in range(count):
pt = choice(able)
px = pt[0]
py = pt[1]
st = randint(_start + _elapk - 10, _start + _elapk + _k)
et = st + randint(55, 75)
if st >= _start + _elapk + _k - 5:
et = st + randint(70, 100)
dur = et - st - 10
transp = 50
# ----------绘图代码行----------
if _i < 6:#OPJP
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP'), pos(px, py+10) + color3('FFFFFF') + color1('1F20EF') + alpha1(255) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom1, zoom1) + p(1), hexagon)
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP'), pos(px, py+10) + color3('FFFFFF') + color1('1F20EF') + alpha1(100) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom2, zoom2) + p(1), hexagon)
if _i > 5 and _i < 12:#OPJP2
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP2'), pos(px, py+10) + color3('FFFFFF') + color1('FFBC11') + alpha1(255) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom1, zoom1) + p(1), hexagon)
ass_main(ASS_BUF, SubL(st, et, 0, 'OPJP2'), pos(px, py+10) + color3('FFFFFF') + color1('FFBC11') + alpha1(100) + alpha3(transp) + bord(1) + fad(100, dur * 10) + fsc(zoom2, zoom2) + p(1), hexagon)
# ----------文本行----------
if _i < 6:#OPJP
ass_main(ASS_BUF, SubL(_start+_j*3-20,_start+_elapk,1,'OPJP'), pos(_x,_y)+color1('1F20EF')+color3('FFFFFF')+b(1)+blur(4)+fad(200,0)+fn('FOT-Comet Std B'), _txt) #入场特效 - start2syl
ass_main(ASS_BUF, SubL(_start+_elapk,_start+_elapk+_k,1,'OPJP'), pos(_x,_y)+color1('1F20EF')+color3('FFFFFF')+t(color1('FFFFFF')+color3('1F20EF'))+b(1)+blur(4)+fn('FOT-Comet Std B'), _txt) #卡拉OK特效 - syl
ass_main(ASS_BUF, SubL(_start+_elapk+_k,_end-(_n-_j-1)*3+20,1,'OPJP'), pos(_x,_y)+color1('FFFFFF')+color3('1F20EF')+b(1)+blur(4)+fad(0,200)+fn('FOT-Comet Std B'), _txt) #退场特效 - syl2end
if _i > 5 and _i < 12:#OPJP2
ass_main(ASS_BUF, SubL(_start+_j*3-20,_start+_elapk,1,'OPJP2'), pos(_x,_y)+color1('FFBC11')+color3('FFFFFF')+b(1)+blur(4)+fad(200,0)+fn('FOT-Comet Std B'), _txt) #入场特效 - start2syl
ass_main(ASS_BUF, SubL(_start+_elapk,_start+_elapk+_k,1,'OPJP2'), pos(_x,_y)+color1('FFBC11')+color3('FFFFFF')+t(color1('FFFFFF')+color3('FFBC11'))+b(1)+blur(4)+fn('FOT-Comet Std B'), _txt) #卡拉OK特效 - syl
ass_main(ASS_BUF, SubL(_start+_elapk+_k,_end-(_n-_j-1)*3+20,1,'OPJP2'), pos(_x,_y)+color1('FFFFFF')+color3('FFBC11')+b(1)+blur(4)+fad(0,200)+fn('FOT-Comet Std B'), _txt) #退场特效 - syl2end
if _i > 11 and _i < 18:#OPCN
ass_main(ASS_BUF, SubL(_start+_j*3-20,_end-(_n-_j-1)*3+20,1,'OPCN'), pos(_x,_y+993)+color1('FFFFFF')+color3('1F20EF')+blur(4)+fad(200,200)+fax(-0.11)+fn('MZhiHei PRC UltraBold')+fs(66)+fscx(85)+'\\fsp11', _txt) #整体特效 - line
if _i > 17:#OPCN2
ass_main(ASS_BUF, SubL(_start+_j*3-20,_end-(_n-_j-1)*3+20,1,'OPCN2'), pos(_x,_y+993)+color1('FFFFFF')+color3('FFBC11')+blur(4)+fad(200,200)+fax(-0.11)+fn('MZhiHei PRC UltraBold')+fs(66)+fscx(85)+'\\fsp11', _txt) #整体特效 - line
return (ASS_BUF, None)
复制代码
附件:
[Seek] 罪恶王冠 Guilty Crown OP2.rar
(2021-7-18 23:45:44, 0 Bytes) / 下载次数 2799
http://tcax.org/forum.php?mod=attachment&aid=MjcxMXw3YzA5OTk1ZXwxNzMyMjUwMDU4fDB8MA%3D%3D
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2