TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua

标题: [SAI]046_prismaillya2weiOP [打印本页]

作者: saiyaku    时间: 2014-8-1 14:49:14     标题: [SAI]046_prismaillya2weiOP

預覽:http://pan.baidu.com/s/1hqqY9CC#dir/path=%2FSaiyakuFX_Preview
  1. from util.gdiFont import *
  2. from tcaxPy import *
  3. from s import *

  4. def tcaxPy_Init():
  5.     global _FontFileName
  6.     global _FaceID
  7.     global _Fs
  8.     global _Height
  9.     global Font
  10.     global GdiFont
  11.     _FontFileName = GetVal(val_FontFileName)
  12.     _FaceID       = GetVal(val_FaceID)
  13.     _Fs           = GetVal(val_FontSize)
  14.     _Height       = GetVal(val_TextHeight)
  15.     Font = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
  16.     GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False)  

  17. def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):

  18.     ASS_BUF = []


  19.     clr3 = "881988"

  20.     if _i == 8  or _i == 10:
  21.         _Y -= _Fs+10


  22.     dx1 = _X - int(_A / 2 + 0.5)   
  23.     dy1 = _Y - int(_Fs / 2 + 0.5)  

  24.     outline = gfGetOutline(GdiFont, _TXT, dx1, dy1)

  25.     ts = _BT + _SK-5
  26.     te = ts + _KT

  27.    #發光前
  28.     ass_main(ASS_BUF, SubL(_BT-15, ts,10), an(7)+fad(150,0) + pos(_X+randint(-16,16), _Y+randint(-16,16))+color1("FA68EB")+blur(8) + clip2(4, outline), "{\p1}m 15 15 s 15 -15 -15 -15 -15 15 c{\p0}")
  29.         

  30.     ass_main(ASS_BUF, SubL(_BT-15, ts,2), an(7)+fad(150,0) + pos(0, 0) + bord(2.5)+color3(clr3)+p(4),outline )
  31.     ass_main(ASS_BUF, SubL(_BT-15, ts,1), an(7)+fad(150,0) + pos(0, 0) + bord(3)+blur(4)+color3("8045F8")+p(4),outline )

  32.   #發光後
  33.     ass_main(ASS_BUF, SubL(te, _ET+5,10), an(7)+fad(0,50) + pos(_X+randint(-16,16), _Y+randint(-16,16))+color1("FA68EB")+blur(8) + clip2(4, outline), "{\p1}m 15 15 s 15 -15 -15 -15 -15 15 c{\p0}")   
  34.         
  35.     ass_main(ASS_BUF, SubL(te, _ET+5,2), an(7)+fad(0,50) + pos(0, 0) + bord(2.5)+color3(clr3)+p(4),outline )
  36.     ass_main(ASS_BUF, SubL(te, _ET+5,1), an(7)+fad(0,50) + pos(0, 0) + bord(3)+blur(4)+color3("8045F8")+p(4),outline )
  37.    
  38.    #發光
  39.     ass_main(ASS_BUF, SubL(ts, te,20), an(7) + pos(0, 0) + bord(3)+blur(4)+color3("8446F5")+p(4),outline )
  40.     ass_main(ASS_BUF, SubL(ts, te,21), an(7) + pos(0, 0) +alpha(200)+ bord(1.5)+blur(1.5)+color3("FFFFFF")+p(4),outline )
  41.    

  42.      
  43.    #羽毛
  44.     for j in range(5):

  45.         POS = RandCirX(_X, _Y, int(_Fs), int(_Fs)+20)
  46.         ass_main(ASS_BUF, SubL(_ET+3, _ET+55),an(7)+fad(20,400)+bord(0)+fsc(70,70)+color1("FFFFFF")+frx(randint(-180,180))+fry(randint(-180,180))+frz(randint(-180,180))+t(frx(randint(-180,180))+fry(randint(-180,180))+frz(randint(-180,180)))+mov(POS[0][0],POS[0][1],POS[1][0],POS[1][1]),"{\p1}m 12 -15 b 12 -12 11 -10 9 -7 9 -6 9 -5 9 -4 11 -5 11 -3 8 -3 l 9 -2 6 -1 5 0 3 -2 b -3 12 -20 11 -25 6 -26 5 -25 3 -23 3 -20 3 -9 5 2 -3 l -1 -4 b -1 -6 1 -6 2 -6 2 -7 1 -8 1 -9 2 -9 4 -8 5 -8 4 -10 4 -12 5 -11 6 -11 6 -9 7 -8 9 -10 10 -13 10 -16 c{\p0}")
  47.    
  48.     #光線
  49.     PIX = TextPix(Font, _TXT)
  50.     points = PixPoints(PIX)
  51.     pt_num = len(points)
  52.     dx = _X - int(_A / 2 + 0.5) + PIX[0][0]
  53.     dy = _Y - int(_Fs / 2 + 0.5) + PIX[0][1]
  54.     pp = ''
  55.     for i in range(pt_num):
  56.         if random() < 0.4:

  57.             xr = points[i][0] / PIX[1][0]
  58.             yr = points[i][1] / PIX[1][1]
  59.             rnd = randint(-40,-5)
  60.             pp += ' m %d %d l %d %d %d %d %d %d %d %d'%(dx + points[i][0], dy + points[i][1],dx + points[i][0],dy + points[i][1]+int(40*(100 + f1(yr) * 30)/100+rnd+0.5),dx + points[i][0]+1,dy + points[i][1],dx + points[i][0],dy + points[i][1]-int(40*(100 + f1(yr) * 30)/100+rnd+0.5),dx + points[i][0], dy + points[i][1])
  61.     EFT = pos(0 , 0 ) +color1("FD88FF")+ fad(50, 10 * _KT + 200 - 50 - 80) +alpha1(0) + be(1)  + p(1)
  62.     ass_main(ASS_BUF, SubL(ts, te + 10, 10, Pix_Style), EFT, pp)

  63.     return (ASS_BUF, None)

  64. def f1(x):
  65.     return pow(abs(x) , 0.5)

  66. def scaleAlpha(a1, a2, scale):
  67.     return a1 + (a2 - a1) * scale

  68. def RandCirX(a, b, r1,r2):      
  69.     R1 = randint(0, r1)
  70.     R2 = randint(r1,r2)
  71.     theta = randint(0, 2 * 314) / 100.0
  72.     x1 = AdvInt(R1 * cos(theta) + a)
  73.     y1 = AdvInt(R1 * sin(theta) + b)
  74.     x2 = AdvInt(R2 * cos(theta) + a)
  75.     y2 = AdvInt(R2 * sin(theta) + b)
  76.     return [(x1, y1),(x2,y2)]
复制代码





欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/) Powered by Discuz! X2