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

标题: [kk]05_Sword_Art_Online_OP1 [打印本页]

作者: kk123456    时间: 2012-11-28 13:12:06     标题: [kk]05_Sword_Art_Online_OP1

本帖最后由 kk123456 于 2012-11-28 13:12 编辑
  1. from tcaxPy import *

  2. def tcaxPy_Init():
  3.     global _Fs
  4.     global _FD          # 一帧的持续时间, 约40毫秒
  5.     global _Spacing     # 字体间距
  6.     global _TextLength
  7.     global Font         # 首要字体
  8.     _Fs = GetVal(val_FontSize)
  9.     _FD = 1000 / GetVal(val_FXFPS)
  10.     _FontFileName = GetVal(val_FontFileName)
  11.     _FaceID = GetVal(val_FaceID)
  12.     _Spacing = GetVal(val_Spacing)
  13.     _TextLength = GetVal(val_TextLength)
  14.     Font = InitFont(_FontFileName, _FaceID, _Fs, _Spacing, GetVal(val_SpaceScale), MakeRGB(255, 255, 255), 0, False)
  15.    
  16. def fsc(x):

  17.     X = randint(0,x)

  18.     return fscx(X)+fscy(X)


  19. def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _x, _y, _a, _txt):
  20.   
  21.   
  22.     ASS_BUF = []
  23.     dx = _x - int(_a / 2 + 0.5)         
  24.     dy = _y - int(_Fs / 2 + 0.5)
  25.     clo = ("9EDADC","F8FB96")               
  26.     if _i == 0 or _i == 2 :
  27.         CLIP= clip(dx,dy,_x+_a/2+0.5,_y+_Fs/2+5)
  28.         ass_main(ASS_BUF, SubL(_BT-20,_BT+5),pos(_x,_y)+color3('F4CE1C')+blur(3)+bord(2)+be(2)+clip(dx,_y+_Fs/2+5,_x+_a/2+0.5,_y+_Fs/2+5)+t(0,180,CLIP)+t(180,200,color3('000000')+blur(0)+bord(2)), _txt)
  29.         ass_main(ASS_BUF, SubL(_BT,_ET),pos(_x,_y)+fad(0,200)+bord(2)+blur(0)+be(2)+color3('000000')+t(_SK*10,(_SK+1)*10,blur(2)+bord(4)+color3('FFFFFF')+be(0)+fs(_Fs+7))+t((_SK+1)*10,(_SK+_KT)*10+50,blur(0)+bord(2)+fs(_Fs))+t((_SK+1)*10,(_SK+_KT/3)*10,color3('FFFFFF')+be(0))+t((_SK+_KT/3)*10,(_SK+_KT)*10+50,color3('000000')+be(3)), _txt)
  30.         
  31.         for i in range(4):
  32.             ass_main(ASS_BUF,SubL(_BT+_SK-10+i*8,_BT+_SK+_KT+i*8),fad(100,200)+pos(_x-_a/2+_a/3*i,_y+randint(20,30))+frx(78)+alpha1(256)+alpha3(0)+alpha2(0)+be(2)+color3("FFFFFF")+bord(2)+fscx(0)+fscy(0)+t(0,_KT*10,fscx(80)+fscy(80)),"●")
  33.    
  34.         for i in range(20):      
  35.             ass_main(ASS_BUF, SubL(_BT-20,_BT+5),move(_x+randint(-25,25),_y+_Fs/2+randint(-15,5),_x+randint(-25,25),_y-randint(30,55))+fad(0,100)+color3('F4CE1C')+blur(3)+bord(1)+be(2)+t(bord(0)), "{\p1}m 0 0 l 1 0 1 1 0 1{\p0}")
  36.     if _i == 1 or _i == 3 :
  37.         CLIP= clip(dx,dy,_x+_a/2+0.5,_y+_Fs/2+5)
  38.         ass_main(ASS_BUF, SubL(_BT-20,_BT+5),pos(_x,_y)+color3('F4CE1C')+blur(3)+bord(2)+be(2)+clip(dx,_y+_Fs/2+5,_x+_a/2+0.5,_y+_Fs/2+5)+t(0,200,CLIP)+t(100,250,color3('000000')+blur(0)+bord(2)), _txt)
  39.         ass_main(ASS_BUF, SubL(_BT,_ET-10),pos(_x,_y)+fad(0,200)+bord(2)+blur(0)+be(1)+color3('808080')+t(_SK*10,(_SK+1)*10,blur(2)+bord(4)+color3('FFFFFF')+be(0)+fs(_Fs+7))+t((_SK+1)*10,(_SK+_KT)*10+50,blur(0)+color3('000000')+bord(2)+be(1)+fs(_Fs)), _txt)
  40.         
  41.         for i in range(15):
  42.             ass_main(ASS_BUF,SubL(_BT+_SK-15+randint(0,_KT)*0.7,_BT+_SK+_KT+30),fad(100,300)+pos(_x+randint(-5,5)*6,_y+randint(-4,4)*5)+alpha1(randint(0,5)*8)+color1("FFFFFF")+be(1)+blur(0)+bord(0)+t(color1("57C6EA")+blur(3))+fscx(50)+fscy(50),"*")
  43.    
  44.         for i in range(20):      
  45.             ass_main(ASS_BUF, SubL(_BT-20,_BT+5),move(_x+randint(-25,25),_y+_Fs/2+randint(-15,5),_x+randint(-25,25),_y-randint(30,55))+fad(0,100)+color3('F4CE1C')+blur(3)+bord(1)+be(2)+t(bord(0)), "{\p1}m 0 0 l 1 0 1 1 0 1{\p0}")
  46.     if _i == 4 or _i == 5 :
  47.         CLIP= clip(dx,dy,_x+_a/2+0.5,_y+_Fs/2+5)
  48.         ass_main(ASS_BUF, SubL(_BT-20,_BT+5),pos(_x,_y)+color3('F4CE1C')+blur(3)+bord(2)+be(2)+clip(dx,_y+_Fs/2+5,_x+_a/2+0.5,_y+_Fs/2+5)+t(0,250,CLIP)+t(100,250,color3('000000')+blur(0)+bord(2)), _txt)
  49.         ass_main(ASS_BUF, SubL(_BT,_ET-10),pos(_x,_y)+fad(0,200)+bord(2)+blur(0)+be(1)+color3('000000')+t(_SK*10,(_SK+1)*10,blur(2)+bord(4)+color3('FFFFFF')+be(0)+fs(_Fs+7))+t((_SK+1)*10,(_SK+_KT)*10+50,blur(0)+color3('000000')+bord(2)+be(1)+fs(_Fs)), _txt)
  50.         for i in range(20):      
  51.             ass_main(ASS_BUF, SubL(_BT-20,_BT+5),move(_x+randint(-25,25),_y+_Fs/2+randint(-15,5),_x+randint(-25,25),_y-randint(30,55))+fad(0,100)+color3('F4CE1C')+blur(3)+bord(1)+be(2)+t(bord(0)), "{\p1}m 0 0 l 1 0 1 1 0 1{\p0}")
  52.             
  53.     if _i == 6 or _i == 7 :
  54.         CLIP= clip(dx,dy,_x+_a/2+0.5,_y+_Fs/2+5)
  55.         col = ("DBFCCF", "FEFCF8", "685131")
  56.         PIX = TextPix(Font, _txt)
  57.         n = len(PIX)
  58.         l = randint(0,n+1)
  59.         ass_main(ASS_BUF, SubL(_BT-20,_BT+5),pos(_x,_y)+color3('F4CE1C')+blur(3)+bord(2)+be(2)+clip(dx,_y+_Fs/2+5,_x+_a/2+0.5,_y+_Fs/2+5)+t(0,250,CLIP)+t(100,250,color3('000000')+blur(0)+bord(2)), _txt)
  60.         ass_main(ASS_BUF, SubL(_BT,_BT+_SK+5),pos(_x,_y)+bord(2)+blur(0)+be(1)+color3('0000000')+t(_SK-100,(_SK)*10,color1("FEFCF8")+color3("516C35")+bord(4)+blur(6.1)), _txt)
  61.         for i in range(25):      
  62.             ass_main(ASS_BUF, SubL(_BT-20,_BT+5),move(_x+randint(-25,25),_y+_Fs/2+randint(-15,5),_x+randint(-25,25),_y-randint(30,55))+fad(0,100)+color3('F4CE1C')+blur(3)+bord(1)+be(2)+t(bord(0)), "{\p1}m 0 0 l 1 0 1 1 0 1{\p0}")
  63.         for i in range(40):
  64.             PIX = TextPix(Font, _txt)
  65.             points = PixPoints(PIX)
  66.             n = len(points)
  67.             pt = points[randint(0, n - 1)]
  68.             x = dx+pt[0]+randint(-4,5)
  69.             y = dy+pt[1]+randint(-4,5)
  70.             tp = ("{\p3}m 0 0 l0 20 0 l 10 20  {\p0}","{\p3}m 0 0 l 0 14 0 l -14 -14 {\p0}","{\p4}m 0 0 l 0 21 l 14 7 l 21 -14 l 0 0 {\p0}","{\p3}m -10 0 l -10 -18 l 12 10 l -10 10 {\p0}")
  71.             tp1 = tp[randint(0,3)]
  72.             Xx = -50+randint(-50,50)
  73.             Yy = randint(-30,30)
  74.             R = randint(-30,10)
  75.             MOVE = move(x,y,_x+Xx,_y+Yy)
  76.                
  77.             EFT = t(0,(_SK+_KT+90)*10,0.4,MOVE)+fad(0,500)+color1("EAF9DF")+be(3)+alpha3(randint(120,200))+color3("68A47C")+bord(2)+t(0,randint(0,_KT+50)*10,color1("685131")+bord(0))+fr(randint(-180,180))+t(fr(randint(-90,90)))
  78.                
  79.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+90), EFT, tp1)        
  80.     if _i == 8 :
  81.         fire_str = ('{\\p5}m 0 0 b 8 1 9 -28 -2 -41 b 3 -23 -17 0 0 0{\\p0}','{\\p5}m 1 41 b 20 39 1 13 13 -11 b 5 1 -18 22 1 41{\\p0}','{\\p4}m 6 39 b 4 29 1 13 27 -37 b -1 -3 -15 34 6 39{\\p0}','{\\p5}m -3 43 b -9 22 -1 33 16 -47 b 1 3 -17 0 -3 43{\\p0}')

  82.         PIX = TextPix(Font, _txt)

  83.         points = PixPoints(PIX)

  84.         pt_num = len(points)

  85.         dx = _x - int(_a / 2 + 0.5) + PIX[0][0]

  86.         dy = _y - int(_Fs / 2 + 0.5) + PIX[0][1]
  87.         CLIP= clip(dx,dy,_x+_a/2+0.5,_y+_Fs/2+5)
  88.         ass_main(ASS_BUF, SubL(_BT-20,_BT+5),pos(_x,_y)+color3('F4CE1C')+blur(3)+bord(2)+be(2)+clip(dx,_y+_Fs/2+5,_x+_a/2+0.5,_y+_Fs/2+5)+t(0,250,CLIP)+t(100,250,color3('000000')+blur(0)+bord(2)), _txt)
  89.         ass_main(ASS_BUF, SubL(_BT,_ET-10,12),pos(_x,_y)+fad(0,200), _txt)   
  90.         ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT+10,14),pos(_x,_y)+fad(0,_KT*4)+fs(_Fs+2)+color1("FFAF09")+bord(0)+t(0,_KT*10,0.4,fs(_Fs+18)), _txt)
  91.         ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT,13),pos(_x,_y)+color3("FFAF09"), _txt)
  92.         for i in range(20):      
  93.             ass_main(ASS_BUF, SubL(_BT-20,_BT+5),move(_x+randint(-25,25),_y+_Fs/2+randint(-15,5),_x+randint(-25,25),_y-randint(30,55))+fad(0,100)+color3('F4CE1C')+blur(3)+bord(1)+be(2)+t(bord(0)), "{\p1}m 0 0 l 1 0 1 1 0 1{\p0}")

  94.         for i in range(0, _ET-_SK-_BT, 3):

  95.             pt = points[randint(0, pt_num - 1)]

  96.             t0 = randint(_BT+_SK,_ET)

  97.             t1 = t0 + 30

  98.             tmpz = randint(0, 359)

  99.             tmpstr = fire_str[randint(0, 3)]

  100.             x = dx + pt[0]

  101.             y = dy + pt[1]

  102.             EFT = move(x, y, x, y - 35) + alpha1(100) + color1('FFAF09') + alpha3(150) + color3('FFAF09') + bord(3) + blur(3) + frz(tmpz) + t(fscx(70)+fscy(70) + bord(1) + fry(361) + frz(-57)) + fad(0, 200)
  103.             ass_main(ASS_BUF, SubL(t0, t1,10, Pix_Style), EFT, tmpstr)
  104.     if _i == 9 :
  105.         CLIP= clip(dx,dy,_x+_a/2+0.5,_y+_Fs/2+5)
  106.         ass_main(ASS_BUF, SubL(_BT-20,_BT+5),pos(_x,_y)+color3('F4CE1C')+blur(3)+bord(2)+be(2)+clip(dx,_y+_Fs/2+5,_x+_a/2+0.5,_y+_Fs/2+5)+t(0,250,CLIP)+t(100,250,color3('000000')+blur(0)+bord(2)), _txt)
  107.         
  108.         
  109.         for i in range(20):      
  110.             ass_main(ASS_BUF, SubL(_BT-20,_BT+5),move(_x+randint(-25,25),_y+_Fs/2+randint(-15,5),_x+randint(-25,25),_y-randint(30,55))+fad(0,100)+color3('F4CE1C')+blur(3)+bord(1)+be(2)+t(bord(0)), "{\p1}m 0 0 l 1 0 1 1 0 1{\p0}")   
  111.         if _j == 0 :
  112.             
  113.             ass_main(ASS_BUF, SubL(_BT,_ET),pos(_x,_y)+fad(0,200)+bord(2)+blur(0)+be(2)+t(_SK*10,(_SK+1)*10,blur(2)+bord(4)+color3('76F5FC')+color1("76F5FC")+be(0)+fs(_Fs+7))+t((_SK+1)*10,(_SK+_KT)*10+50,blur(0)+bord(2)+fs(_Fs))+t((_SK+1)*10,(_SK+_KT/3)*10,color3('76F5FC')+be(0))+t((_SK+_KT/3)*10,(_SK+_KT)*10+50,color3('000000')+color1('FFFFFF')+be(3)), _txt)
  114.         if _j == 2 :  
  115.             ass_main(ASS_BUF, SubL(_BT,_ET),pos(_x,_y)+fad(0,200)+bord(2)+blur(0)+be(2)+t(_SK*10,(_SK+1)*10,blur(2)+bord(4)+color3('BBABEA')+color1("BBABEA")+be(0)+fs(_Fs+7))+t((_SK+1)*10,(_SK+_KT)*10+50,blur(0)+bord(2)+fs(_Fs))+t((_SK+1)*10,(_SK+_KT/3)*10,color3('BBABEA')+color1("BBABEA")+be(0))+t((_SK+_KT/3)*10,(_SK+_KT)*10+50,color3('000000')+color1('FFFFFF')+be(3)), _txt)
  116.         if _j == 4 :  
  117.             ass_main(ASS_BUF, SubL(_BT,_ET),pos(_x,_y)+fad(0,200)+bord(2)+blur(0)+be(2)+t(_SK*10,(_SK+1)*10,blur(2)+bord(4)+color3('BC893E')+color1("BC893E")+be(0)+fs(_Fs+7))+t((_SK+1)*10,(_SK+_KT)*10+50,blur(0)+bord(2)+fs(_Fs))+t((_SK+1)*10,(_SK+_KT/3)*10,color3('BC893E')+color1("BC893E")+be(0))+t((_SK+_KT/3)*10,(_SK+_KT)*10+50,color3('000000')+color1('FFFFFF')+be(3)), _txt)
  118.     if _i > 12 :
  119.         CLIP= clip(dx,dy,_x+_a/2+0.5,_y+_Fs/2+5)
  120.         ass_main(ASS_BUF, SubL(_BT-20,_BT+5),pos(_x,_y)+color3('F4CE1C')+blur(3)+bord(2)+be(2)+clip(dx,_y+_Fs/2+5,_x+_a/2+0.5,_y+_Fs/2+5)+t(0,250,CLIP)+t(100,250,color3('000000')+blur(0)+bord(2)), _txt)
  121.         ass_main(ASS_BUF, SubL(_BT,_ET-10),an(5)+pos(_x,_y)+fad(200,200)+fs(34)+bord(2)+be(3)+blur(0)+color3('000000')+t(_SK*10-150,(_SK+_KT/2)*10,blur(5)+bord(4)+color3('FFFFFF')+be(3)+fs(38))+t((_SK+_KT/2)*10,(_SK+_KT)*10+50,blur(0)+color3('000000')+bord(2)+be(0)+fs(34)), _txt)
  122.         
  123.         
  124.    
  125.         for i in range(20):      
  126.             ass_main(ASS_BUF, SubL(_BT-20,_BT+5),move(_x+randint(-25,25),_y+_Fs/2+randint(-15,5),_x+randint(-25,25),_y-randint(30,55))+fad(0,100)+color3('F4CE1C')+blur(3)+bord(1)+be(2)+t(bord(0)), "{\p1}m 0 0 l 1 0 1 1 0 1{\p0}")   
  127.     if _i == 10 :
  128.         col = ("FFCB60")
  129.     if _i == 11 :
  130.         col = ("AEFD42")
  131.     if _i == 12 :
  132.         col = clo[randint(0,1)]
  133.     if _i > 9 and _i < 13 :
  134.         CLIP= clip(dx,dy,_x+_a/2+0.5,_y+_Fs/2+5)
  135.         ass_main(ASS_BUF, SubL(_BT-20,_BT+5),pos(_x,_y)+color3('F4CE1C')+blur(3)+bord(2)+be(2)+clip(dx,_y+_Fs/2+5,_x+_a/2+0.5,_y+_Fs/2+5)+t(0,250,CLIP)+t(100,250,color3('000000')+blur(0)+bord(2)), _txt)
  136.         ass_main(ASS_BUF, SubL(_BT,_ET-10,2),pos(_x,_y)+fad(0,200)+bord(2)+blur(0)+be(3)+color3('000000')+t(_SK*10,(_SK+1)*10,blur(2)+bord(4)+color3('FFFFFF')+be(0)+fs(_Fs+7))+t((_SK+1)*10,(_SK+_KT)*10+50,blur(0)+color3('000000')+bord(2)+be(1)+fs(_Fs)), _txt)
  137.         
  138.         for i in range(0,_a,13):
  139.             for k in range(0,_Fs+2,10):
  140.                 if _i == 12 :
  141.                     col = clo[randint(0,1)]
  142.                 ass_main(ASS_BUF,SubL(_BT+_SK-15+randint(0,_KT)*0.5,_BT+_SK+_KT+randint(20,80),0),fad(100,300)+pos(dx+i+randint(-5,5),dy+k+randint(-2,3))+color1(col)+fscx(30)+fscy(20)+alpha1(randint(0,11)*20)+bord(0)+t(color1("FFFFFF")),"■")
  143.    
  144.         for i in range(20):      
  145.             ass_main(ASS_BUF, SubL(_BT-20,_BT+5),move(_x+randint(-25,25),_y+_Fs/2+randint(-15,5),_x+randint(-25,25),_y-randint(30,55))+fad(0,100)+color3('F4CE1C')+blur(3)+bord(1)+be(2)+t(bord(0)), "{\p1}m 0 0 l 1 0 1 1 0 1{\p0}")   
  146.     return (ASS_BUF,None)
