TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
[youkaze]004_Natsume Yuujinchou ShiOP
[打印本页]
作者:
四月一日 君寻
时间:
2012-2-23 22:10:17
标题:
[youkaze]004_Natsume Yuujinchou ShiOP
本帖最后由 七海の游风 于 2012-2-24 10:43 编辑
from tcaxPy import *
def tcaxPy_Init():
global _FontFileName
global _FaceID
global _Fs
global _Height
global Font
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Fs = GetVal(val_FontSize)
_Height = GetVal(val_TextHeight)
Font = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
def tcaxPy_Fin():
FinFont(Font)
def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT,):
ASS_BUF = []
COLOR=[ "C9F2DC", "C9F2DC","C9F2DC","C9F2DC","C9F2DC","A5BDED","C9F2DC" ]
COLOR1=color1(COLOR[randint(0,6)])
dx = _X - int(_A / 2 + 0.5)
dy = _Y - int(_Fs / 2 + 0.5)
mask = TextOutlineDraw(Font, _TXT, dx, dy)
global _H
_H = GetVal(val_FontSize) #字体大小
_7X = _X - int(_A / 2 + 0.5) # 第i句卡拉OK歌词的j个字符的左上角X轴坐标
_7Y = _Y - int(_H / 2 + 0.5) # 第i句卡拉OK歌词的j个字符的左上角Y轴坐标
if _i == 7 and _TXT == 'と':
sb1=""
for i in range (0,30):
a = -0.15+0.01*i
l = (pow((abs(a)/0.15),0.3)+0.5)*60*8
sb1= sb1 + "m 0 0 l"+" "+str(int(l*cos(a)))+" "+str(int(l*sin(a)))+" 0 1 c "
sb2 = ""
for j in range (0,30):
a = -0.15+0.01*j
l = (pow((abs(a)/0.15),0.3)+0.5)*20*8
sb2 = sb2 +"m 0 0 l"+" "+str(int(l*cos(a)))+" "+str(int(l*sin(a)))+" 0 1 c "
tStep = 2
for ptt0 in range(_BT+_SK - 10,_BT+_SK+_KT,tStep):
startag = randint(0, 359)
endag = startag + randint(0,9)/10 * randint(50, 100)
ass_main(ASS_BUF, SubL(ptt0,ptt0 + 100), an(7)+pos(_X,_Y)+fad(300, 300)+alpha1(0)+be(1)+shad(0)+bord(0)+color1("A5BDED")+ frz(startag) + t1(0,1000,frz(endag)),"{\p4}"+sb1)
ass_main(ASS_BUF, SubL(ptt0,ptt0 + 100), an(7)+pos(_X,_Y)+fad(300, 300)+alpha1(17)+be(1)+shad(0)+bord(0)+color1("FFFFFF")+ frz(startag) + t1(0,1000,frz(endag)),"{\p4}"+sb2)
if _i > 3:
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT), pos(_X-0.3,_Y-0.2)+blur(2)+bord(2)+ alpha3(0)+ alpha1(255)+color3('FFFFFF')+fs(35)+t(fs(60))+fad(100,200), _TXT)
ass_main(ASS_BUF, SubL(_BT+(_j+1)*5,_BT+_SK),pos(_X-0.3,_Y-0.2)+bord(1.5)+alpha1(180)+alpha3(100), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT),pos(_X-0.3,_Y-0.2)+bord(1.5)+alpha1(180)+alpha3(100)+color3('2E2E2E')+t(alpha3(70)+color3('000000')), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET,10),pos(_X-0.3,_Y-0.2)+bord(1.5)+alpha1(0)+alpha3(0)+COLOR1, _TXT)
for i in range(0,_A,5):
for j in range(0,_H,5):
Xx = 40+randint(-20,20)
Yy = randint(-20,20)
CLIP1 = clip(_7X+i+Xx,_7Y+j+Yy,_7X+i+5+Xx,_7Y+j+5+Yy)+t(clip(_7X+i,_7Y+j,_7X+i+5,_7Y+j+5))
CLIP2 = clip(_7X+i,_7Y+j,_7X+i+5,_7Y+j+5)
MOVE = move(_X-0.3+Xx,_Y-0.2+Yy,_X-0.3,_Y-0.2)
POS = pos(_X-0.3,_Y-0.2)
ass_main(ASS_BUF, SubL(_BT-40-8+_j*5+randint(-10,10),_BT+(_j+1)*5),CLIP1+MOVE+bord(1.5)+alpha1(180)+alpha3(100)+fad(200,0), _TXT)
ass_main(ASS_BUF, SubL(_ET,_ET+10-8+_j*5+randint(-10,10)),CLIP2+POS+bord(1.5)+alpha1(0)+alpha3(00)+COLOR1+fad(0,50), _TXT)
if _i > -1 and _i < 4:
EFT = alpha1(255) + color3('FFFFFF') + alpha3(0) +bord(0) + t(bord(2) + blur(5))
ass_main(ASS_BUF, SubL(_BT+_SK-10,_BT+_SK+_KT/2),pos(_X-0.3,_Y-0.2) + EFT, _TXT)
EFT = alpha1(255) + color3('FFFFFF') + alpha3(0) +bord(2) + blur(5) + t(bord(0) + blur(0) + alpha3(255))
ass_main(ASS_BUF, SubL(_BT+_SK+_KT/2,_BT+_SK+_KT),pos(_X-0.3,_Y-0.2) + EFT, _TXT)
if _i == 7 and _TXT == 'と':
for i in range(_BT+_SK,_BT+_SK+_KT,10):
ass_main(ASS_BUF, SubL(i,i+10), pos(_X-0.3,_Y-0.2)+blur(2)+shad(0)+bord(2)+ alpha3(0)+ alpha1(0)+color1("FFFFFF")+ color3('FFFFFF')+fad(10,50), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK-20, _BT+_SK+_KT),an(5) + pos(_X+randint(-15,15), _Y+randint(-15,15)) + COLOR1 + bord(0)+blur(4)+ alpha1(0)+fs(1)+t(0,_KT*10,fs(100)) + clip2(7, mask), "●")
return (ASS_BUF, None)
复制代码
115下载预览:
http://115.com/file/c24q13q4
作者:
Seekladoom
时间:
2022-2-2 11:04:41
本帖最后由 Seekladoom 于 2022-2-2 20:32 编辑
先附上拆分简化后的附件,字幕脚本分辨率已经改成1920×1080了:
【夏目友人帐 第4季 OP 1080P化】TCAX Karaoke Effect 315-317.rar
(153.34 KB, 下载次数: 2148)
2022-2-2 19:49:44 上传
下载次数: 2148
原来可以这样弄啊,
单独闪耀的”
と
“:
if _i == 7 and _TXT == 'と':
复制代码
入场和退场特效的代码来源于如下链接:
[SAI]025_no6OP
旋转光线特效的来源:
[SAI]012_nurarihyonnomakoOP2
【旋转光线】夏目友人帐 第4季 OP.rar
(0 Bytes, 下载次数: 2162)
2022-2-2 19:45:07 上传
下载次数: 2162
旋转光线代码:
from tcaxPy import *
def tcaxPy_Init():
global _FontFileName
global _FaceID
global _Fs
global Font
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Fs = GetVal(val_FontSize)
Font = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
ASS_BUF = []
DY = _Y - 13
_7X = _X - int(_A / 2 + 0.5) # 第i句卡拉OK歌词的j个字符的左上角X轴坐标
_7Y = DY - int(_Fs / 2 + 0.5) # 第i句卡拉OK歌词的j个字符的左上角Y轴坐标
COLOR=[ 'C9F2DC', 'C9F2DC','C9F2DC','C9F2DC','C9F2DC','A5BDED','C9F2DC' ]
COLOR1=color1(COLOR[randint(0,6)])
dx = _X - int(_A / 2 + 0.5)
dy = DY - int(_Fs / 2 + 0.5)
mask = TextOutlineDraw(Font, _TXT, dx, dy)
#全行通用区
ass_main(ASS_BUF, SubL(_BT+(_j+1)*5,_BT+_SK),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(180)+alpha3(100), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(180)+alpha3(100)+color3('2E2E2E')+t(alpha3(70)+color3('000000')), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET,10),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(0)+alpha3(0)+COLOR1, _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK-20, _BT+_SK+_KT),an(5) + pos(_X+randint(-15,15), DY+randint(-15,15)) + COLOR1 + bord(0) + blur(4) + alpha1(0) + fs(1) + t(0,_KT*10,fs(100)) + clip2(7, mask), "●")
for i in range(0,_A,5):
for j in range(0,_Fs,5):
Xx = 40+randint(-20,20)
Yy = randint(-20,20)
CLIP1 = clip(_7X+i+Xx,_7Y+j+Yy,_7X+i+5+Xx,_7Y+j+5+Yy)+t(clip(_7X+i,_7Y+j,_7X+i+5,_7Y+j+5))
CLIP2 = clip(_7X+i,_7Y+j,_7X+i+5,_7Y+j+5)
MOVE = move(_X-0.3+Xx,DY-0.2+Yy,_X-0.3,DY-0.2)
POS = pos(_X-0.3,DY-0.2)
ass_main(ASS_BUF, SubL(_BT-40-8+_j*5+randint(-10,10),_BT+(_j+1)*5),CLIP1+MOVE+bord(2.3)+alpha1(180)+alpha3(100)+fad(200,0), _TXT)
ass_main(ASS_BUF, SubL(_ET,_ET+10-8+_j*5+randint(-10,10)),CLIP2+POS+bord(2.3)+alpha1(0)+alpha3(00)+COLOR1+fad(0,50), _TXT)
#白边透明文字变大
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT), pos(_X-0.3,DY-0.2)+blur(2)+bord(3)+ alpha3(0)+ alpha1(255)+color3('FFFFFF')+fs(53)+t(fs(90))+fad(100,200), _TXT)
#旋转光线
sb1=""
for i in range (0,30):
a = -0.15+0.01*i
l = (pow((abs(a)/0.15),0.3)+0.5)*60*8
sb1= sb1 + "m 0 0 l"+" "+str(int(l*cos(a)))+" "+str(int(l*sin(a)))+" 0 1 c "
sb2 = ""
for j in range (0,30):
a = -0.15+0.01*j
l = (pow((abs(a)/0.15),0.3)+0.5)*20*8
sb2 = sb2 +"m 0 0 l"+" "+str(int(l*cos(a)))+" "+str(int(l*sin(a)))+" 0 1 c "
tStep = 2
for ptt0 in range(_BT+_SK - 10,_BT+_SK+_KT,tStep):
startag = randint(0, 359)
endag = startag + randint(0,9)/10 * randint(50, 100)
ass_main(ASS_BUF, SubL(ptt0,ptt0 + 100), an(7)+pos(_X,DY)+fad(300, 300)+alpha1(0)+be(1)+shad(0)+bord(0)+color1("A5BDED")+ frz(startag) + t1(0,1000,frz(endag)),"{\p4}"+sb1)
ass_main(ASS_BUF, SubL(ptt0,ptt0 + 100), an(7)+pos(_X,DY)+fad(300, 300)+alpha1(17)+be(1)+shad(0)+bord(0)+color1("FFFFFF")+ frz(startag) + t1(0,1000,frz(endag)),"{\p4}"+sb2)
#频闪文字
for i in range(_BT+_SK,_BT+_SK+_KT,10):
ass_main(ASS_BUF, SubL(i,i+10), pos(_X-0.3,DY-0.2)+blur(2)+shad(0)+bord(3)+ alpha3(0)+ alpha1(0)+color1("FFFFFF")+ color3('FFFFFF')+fad(10,50), _TXT)
return (ASS_BUF, None)
复制代码
附件:
【旋转光线】夏目友人帐 第4季 OP.rar
(2022-2-2 19:45:07, 0 Bytes) / 下载次数 2162
http://tcax.org/forum.php?mod=attachment&aid=Mjg3NnwwNmQwZDNjNnwxNzMyMjMxMzcyfDB8MA%3D%3D
附件:
【夏目友人帐 第4季 OP 1080P化】TCAX Karaoke Effect 315-317.rar
(2022-2-2 19:49:44, 153.34 KB) / 下载次数 2148
http://tcax.org/forum.php?mod=attachment&aid=Mjg3OXxkNjFiMTNjYnwxNzMyMjMxMzcyfDB8MA%3D%3D
作者:
Seekladoom
时间:
2022-2-2 20:04:27
本帖最后由 Seekladoom 于 2022-2-2 20:22 编辑
[youkaze]004 Natsume Yuujinchou Shi OP.py
(4.28 KB, 下载次数: 2191)
2022-2-2 20:21:58 上传
下载次数: 2191
整理了下楼主的代码排列顺序并添加注释,方便理解:
from tcaxPy import *
def tcaxPy_Init():
global _FontFileName
global _FaceID
global _Fs
global Font
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Fs = GetVal(val_FontSize)
Font = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
def tcaxPy_Fin():
FinFont(Font)
def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT,):
ASS_BUF = []
#一些变量
DY = _Y - 13
_7X = _X - int(_A / 2 + 0.5) # 第i句卡拉OK歌词的j个字符的左上角X轴坐标
_7Y = DY - int(_Fs / 2 + 0.5) # 第i句卡拉OK歌词的j个字符的左上角Y轴坐标
COLOR=[ "C9F2DC", "C9F2DC","C9F2DC","C9F2DC","C9F2DC","A5BDED","C9F2DC" ]
COLOR1=color1(COLOR[randint(0,6)])
dx = _X - int(_A / 2 + 0.5)
dy = DY - int(_Fs / 2 + 0.5)
mask = TextOutlineDraw(Font, _TXT, dx, dy)
#----------全行通用区----------
#随机绿字、红字
ass_main(ASS_BUF, SubL(_BT+(_j+1)*5,_BT+_SK),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(180)+alpha3(100), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(180)+alpha3(100)+color3('2E2E2E')+t(alpha3(70)+color3('000000')), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET,10),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(0)+alpha3(0)+COLOR1, _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK-20, _BT+_SK+_KT),an(5) + pos(_X+randint(-15,15), DY+randint(-15,15)) + COLOR1 + bord(0)+blur(4)+ alpha1(0)+fs(1)+t(0,_KT*10,fs(100)) + clip2(7, mask), "●")
#伪像素化文字切割
for i in range(0,_A,5):
for j in range(0,_Fs,5):
Xx = 40+randint(-20,20)
Yy = randint(-20,20)
CLIP1 = clip(_7X+i+Xx,_7Y+j+Yy,_7X+i+5+Xx,_7Y+j+5+Yy)+t(clip(_7X+i,_7Y+j,_7X+i+5,_7Y+j+5))
CLIP2 = clip(_7X+i,_7Y+j,_7X+i+5,_7Y+j+5)
MOVE = move(_X-0.3+Xx,DY-0.2+Yy,_X-0.3,DY-0.2)
POS = pos(_X-0.3,DY-0.2)
ass_main(ASS_BUF, SubL(_BT-40-8+_j*5+randint(-10,10),_BT+(_j+1)*5),CLIP1+MOVE+bord(2.3)+alpha1(180)+alpha3(100)+fad(200,0), _TXT)
ass_main(ASS_BUF, SubL(_ET,_ET+10-8+_j*5+randint(-10,10)),CLIP2+POS+bord(2.3)+alpha1(0)+alpha3(00)+COLOR1+fad(0,50), _TXT)
#----------分行判断区----------
#白边发光文字
if _i > -1 and _i < 4:
EFT = alpha1(255) + color3('FFFFFF') + alpha3(0) +bord(0) + t(bord(3) + blur(5))
ass_main(ASS_BUF, SubL(_BT+_SK-10,_BT+_SK+_KT/2),pos(_X-0.3,DY-0.2) + EFT, _TXT)
EFT = alpha1(255) + color3('FFFFFF') + alpha3(0) +bord(3) + blur(5) + t(bord(0) + blur(0) + alpha3(255))
ass_main(ASS_BUF, SubL(_BT+_SK+_KT/2,_BT+_SK+_KT),pos(_X-0.3,DY-0.2) + EFT, _TXT)
#白边透明文字变大
if _i > 3:
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT), pos(_X-0.3,DY-0.2)+blur(2)+bord(3)+ alpha3(0)+ alpha1(255)+color3('FFFFFF')+fs(53)+t(fs(90))+fad(100,200), _TXT)
#旋转光线
if _i == 7 and _TXT == 'と':
sb1=""
for i in range (0,30):
a = -0.15+0.01*i
l = (pow((abs(a)/0.15),0.3)+0.5)*60*8
sb1= sb1 + "m 0 0 l"+" "+str(int(l*cos(a)))+" "+str(int(l*sin(a)))+" 0 1 c "
sb2 = ""
for j in range (0,30):
a = -0.15+0.01*j
l = (pow((abs(a)/0.15),0.3)+0.5)*20*8
sb2 = sb2 +"m 0 0 l"+" "+str(int(l*cos(a)))+" "+str(int(l*sin(a)))+" 0 1 c "
tStep = 2
for ptt0 in range(_BT+_SK - 10,_BT+_SK+_KT,tStep):
startag = randint(0, 359)
endag = startag + randint(0,9)/10 * randint(50, 100)
ass_main(ASS_BUF, SubL(ptt0,ptt0 + 100), an(7)+pos(_X,DY)+fad(300, 300)+alpha1(0)+be(1)+shad(0)+bord(0)+color1("A5BDED")+ frz(startag) + t1(0,1000,frz(endag)),"{\p4}"+sb1)
ass_main(ASS_BUF, SubL(ptt0,ptt0 + 100), an(7)+pos(_X,DY)+fad(300, 300)+alpha1(17)+be(1)+shad(0)+bord(0)+color1("FFFFFF")+ frz(startag) + t1(0,1000,frz(endag)),"{\p4}"+sb2)
#频闪文字
if _i == 7 and _TXT == 'と':
for i in range(_BT+_SK,_BT+_SK+_KT,10):
ass_main(ASS_BUF, SubL(i,i+10), pos(_X-0.3,DY-0.2)+blur(2)+shad(0)+bord(3)+ alpha3(0)+ alpha1(0)+color1("FFFFFF")+ color3('FFFFFF')+fad(10,50), _TXT)
return (ASS_BUF, None)
复制代码
附件:
[youkaze]004 Natsume Yuujinchou Shi OP.py
(2022-2-2 20:21:58, 4.28 KB) / 下载次数 2191
http://tcax.org/forum.php?mod=attachment&aid=Mjg4MHw0NjAwMTFkN3wxNzMyMjMxMzcyfDB8MA%3D%3D
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2