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

标题: [SAI]048_kuroshitsujibookofcircusED [打印本页]

作者: saiyaku    时间: 2014-8-15 14:37:55     标题: [SAI]048_kuroshitsujibookofcircusED

預覽: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.     dx1 = _X - int(_A / 2 + 0.5)   
  20.     dy1 = _Y - int(_Fs / 2 + 0.5)  

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

  22.     C = ["D06F02","3E4D62","2B21DF","A85EAD","B25C95","408000","EA00EA"]

  23.     c = [0,5,1,4,2,3,6,6,0,2,2,0]     # 每行的顏色

  24.     ts = _BT + _SK-55
  25.    
  26.    #底色
  27.     ass_main(ASS_BUF, SubL(ts+30, _ET+20+_j*5,10), an(7) + pos(0, 0) +fad(500,500) +p(4)+color1(C[c[_i]]),outline )

  28.     #入場
  29.     n = 4
  30.     angle = randint(0,360)
  31.     oo = (-7,-3,-7,-3,-2,-8,-2,-8,3,-7,3,-7,8,-2,8,-2,8,2,8,2,2,8,2,8,-2,8,-2,8,-7,3,-7,3)
  32.     for tt in range(ts,ts+50,4):
  33.         te = tt+4
  34.         if ts+50-tt<4:
  35.             te = ts+50
  36.         pp = pp_rand(10,3,oo)
  37.         oo = pp[1]
  38.         ass_main(ASS_BUF, SubL(tt, te,20), an(7) + pos(_X, _Y)+color1("FFFFFF")+blur(2)+alpha(255-255*(tt-ts)/50)+fsc(110*(tt-ts)/50,110*(tt-ts)/50)+frz(angle) + clip2(4, outline)+p(1), pp[0])

  39.     #存在
  40.     oo = (-7,-3,-7,-3,-2,-8,-2,-8,3,-7,3,-7,8,-2,8,-2,8,2,8,2,2,8,2,8,-2,8,-2,8,-7,3,-7,3)
  41.     for tt in range(ts+50,_ET+_j*5,n):
  42.         pp = pp_rand(randint(0,3),randint(0,3),oo)
  43.         oo = pp[1]
  44.         ass_main(ASS_BUF, SubL(tt, tt+n,20), an(7) +blur(2)+ pos(_X, _Y)+color1("FFFFFF")+fsc(110,110)+frz(angle) + clip2(4, outline)+p(1), pp[0])
  45.         angle -= 4

  46.     #出場
  47.     oo = (-7,-3,-7,-3,-2,-8,-2,-8,3,-7,3,-7,8,-2,8,-2,8,2,8,2,2,8,2,8,-2,8,-2,8,-7,3,-7,3)
  48.     for tt in range(_ET+_j*5,_ET+50+_j*5,4):
  49.         pp = pp_rand(10,3,oo)
  50.         oo = pp[1]
  51.         ass_main(ASS_BUF, SubL(tt, tt+4,20), an(7) +blur(2)+ pos(_X, _Y)+color1("FFFFFF")+alpha(255*(tt-_ET)/50)+fsc(110-110*(tt-_ET)/50,130-130*(tt-_ET)/50)+frz(angle) + clip2(4, outline)+p(1), pp[0])

  52.     #星星擴散

  53.     if _i > 5:   
  54.         ts = _BT + _SK-40
  55.         te = _BT + _SK + _KT-20
  56.         count = int((te - ts)/2 )
  57.         PIX = TextPix(Font, _TXT)
  58.         points = PixPoints(PIX)
  59.         pt_num = len(points)
  60.         dx = _X - int(_A / 2 + 0.5) + PIX[0][0]
  61.         dy = _Y - int(_Fs / 2 + 0.5) + PIX[0][1]
  62.         for i in range(count):
  63.             pt = points[randint(0, pt_num - 1)]
  64.             t0 = randint(int(ts), int(te))
  65.             t1 = t0 + 150
  66.             x = dx + pt[0]
  67.             y = dy + pt[1]
  68.             EFT = move(x, y, randint(x - 50, x + 50), randint(y - 35, y + 35)) + fad(0, 300) + alpha1(0) + color1('FFFFFF') + \
  69.                   alpha3(0) + color3(C[c[randint(0,6)]]) + bord(0.5) + blur(1)+t(fry(360*3))
  70.             ass_main(ASS_BUF, SubL(t0, t1, 2, Pix_Style), EFT, RandPolygon(13/8, 13/8, 4))

  71.     return (ASS_BUF, None)

  72. #腦殘隨機圖形
  73. def pp_rand(n,m,oo):     
  74.    
  75.     x11 = oo[0] + randint(-n,n)
  76.     y11 = oo[1] + randint(-m,m)
  77.     x12 = oo[2] + randint(-n,n)
  78.     y12 = oo[3] + randint(-m,m)
  79.     x21 = oo[4] + randint(-n,n)
  80.     y21 = oo[5] + randint(-m,m)
  81.     x22 = oo[6] + randint(-n,n)
  82.     y22 = oo[7] + randint(-m,m)
  83.     x31 = oo[8] + randint(-n,n)
  84.     y31 = oo[9] + randint(-m,m)
  85.     x32 = oo[10] + randint(-n,n)
  86.     y32 = oo[11] + randint(-m,m)
  87.     x41 = oo[12] + randint(-n,n)
  88.     y41 = oo[13] + randint(-m,m)
  89.     x42 = oo[14] + randint(-n,n)
  90.     y42 = oo[15] + randint(-m,m)
  91.     x51 = oo[16] + randint(-n,n)
  92.     y51 = oo[17] + randint(-m,m)
  93.     x52 = oo[18] + randint(-n,n)
  94.     y52 = oo[19] + randint(-m,m)
  95.     x61 = oo[20] + randint(-n,n)
  96.     y61 = oo[21] + randint(-m,m)
  97.     x62 = oo[22] + randint(-n,n)
  98.     y62 = oo[23] + randint(-m,m)
  99.     x71 = oo[24] + randint(-n,n)
  100.     y71 = oo[25] + randint(-m,m)
  101.     x72 = oo[26] + randint(-n,n)
  102.     y72 = oo[27] + randint(-m,m)
  103.     x81 = oo[28] + randint(-n,n)
  104.     y81 = oo[29] + randint(-m,m)
  105.     x82 = oo[30] + randint(-n,n)
  106.     y82 = oo[31] + randint(-m,m)

  107.     pp = "m -10 0 b {0} {1} {2} {3} -5 -5 b {4} {5} {6} {7} 0 -10 b {8} {9} {10} {11} 5 -5 b {12} {13} {14} {15} 10 0 b {16} {17} {18} {19} 5 5 b {20} {21} {22} {23} 0 10 b {24} {25} {26} {27} -5 5 b {28} {29} {30} {31} -10 0 ".format(x11,y11,x12,y12,x21,y21,x22,y22,x31,y31,x32,y32,x41,y41,x42,y42,x51,y51,x52,y52,x61,y61,x62,y62,x71,y71,x72,y72,x81,y81,x82,y82)
  108.     return [pp,(x11,y11,x12,y12,x21,y21,x22,y22,x31,y31,x32,y32,x41,y41,x42,y42,x51,y51,x52,y52,x61,y61,x62,y62,x71,y71,x72,y72,x81,y81,x82,y82)]
复制代码

作者: ws848193120    时间: 2014-8-15 21:54:06

请问,这些代码怎么用?怎样才能让它像ass文件一样显示?(本人小白)
作者: saiyaku    时间: 2014-8-17 09:18:42

ws848193120 发表于 2014-8-15 21:54
请问,这些代码怎么用?怎样才能让它像ass文件一样显示?(本人小白) ...

先看教程 學python 學怎麼編寫腳本
嗯 這個完整特效的要求比較高 并不是給初學者用的
建議初學者可以先去內置特效區看看
完整特效的腳本 都不是用來套用的 而是提供一些編寫腳本的思路
如果看不懂代碼 對你來說就是沒用的


作者: oiuu    时间: 2014-11-5 12:47:19

大神,能否提供tcc文件,这自己弄的颜色看起来很不舒服,还是巨巨您的好看点。
作者: Sky℃    时间: 2014-11-7 23:32:51

saiyaku 发表于 2014-8-17 09:18
先看教程 學python 學怎麼編寫腳本
嗯 這個完整特效的要求比較高 并不是給初學者用的
建議初學者可以先去 ...

大大说的极是啊  




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