TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
[SAI]015_xxxholicovaOP
[打印本页]
作者:
saiyaku
时间:
2011-10-22 19:17:42
标题:
[SAI]015_xxxholicovaOP
預覽:
http://pan.baidu.com/s/1hqqY9CC#dir/path=%2FSaiyakuFX_Preview
from tcaxPy import *
def tcaxPy_Init():
# Tips: initialize your global variables here
global _FontSize
global pyFont
_FontSize = GetVal(val_FontSize)
pyFont = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), GetVal(val_FontSize), GetVal(val_Spacing), GetVal(val_SpaceScale), 0x0000FF, 0, 0)
def tcaxPy_Main(_I, _J, _N, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
ASS_BUF = [] # used for saving raw TCS FX data
PIX = TextPix(pyFont, _TXT)
InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0] # left most position of the pixels in PIX
InitPosY = _Y - int(_FontSize / 2 + 0.5) + PIX[0][1] # upper most position of the pixels in PIX
X_list = []
Y_list = []
for h in range(PIX[1][1]):
PosY = InitPosY + h # y-position of the current pixel
for w in range(PIX[1][0]):
PosX = InitPosX + w # x-position of the current pixel
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 # y-position of the current pixel
for w in range(PIX[1][0]):
PosX = InitPosX + w # x-position of the current pixel
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)
Color = DivClr('FF37FF','6F1F5B',int(dmax))
for h in range(PIX[1][1]):
PosY = InitPosY + h # y-position of the current pixel
for w in range(PIX[1][0]):
PosX = InitPosX + w # x-position of the current pixel
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: # skip transparent pixels
import math
d = int(math.sqrt((X-A)**2+(Y-B)**2))-1
ass_main(ASS_BUF, SubL(_BT+_SK-80+randint(-20,20),_BT+_SK),mov(X+randint(-100,100),Y+randint(-30,30),X,Y)+bord(0)+alpha1(255-PixA)+color1(Color[d]), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK,_ET),pos(X,Y)+fad(0,100)+bord(0)+alpha1(255-PixA)+color1(Color[d]), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK,_ET),pos(X,Y)+fad(0,100)+bord(0)+alpha1(255-PixA)+color1(Color[d]), PixPt())
ass_main(ASS_BUF, SubL(_BT+_SK-8,_BT+_SK+_KT-8),pos(_X,_Y)+alpha1(255)+color3("FFFFFF")+t1(0,_KT*10,bord(2)+blur(4)),_TXT)
ass_main(ASS_BUF, SubL(_BT+_SK+_KT-8,_ET),pos(_X,_Y)+fad(0,100)+alpha1(255)+color3("FFFFFF")+bord(2)+blur(5),_TXT)
return (ASS_BUF,None)
def tcaxPy_Fin():
# Tips: finalize your global variables here
FinFont(pyFont)
复制代码
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://www.tcax.org/)
Powered by Discuz! X2