复制代码
嘛,一个简单的东西,那破碎效果略苦逼,看着有些假,以后试试mod好了


     视频预览
作者: milkyjing    时间: 2012-12-1 18:21:15

加油, KK君进步有目共睹啊...

入坑满周年了么..
作者: kk123456    时间: 2012-12-1 18:54:35

本帖最后由 kk123456 于 2012-12-1 18:54 编辑
milkyjing 发表于 2012-12-1 18:21
加油, KK君进步有目共睹啊...

入坑满周年了么..


感谢奶大的鼓励,嗯,快一年了。
作者: hamill    时间: 2016-4-17 05:09:50

挖个坟学习下。
作者: aijessica    时间: 2016-6-28 01:33:48


谢谢楼主大大免费分享!学习了
作者: ABC不是菜    时间: 2016-9-11 20:46:03

辛苦了
作者: Kairu    时间: 2016-11-25 20:18:59

很漂亮,谢谢大神
作者: 夜芯筁    时间: 2018-9-12 21:37:17

感谢分享!!
作者: Seekladoom    时间: 2021-7-12 02:01:34

感谢分享
作者: Seekladoom    时间: 2021-7-12 18:32:46

if _j == num的用法跟Aegisub的fx name有相似之处啊。

分段执行ass_main的内容原来是靠if _i == num、if _j == num的方式实现的。。。_(:з」∠)_




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