TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
[youkaze]006_AnotherOP
[打印本页]
作者:
四月一日 君寻
时间:
2012-2-23 22:12:49
标题:
[youkaze]006_AnotherOP
本帖最后由 七海の游风 于 2012-2-24 11:00 编辑
from tcaxPy import *
def tcaxPy_Init():
global _FontFileName
global _FaceID
global _Fs
global _FD
global _Height
global _Font
global _FontSize
global pyFont
pyFont = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), GetVal(val_FontSize), GetVal(val_Spacing), GetVal(val_SpaceScale), 0x0000FF, 0, 0)
_FontSize = GetVal(val_FontSize)
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Fs = GetVal(val_FontSize)
_FD = 1000 / GetVal(val_FXFPS)
_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=[ "8BA8A4", "8B89A4","A48B93","7F96A6","527565","5F597E","9CB6B4","89A1AF","B08366","916A8A","292D69" ]
COLOR1=color1(COLOR[randint(0,10)])
dx = _X - int(_A / 2 + 0.5)
dy = _Y - int(_Fs / 2 + 0.5)
mask = TextOutlineDraw(_Font, _TXT, dx, dy)
if _i > -1 and _i <17:
ass_main(ASS_BUF, SubL(_BT-8+_j*5,_BT+(_j+1)*5),pos(_X-2,_Y+1)+bord(0)+fad(200,0)+alpha1(50)+color1('A09E9E')+blur(2), _TXT)
ass_main(ASS_BUF, SubL(_BT+(_j+1)*5,_BT+_SK),pos(_X-2,_Y+1)+bord(0)+alpha1(50)+color1('A09E9E')+blur(2), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT),pos(_X-2,_Y+1)+bord(0)+alpha1(50)+color1('A09E9E')+blur(2), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET+20-8+_j*5),pos(_X-2,_Y+1)+bord(0)+fad(0,200)+alpha1(50)+color1('A09E9E')+blur(2), _TXT)
if _i == 17:
ass_main(ASS_BUF, SubL(_BT-8+_j*5,_BT+(_j+1)*5),pos(_X-2,_Y+1)+bord(0)+alpha1(50)+color1('A09E9E')+blur(2), _TXT)
ass_main(ASS_BUF, SubL(_BT+(_j+1)*5,_BT+_SK),pos(_X-2,_Y+1)+bord(0)+alpha1(50)+color1('A09E9E')+blur(2), _TXT)
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT),pos(_X-2,_Y+1)+bord(0)+fad(0,200)+alpha1(50)+color1('A09E9E')+blur(2), _TXT)
R = randint(0,7)
t1 = _BT+_SK-20
t2 = _ET
_Bd = GetVal(val_Bord)
_Br = GetVal(val_Blur)
PIX = TextPix(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), DecRGB('0000FF'), 0, False, _TXT)
PIX = PixBlur(PIX, _Br)
if _i < 2:
R = randint(0,7)
t1 = _BT+_SK-20
t2 = _ET
InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0] # 第一个像素的X轴坐标
InitPosY = _Y - int(_Fs / 2 + 0.5) + PIX[0][1] # 第一个像素的Y轴坐标
for h in range(PIX[1][1]): # 开始纵向扫描
PosY = InitPosY + h
# 当前像素Y轴坐标
for w in range(PIX[1][0]): # 开始横向扫描
PosX = InitPosX + w
X = PosX-randint(-50,50)
Y = PosY-randint(-50,50) # 当前像素X轴坐标
idx = 4 * (h * PIX[1][0] + w) # 脚标
PixR = PIX[2][idx + 0] # 当前像素的红色分量
PixG = PIX[2][idx + 1] # 当前像素的绿色分量
PixB = PIX[2][idx + 2] # 当前像素的蓝色分量
PixA = PIX[2][idx + 3] # 当前像素的透明度
if PixA != 0: # 如果当前像素不为透明则进行如下操作
D = [-h,-w,-(PIX[1][1]-h),-(PIX[1][0]-w),-(PIX[1][1]-h+PIX[1][0]-w),-h-w,-(PIX[1][1]-h+PIX[1][0]+w),-(PIX[1][0]-w+PIX[1][1]-h)][R]
ass_main(ASS_BUF, SubL(_BT-8+_j*5+randint(-10,10),_BT+_SK,0,Pix_Style),pos(PosX, PosY)+bord(0)+fad(50,0)+color1('010076')+alpha(255-PixA), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,(t2+20)-D,0,Pix_Style),pos(PosX, PosY)+bord(0)+fad(0,200)+color1('010076')+alpha(255-PixA), PixPt())
C = randint(-1,1)
ass_main(ASS_BUF, SubL(_BT-8+_j*5+randint(-10,10),_BT+_SK,0,Pix_Style),pos(PosX+C, PosY+C)+bord(0)+fad(50,0)+color1('010076')+alpha(255-PixA), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,(t2+20)-D,0,Pix_Style),pos(PosX+C, PosY+C)+bord(0)+fad(0,200)+color1('010076')+alpha(255-PixA), PixPt())
if _i < 2:
InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0] # 第一个像素的X轴坐标
InitPosY = _Y - int(_Fs / 2 + 0.5) + PIX[0][1] # 第一个像素的Y轴坐标
for h in range(PIX[1][1]): # 开始纵向扫描
PosY = InitPosY + h
# 当前像素Y轴坐标
for w in range(PIX[1][0]): # 开始横向扫描
PosX = InitPosX + w
X = PosX-randint(-50,50)
Y = PosY-randint(-50,50) # 当前像素X轴坐标
idx = 4 * (h * PIX[1][0] + w) # 脚标
PixR = PIX[2][idx + 0] # 当前像素的红色分量
PixG = PIX[2][idx + 1] # 当前像素的绿色分量
PixB = PIX[2][idx + 2] # 当前像素的蓝色分量
PixA = PIX[2][idx + 3] # 当前像素的透明度
if PixA != 0: # 如果当前像素不为透明则进行如下操作
step = int(_FD/10)
for j in range(_BT+_SK,_BT+_SK+_KT,step):
R = randint(-3,3)
t = j
t1 = t + step
B = randint(-1,1)
POS = pos(PosX+B, PosY+B)
ass_main(ASS_BUF, SubL(t,t1,0,Pix_Style), POS+color1('010076')+alpha1(255 - PixA), PixPt())
if _i > 1 and _i <4:
F = randint(-10,10)
ass_main(ASS_BUF, SubL(_BT-8+_j*5,_BT+_SK+_KT),an(5)+pos(_X+F,_Y+F)+color1('010076')+bord(0)+blur(2)+alpha1(0)+fs(1)+animation(0,_KT*10,fs(100))+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET+20-8+_j*5),an(5)+pos(_X,_Y)+color1('010076')+bord(0)+fad(0,200)+blur(2)+alpha1(0)+fs(100)+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT),an(5)+pos(_X,_Y-30)+color1('FFFFFF')+bord(0)+blur(8)+alpha1(50)+fs(1)+animation(0,_KT*10,fs(80))+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET-8+_j*5),an(5)+pos(_X,_Y-30)+color1('FFFFFF')+bord(0)+fad(0,200)+blur(8)+alpha1(50)+fs(80)+clip2(7, mask), "●")
for i in range(70):
ass_main(ASS_BUF, SubL((_BT+_SK+40)-i,_BT+_SK+_KT),pos(_X,(_Y+20)-i)+color1('FFFFFF')+alpha1(255-(i/2-2))+bord(0)+fs(50-(i/10-6))+blur(1-(i/10-6))+shad(0)+frx(55)+fad(0,200), _TXT)
if _i > 3 and _i <6:
F = randint(-10,10)
ass_main(ASS_BUF, SubL(_BT-8+_j*5,_BT+_SK+_KT),an(5)+pos(_X+F,_Y+F)+color1('000000')+bord(0)+blur(2)+alpha1(0)+fs(1)+animation(0,_KT*10,fs(100))+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET+20-8+_j*5),an(5)+pos(_X,_Y)+color1('000000')+bord(0)+fad(0,200)+blur(2)+alpha1(0)+fs(100)+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT),an(5)+pos(_X,_Y-30)+color1('0000FF')+bord(0)+blur(8)+alpha1(50)+fs(1)+animation(0,_KT*10,fs(80))+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET-8+_j*5),an(5)+pos(_X,_Y-30)+color1('0000FF')+bord(0)+fad(0,200)+blur(8)+alpha1(50)+fs(80)+clip2(7, mask), "●")
for i in range(70):
ass_main(ASS_BUF, SubL((_BT+_SK+40)-i,_BT+_SK+_KT),pos(_X,(_Y+20)-i)+color1('0000FF+i')+alpha1(255-(i/2-2))+bord(0)+fs(50-(i/10-6))+blur(1-(i/10-6))+shad(0)+frx(55)+fad(0,200), _TXT)
if _i > 5 and _i <10:
R = randint(-20,20)
ass_main(ASS_BUF, SubL(_BT-8+_j*5,_ET),an(5) + pos(_X,_Y)+color1('000000')+bord(0)+fad(100,0)+alpha1(0)+fs(100)+blur(5)+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_ET,_ET+20-8+_j*5),an(5) + pos(_X,_Y)+color1('000000')+bord(0)+fad(0,200)+alpha1(0)+fs(100)+blur(5)+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_BT-8+_j*5,_ET),an(5) + pos(_X+R,_Y+R)+color1('0000FF')+bord(0)+fad(100,0)+alpha1(100)+fs(1)+animation(0,400,fs(50))+blur(8)+clip2(7, mask), "●")
ass_main(ASS_BUF, SubL(_ET,_ET+20-8+_j*5),an(5) + pos(_X+R,_Y+R)+color1('0000FF')+bord(0)+fad(0,200)+alpha1(100)+fs(50)+animation(0,400,fs(1))+blur(8)+clip2(7, mask), "●")
InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0] # 第一个像素的X轴坐标
InitPosY = _Y - int(_Fs / 2 + 0.5) + PIX[0][1] # 第一个像素的Y轴坐标
for h in range(0,PIX[1][1],4): # 开始纵向扫描
PosY = InitPosY + h
# 当前像素Y轴坐标
for w in range(PIX[1][0]): # 开始横向扫描
PosX = InitPosX + w
X = PosX-randint(-50,50)
Y = PosY-randint(-50,50) # 当前像素X轴坐标
idx = 4 * (h * PIX[1][0] + w) # 脚标
PixR = PIX[2][idx + 0] # 当前像素的红色分量
PixG = PIX[2][idx + 1] # 当前像素的绿色分量
PixB = PIX[2][idx + 2] # 当前像素的蓝色分量
PixA = PIX[2][idx + 3] # 当前像素的透明度
if PixA != 0: # 如果当前像素不为透明则进行如下操作
ass_main(ASS_BUF, SubL(_BT+_SK-20+w,_BT+_SK+_KT,0,Pix_Style),pos(PosX,PosY)+bord(0)+fad(100,0)+color1('0000FF')+alpha(255-PixA), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET+w-8+_j*5,0,Pix_Style),pos(PosX,PosY)+bord(0)+fad(0,200)+color1('0000FF')+alpha(255-PixA), PixPt())
InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0] # 第一个像素的X轴坐标
InitPosY = _Y - int(_Fs / 2 + 0.5) + PIX[0][1] # 第一个像素的Y轴坐标
for h in range(PIX[1][1]): # 开始纵向扫描
PosY = InitPosY + h
# 当前像素Y轴坐标
for w in range(0,PIX[1][0],4): # 开始横向扫描
PosX = InitPosX + w
X = PosX-randint(-50,50)
Y = PosY-randint(-50,50) # 当前像素X轴坐标
idx = 4 * (h * PIX[1][0] + w) # 脚标
PixR = PIX[2][idx + 0] # 当前像素的红色分量
PixG = PIX[2][idx + 1] # 当前像素的绿色分量
PixB = PIX[2][idx + 2] # 当前像素的蓝色分量
PixA = PIX[2][idx + 3] # 当前像素的透明度
if PixA != 0: # 如果当前像素不为透明则进行如下操作
ass_main(ASS_BUF, SubL(_BT+_SK-20+h,_BT+_SK+_KT,0,Pix_Style),pos(PosX,PosY)+bord(0)+fad(100,0)+color1('0000FF')+alpha(255-PixA), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET+h-8+_j*5,0,Pix_Style),pos(PosX,PosY)+bord(0)+fad(0,200)+color1('0000FF')+alpha(255-PixA), PixPt())
if _i > 9 and _i <17:
step = int(_FD/10)
for j in range(int(_BT+_SK),int(_BT+_SK+_KT/2),step):
t = j
t1 = t + step
ass_main(ASS_BUF, SubL(t,t1),an(5) + pos(_X+randint(-20,20),_Y+randint(-20,20))+color1('000000')+bord(0)+alpha1(0)+fs(40+randint(-20,20))+blur(4)+clip2(7, mask), "●")
if _i > 9 and _i <17:
ass_main(ASS_BUF, SubL(_BT+_SK+_KT/2,_ET+10-8+_j*5),an(5) + pos(_X+randint(-10,10),_Y+randint(-10,10))+color1('000000')+bord(0)+alpha1(0)+fs(1)+animation(0,_KT*10,fs(150))+blur(4)+clip2(7, mask), "●")
if _i > 9 and _i <17:
step = int(_FD/10)
for j in range(_BT+_SK+20,_ET+10-8+_j*5,step):
t = j
t1 = t + step
R = randint(-15,15)
ass_main(ASS_BUF, SubL(t,t1),an(5) + pos(_X+R,_Y+R)+color1('0000FF')+bord(0)+alpha1(150)+fs(40+randint(-20,30))+blur(6)+clip2(7, mask), "●")
if _i == 17:
PIX = TextPix(pyFont, _TXT)
InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0]
InitPosY = _Y - int(_FontSize / 2 + 0.5) + PIX[0][1]
X_list = []
Y_list = []
for h in range(PIX[1][1]):
PosY = InitPosY + h
for w in range(PIX[1][0]):
PosX = InitPosX + w
X = PosX
Y = PosY
idx = 4 * (h * PIX[1][0] + w)
PixR = PIX[2][idx + 0]
PixG = PIX[2][idx + 1]
PixB = PIX[2][idx + 2]
PixA = PIX[2][idx + 3]
if PixA != 0:
Y_list.append(PosY)
X_list.append(PosX)
B = Y_list[randint(0,len(Y_list)-1)]
A = X_list[randint(0,len(Y_list)-1)]
distance = []
for h in range(PIX[1][1]):
PosY = InitPosY + h
for w in range(PIX[1][0]):
PosX = InitPosX + w
X = PosX
Y = PosY
idx = 4 * (h * PIX[1][0] + w)
PixR = PIX[2][idx + 0]
PixG = PIX[2][idx + 1]
PixB = PIX[2][idx + 2]
PixA = PIX[2][idx + 3]
if PixA != 0:
import math
d = int(math.sqrt((X-A)**2+(Y-B)**2))
distance.append(d)
dmax = max(distance)
Color2 = DivClr('000000','0000FF',int(dmax))
for h in range(PIX[1][1]):
PosY = InitPosY + h
for w in range(PIX[1][0]):
PosX = InitPosX + w
X = PosX
Y = PosY
idx = 4 * (h * PIX[1][0] + w)
PixR = PIX[2][idx + 0]
PixG = PIX[2][idx + 1]
PixB = PIX[2][idx + 2]
PixA = PIX[2][idx + 3]
if PixA != 0:
import math
d = int(math.sqrt((X-A)**2+(Y-B)**2))-1
ass_main(ASS_BUF, SubL(_BT+w-8+_j*5,_BT+_SK,0,Pix_Style),pos(X,Y)+fad(200,0)+bord(0)+alpha1(255-PixA)+color1(Color2[d]), PixPt())
ass_main(ASS_BUF, SubL(_BT+w-8+_j*5,_BT+_SK,0,Pix_Style),pos(X,Y)+fad(200,0)+bord(0)+alpha1(255-PixA)+color1(Color2[d]), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK,int(_BT+_SK+w*(_KT/PIX[1][0])),0,Pix_Style),pos(X,Y)+bord(0)+alpha1(255-PixA)+color1(Color2[d]), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK,int(_BT+_SK+w*(_KT/PIX[1][0])),0,Pix_Style),pos(X,Y)+bord(0)+alpha1(255-PixA)+color1(Color2[d]), PixPt())
rnd = randint(-10,10)
ass_main(ASS_BUF, SubL(int(_BT+_SK+w*(_KT/PIX[1][0])),int(_BT+_SK+100+rnd+w*(_KT/PIX[1][0])),0,Pix_Style),mov(X,Y,X-50+rnd,Y+rnd)+fad(0,300)+bord(0)+alpha1(255-PixA)+color1(Color2[d]), PixPt())
return (ASS_BUF, None)
复制代码
115下载预览:
http://115.com/file/beldgnv5
作者:
Seekladoom
时间:
2022-2-3 01:36:10
本帖最后由 Seekladoom 于 2022-2-3 01:37 编辑
简化拆分脚本,内附工程文件,TCAX可直接运行TCC文件生成ASS特效:
【youkaze】Another OP 简化拆分.part01.rar
(950 KB, 下载次数: 2347)
2022-2-3 01:36:00 上传
下载次数: 2347
【youkaze】Another OP 简化拆分.part02.rar
(218.23 KB, 下载次数: 2190)
2022-2-3 01:36:07 上传
下载次数: 2190
附件:
【youkaze】Another OP 简化拆分.part02.rar
(2022-2-3 01:36:07, 218.23 KB) / 下载次数 2190
http://tcax.org/forum.php?mod=attachment&aid=Mjg4MnxkZWZmNmRmY3wxNzMyMjMxMDQyfDB8MA%3D%3D
附件:
【youkaze】Another OP 简化拆分.part01.rar
(2022-2-3 01:36:00, 950 KB) / 下载次数 2347
http://tcax.org/forum.php?mod=attachment&aid=Mjg4MXw4NWQ5YjU0YnwxNzMyMjMxMDQyfDB8MA%3D%3D
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2