TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
[SAI]032_hyoukaOP
[打印本页]
作者:
saiyaku
时间:
2012-8-21 11:11:38
标题:
[SAI]032_hyoukaOP
預覽:
http://pan.baidu.com/s/1hqqY9CC#dir/path=%2FSaiyakuFX_Preview
from tcaxPy import *
from extLibs.XXParticleSystem import *
from util.cairo import *
from util.gdiFont import *
def tcaxPy_Init():
global _Fs
global _FD # 一帧的持续时间, 约40毫秒
global _Spacing # 字体间距
global Font # 首要字体
global GdiFont
_Fs = GetVal(val_FontSize)
_FD = 1000 / GetVal(val_FXFPS)
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Spacing = GetVal(val_Spacing)
Font = InitFont(_FontFileName, _FaceID, _Fs, _Spacing, GetVal(val_SpaceScale), MakeRGB(255, 255, 255), 0, False)
GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False) #GDIfont
# cairo
global ctx
fx_width = GetVal(val_ResolutionX)
fx_height = GetVal(val_ResolutionY)
surface = ImageSurface(FORMAT_ARGB32, fx_width, fx_height)
ctx = Context(surface)
def tcaxPy_Fin():
FinFont(Font)
gfFinFont(GdiFont) #GDIfont
def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
ASS_BUF = [] # 保存ASS特效
TCAS_BUF = [] # 保存TCAS特效
if _i < 8:
if _i < 2 or _i == 7:
C1 = "FF0000"
else:
C1 = "3CFFF8"
size = 100
n = 40
x = 40
for i in range(0,_KT,n):
rand1 = randint(-20,20)
rand2 = randint(-20,20)
for j in range(2):
ass_main(ASS_BUF,SubL(_BT+_SK-5+i+j*x,_BT+_SK+100+i+j*x),an(7)+pos(_X+0.5*randint(-1,1)+rand1,_Y+0.5*randint(-1,1)-rand2)+xshad(1)+be(1)+bord(2.5)+color3("D4FEFC")+alpha1(250)+color1(C1)+fscx(0)+fscy(0)+t(fsc(size,size))+fad(100,1000),"{\p2}m 59 0 b 59 -79 -59 -79 -59 0 -59 79 59 79 59 0{\p0}")
ass_main(ASS_BUF,SubL(_BT+_SK-3+i+j*x,_BT+_SK+102+i+j*x),an(7)+pos(_X+0.5*randint(-1,1)-rand2,_Y+0.5*randint(-1,1)+rand1)+yshad(1)+be(1)+bord(2.5)+color3("D4FEFC")+alpha1(250)+color1(C1)+fscx(0)+fscy(0)+t(fsc(size,size))+fad(100,1000),"{\p2}m 59 0 b 59 -79 -59 -79 -59 0 -59 79 59 79 59 0{\p0}")
dx = _X - int(_A / 2 + 0.5)
dy = _Y - int(_Fs / 2 + 0.5)
frames = int(1500 / _FD + 0.5)
randx = randint(50,80)
randy = randint(-50,50)
for i in range(frames):
ts = _BT+_SK-5 + i * _FD / 10
te = _BT+_SK-5 + (i + 1) * _FD / 10
frame_pct = i / frames
outline = gfGetOutline(GdiFont, _TXT, dx, dy)
AssDraw(ctx, outline)
path_trans(ctx, wave_filter,(_X,_Y,frame_pct))
text = ToAssDraw(ctx)
EFT = an(7) + pos(0,0) + alpha1(255 * frame_pct)+alpha3(155 * frame_pct+100) +bord(1.5)+ p(4)
ass_main(ASS_BUF, SubL(ts, te), EFT, text)
outline = gfGetOutline(GdiFont, _TXT, dx, dy)
ass_main(ASS_BUF, SubL(_BT+_j*5, _BT+_SK-5),an(7) + pos(0,0)+fad(150,0)+bord(1.5)+p(4), outline)
else:
dx = _X - int(_A / 2 + 0.5)
dy = _Y - int(_Fs / 2 + 0.5)
frames = int(1000 / _FD + 0.5)
randx = randint(50,80)
randy = randint(30,80)
rx = randint(-90,90)
ry = randint(-90,90)
rz = randint(0,180)
POS = Bezier3(frames,0 , 0 , -randx, -randy,-randint(0,int(randx/2)), randint(-50,50),-randint(int(randx/2),randx), randint(-50,50))
for i in range(frames):
ts = _BT+_SK-5 + i * _FD / 10
te = _BT+_SK-5 + (i + 1) * _FD / 10
frame_pct = i / frames
outline = gfGetOutline(GdiFont, _TXT, dx, dy)
AssDraw(ctx, outline)
path_trans(ctx, flag_filter, (dx+POS[i][0]*frame_pct, dx, randx/2.5, _Fs, frame_pct))
text = ToAssDraw(ctx)
EFT = an(7) + pos(POS[i][0]*frame_pct,POS[i][1]*frame_pct)+ alpha1(255 * frame_pct)+alpha3(155 * frame_pct+100) +bord(1.5)+ p(4)
ass_main(ASS_BUF, SubL(ts, te), EFT, text)
outline = gfGetOutline(GdiFont, _TXT, dx, dy)
ass_main(ASS_BUF, SubL(_BT+_j*5, _BT+_SK-5),an(7) + pos(0,0)+fad(150,0)+bord(1.5)+p(4), outline)
return (ASS_BUF,None)
def wave_filter(x, y, param):
dx, dy, frame_pct = param
d = sqrt((x-dx*8)**2+(y-dy*8)**2)
if d==0:
max_diff_x = sin( pi / 10 + frame_pct * pi * 5) * 3 * 8
max_diff_y = cos( pi / 10 + frame_pct * pi * 5) * 3 * 8
else:
max_diff_x = sin( (y-dy)/d * pi / 10 + frame_pct * pi * 5) * 3 * 8
max_diff_y = cos( (x-dx)/d * pi / 10 + frame_pct * pi * 5) * 3 * 8
new_x = x + floor(frame_pct * max_diff_x)
new_y = y + floor(frame_pct * max_diff_y)
return new_x, new_y
def flag_filter(x, y, param):
char_left, line_left, line_width, line_height, frame_pct = param
char_x = ceil(x + char_left * 8 - line_left * 8)
max_diff_x = sin(y / line_height * pi / 10 + frame_pct * pi * 5) * 20 * 8
max_diff_y = sin(char_x / line_width * pi / 10 + frame_pct * pi * 5) * 20 * 8
new_x = char_x + floor(max_diff_y * frame_pct)
new_y = y + floor(max_diff_y * frame_pct)
return new_x, new_y
复制代码
作者:
kk123456
时间:
2012-8-21 12:49:24
完全看不懂
作者:
674316
时间:
2012-8-22 22:30:58
登陆看看
作者:
milkyjing
时间:
2012-8-24 18:04:17
灾厄仔久违的代码必须顶
作者:
Seekladoom
时间:
2022-1-16 03:47:34
冰菓OP1 简化拆分.rar
(348.12 KB, 下载次数: 2293)
2022-1-16 03:47:31 上传
下载次数: 2293
附件:
冰菓OP1 简化拆分.rar
(2022-1-16 03:47:31, 348.12 KB) / 下载次数 2293
http://tcax.org/forum.php?mod=attachment&aid=Mjg0OXw1NWVkYTE0N3wxNzMyMjMwNzI4fDB8MA%3D%3D
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2