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

标题: [jiji]005_shingeki no kyojin_OP1 [打印本页]

作者: jijidata    时间: 2013-11-22 00:37:19     标题: [jiji]005_shingeki no kyojin_OP1

  1. from tcaxPy import *
  2. from s import *
  3. from gdiFont import *  #加入GDIfont模块
  4. import math
  5. import random

  6. def tcaxPy_Init():
  7.     global _FontFileName
  8.     global _FaceID
  9.     global _Fs
  10.     global _TextWidth
  11.     global _TextHeight
  12.     global _TextLength
  13.     global _TextAdvDiff
  14.     global _ResolutionX
  15.     global _FD
  16.     global _TextInitX
  17.     global _Ascender        # 字体上行高度
  18.     global _Descender        # 字体下行高度 通常为负数
  19.     global _H
  20.     _H = GetVal(val_FontSize)
  21.     _FontFileName = GetVal(val_FontFileName)
  22.     _FaceID       = GetVal(val_FaceID)
  23.     _Fs           = GetVal(val_FontSize)
  24.     _Ascender = GetVal(val_Ascender) #字体上行高度
  25.     _TextHeight   = GetVal(val_TextHeight)# 第i句卡拉OK歌词的j个字符的高度
  26.     _TextWidth    = GetVal(val_TextWidth)# 第i句卡拉OK歌词的j个字符的宽度
  27.     _TextLength   = GetVal(val_TextLength)# 第i句卡拉OK歌词的文字总长度
  28.     _TextAdvDiff  = GetVal(val_TextAdvanceDiff)# 从初始位置到第i句卡拉OK歌词的j个字符的水平步距
  29.     _TextInitX  = GetVal(val_TextInitX)
  30.     _ResolutionX  = GetVal(val_ResolutionX)
  31.     _FD           = 1000 / GetVal(val_FXFPS)
  32.     global GdiFont   #GDIfont
  33.     GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False)   #GDIfont
  34.     global Font
  35.     Font = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)



  36. def p(y):#绘图缩放代码
  37.     if y == int(y):
  38.         Y = str(int(y))
  39.     else:
  40.         Y = str(format(y, '.2f'))
  41.     return '\\p{0}'.format(Y)
  42.    
  43. def frxyz(x):
  44.     X1 = randint(-x,x)
  45.     X2 = randint(-x,x)
  46.     X3 = randint(-x,x)
  47.     return frx(X1)+fry(X2)+frz(X3)
  48.    


  49. def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
  50.     ASS_BUF = []                # 用于保存ASS特效
  51.     _7X = _X - int(_A / 2 + 0.5)              
  52.     _7Y = _Y - int(_H / 2 + 0.5)   

  53.             
  54.     if _i == 0:
  55.         ass_main(ASS_BUF,SubL(_BT-40+_j*3.4,_BT+_SK,1),an(5)+b(1)+bord(1)+be(10)+pos(_X,_Y)+fsc(200,200)+fad(400,0)+t(0,400,fsc(100,100)+be(1)+blur(6)) ,_TXT)#入场效果
  56.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,1),an(5)+b(1)+bord(1)+blur(6)+org(_X,_Y)+move(_X+randint(-15,15),_Y+randint(-15,15),_X+randint(-15,15),_Y+randint(-15,15))+fsc(randint(80,130),randint(80,130))+t(frxyz(360)) ,_TXT)#表现方式
  57.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_BT+_SK+_KT+100,1),an(5)+b(1)+bord(0)+blur(6)+be(1)+org(_X,_Y)+move(_X+randint(-15,15),_Y+randint(-15,15),_X+randint(-15,15),_Y+randint(-15,15))+t(frxyz(720))+alpha(255) ,_TXT)#退场效果
  58.         for j in range(0,60):
  59.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,2),an(5)+bord(0)+fsc(randint(40,80),randint(40,80))+frxyz(720)+blur(8)+org(_X,_Y)+move(_X-j*2+randint(-15,15),_Y-j*2+randint(-15,15),_X+j*3+randint(-15,15),_Y-j+randint(-15,15))+alpha(j*(255/_Fs)) ,"{\p1}m 0 16 l 38 16 l 38 19 l 0 19 m 8 2 l 10 0 l 19 15 l 30 33 l 28 35 m 28 0 l 30 2 l 10 35 l 8 33 l 11 28 m 5 16 l 2 11 l 3 9 l 8 16 m 12 9 l 3 9 l 4 7 l 12 7 m 13 5 l 16 0 l 19 0 l 14 7 m 24 7 l 19 0 l 22 0 l 25 5 m 27 7 l 34 7 l 35 9 l 25 9 m 30 16 l 35 9 l 36 11 l 33 16 m 33 19 l 36 24 l 35 26 l 30 19 m 25 26 l 35 26 l 34 28 l 27 28 m 25 30 l 22 35 l 19 35 l 24 28 m 14 28 l 19 35 l 16 35 l 13 30 ")#附加效果
  60.             
  61.     if _i > 0 and _i <5:
  62.         ass_main(ASS_BUF,SubL(_BT-40+_j*10,_BT+_SK,1),an(5)+bord(1)+b(1)+blur(10)+fad(1000,0)+move(_X-50,_Y-20,_X,_Y,0,400) ,_TXT)#入场效果
  63.         BT = _BT+_SK
  64.         ET = _BT+_SK+_KT
  65.         ET2 = _ET
  66.         EFT1 = alt(BT,ET, t=40,FX1 = fscy(60), FX2 = fscy(200), offset = 0, a1 = None,a2 = None)
  67.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,1),an(5)+b(1)+blur(15)+fad(0,50)+pos(_X,_Y)+vc3("00BAFF","00BAFF","0090FF","0090FF")+bord(3)+t(rnd(10))+EFT1 ,_TXT)#表现方式1
  68.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,1),an(5)+b(1)+blur(15)+fad(0,50)+pos(_X,_Y)+xbord(2)+t(rnd(10))+EFT1 ,_TXT)#表现方式2
  69.         EFT2 = alt(BT,ET2, t=40,FX1 = fscy(100), FX2 = fscy(120), offset = 0, a1 = rnd(2),a2 = rnd(20))
  70.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,1),an(5)+b(1)+bord(1)+blur(10)+vc3("00BAFF","00BAFF","0090FF","0090FF")+pos(_X,_Y)+EFT2 ,_TXT)#衔接
  71.         ass_main(ASS_BUF,SubL(_ET,_ET+60,1),an(5)+b(1)+bord(1)+blur(10)+rnd(10)+move(_X,_Y,_X-randint(10,40),_Y+randint(30,80))+fad(0,700)+t(fsc(100,0)+frx(720)) ,_TXT)#退场效果
  72.         for j in range(3):
  73.             ass_main(ASS_BUF,SubL(_BT+_SK+1,_BT+_SK+_KT+10,2),an(5)+alpha(150)+org(_X,_Y)+fad(80,360)+be(8)+bord(1)+vc1("00BAFF","00BAFF","0090FF","0090FF")+blur(6)+shad(0)+fsc(5,5)+frz(360)+move(_X,_Y,_X-randint(-10,10),_Y-randint(-30,30))+t(200,1200,bord(2))+t(0,_KT*10,fsc(randint(50,120),randint(50,120))+rnd(80))+t(100,300,frz(45))+t(_KT*10,_KT*10+100,fsc(randint(50,100),randint(50,100))+frz(randint(-368,360))) ,"{\p2}m 38 -20 b 38 -20 38 -20 38 -20 b 38 -20 38 -17 38 -17 b 38 -17 38 -17 38 -17 b 84 74 38 61 38 104 l 38 101 l 38 40 l -20 40 l 96 40 b 58 40 61 -26 -20 40 b 14 55 49 74 84 88 b 70 77 52 64 38 52 b 61 74 40 55 18 40 b 23 40 32 40 38 40 b 18 40 58 40 96 40 b 18 40 38 40 96 40 b 6 37 55 40 93 40 b -3 101 55 40 38 40 l 38 40 b 38 40 38 40 38 40 b 38 40 38 40 38 40 b 38 40 38 40 38 40 b 38 40 38 40 38 40 b 38 40 38 40 38 40 b 20 55 6 74 -12 88 b 38 52 38 64 38 77 b 38 19 38 1 38 -20 b 38 -20 38 -17 38 -17 b -3 77 38 61 38 104 ")
  74.             
  75.     if _i > 4 and _i < 9 :
  76.         ass_main(ASS_BUF,SubL(_BT+15*(_j-_n),_BT+_SK,1),an(5)+b(1)+blur(2)+org(_X,_Y+_Fs/2)+move(_X+15,_Y-15,_X,_Y,0,500)+bord(1)+alpha(255)+fsc(60,60)+t(0,800,0.6,frz(720)+fsc(100,100)+alpha3(0))+t(800,1000,alpha(00)) ,_TXT)#表现方式1
  77.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+20,1),an(5)+b(1)+blur(8)+bord(6)+pos(_X,_Y)+fad(0,100)+t(0,_KT*3,fsc(130,130))+t(_KT*3,_KT*10,fsc(100,100)+bord(2.5)+blur(2)) ,_TXT)#表现方式
  78.         ass_main(ASS_BUF,SubL(_BT+_SK-50,_BT+_SK+_KT,1),an(5)+blur(8)+fad(300,100)+move(_X+randint(-78,78),_Y+randint(-78,78),_X,_Y),"{\p3}m 30 23 b 24 23 24 33 30 33 b 36 33 37 23 30 23 m 35 27 l 61 28 l 35 29 m 26 27 l 0 28 l 26 29 m 29 23 l 30 0 l 31 23 m 29 33 l 30 57 l 31 33")#附加效果1
  79.         for j in range(3):
  80.             BT=_BT+_SK
  81.             ET=_BT+_SK+_KT+50
  82.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+50,1),an(5)+blur(7)+fad(300,100)+move(_X,_Y,_X+randint(-120,120),_Y+randint(-120,120))+fsc(110,110)+alt(BT,ET, t = 50 , FX1 = alpha(255), FX2 = alpha(0), offset = 0, a1 = None,a2 = None),"{\p3}m 30 23 b 24 23 24 33 30 33 b 36 33 37 23 30 23 m 35 27 l 61 28 l 35 29 m 26 27 l 0 28 l 26 29 m 29 23 l 30 0 l 31 23 m 29 33 l 30 57 l 31 33")#附加效果2
  83.     if _i > 8 and _i < 16 :
  84.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,1),an(5)+b(1)+pos(_X,_Y)+color("FFFFFF")+alpha3(100)+blur(10)+fsc(150,150)+rndy(80)+rndz(80)+rnd(10)+t(rndy(0)+rndz(0)+rnd(0)+fsc(100,100)+alpha3(0)+color3("000000")) ,_TXT)
  85.         BT=_BT+_SK+_KT
  86.         ET=_ET
  87.         EFT1 = alt(BT,ET, t = 100 , FX1 = rnd(2), FX2 = rnd(0), offset = 0, a1 = rndy(2),a2 = rndy(0))
  88.         EFT2 = alt(BT,ET, t = 100 , FX1 = rndz(2), FX2 = rndz(0), offset = 0, a1 =None,a2 = None )
  89.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,1),an(5)+b(1)+blur(6)+org(_X-2000,_Y-500)+pos(_X,_Y)+EFT1+EFT2 ,_TXT)
  90.         ass_main(ASS_BUF,SubL(_ET,_ET+_j*2,1),an(5)+b(1)+blur(6)+move(_X,_Y,_X-100,_Y-50)+t(frz(-90))+fad(0,100) ,_TXT)
  91.         for j in range (5):
  92.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+20,1),an(5)+pos(_X,_Y)+org(_X,_Y+_Fs/2)+bord(0.341111111)+fad(0,200)+blur(5)+alpha(230+j*1)+color3( FmtRGB(randint(200, 255), randint(200, 255), randint(200, 255)))+t(0,20*_KT,frx(90-j*10)+blur(4)) ,_TXT)
  93.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+20,1),an(5)+pos(_X,_Y)+org(_X,_Y+_Fs/2)+bord(0.341111111)+fad(0,200)+blur(5)+alpha(230+j*1)+color3( FmtRGB(randint(200, 255), randint(200, 255), randint(200, 255)))+t(0,20*_KT,frx(90+j*10)+blur(4)) ,_TXT)
  94.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+20,1),an(5)+pos(_X,_Y)+org(_X,_Y+_Fs/2)+bord(0.341111111)+fad(0,200)+blur(5)+alpha(230+j*1)+color3( FmtRGB(randint(200, 255), randint(200, 255), randint(200, 255)))+t(0,20*_KT,fry(90-j*10)+blur(4)) ,_TXT)
  95.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+20,1),an(5)+pos(_X,_Y)+org(_X,_Y+_Fs/2)+bord(0.341111111)+fad(0,200)+blur(5)+alpha(230+j*1)+color3( FmtRGB(randint(200, 255), randint(200, 255), randint(200, 255)))+t(0,20*_KT,fry(90+j*10)+blur(4)) ,_TXT)
  96.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+20,1),an(5)+pos(_X,_Y)+org(_X,_Y+_Fs/2)+bord(0.341111111)+fad(0,200)+blur(5)+alpha(230+j*1)+color3( FmtRGB(randint(200, 255), randint(200, 255), randint(200, 255)))+t(0,20*_KT,frz(90-j*10)+blur(4)) ,_TXT)
  97.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+20,1),an(5)+pos(_X,_Y)+org(_X,_Y+_Fs/2)+bord(0.341111111)+fad(0,200)+blur(5)+alpha(230+j*1)+color3( FmtRGB(randint(200, 255), randint(200, 255), randint(200, 255)))+t(0,20*_KT,frz(90+j*10)+blur(4)) ,_TXT)
  98.             
  99.     if _i > 15 :
  100.         ass_main(ASS_BUF,SubL(_BT-40+_j*2,_BT+_SK,1),an(5)+b(1)+pos(_X,_Y)+fad(200,0)+fsc(0,0)+t(0,200,fsc(220,220))+t(200,330,fsc(80,80))+t(330,520,fsc(140,140))+t(520,610,fsc(150,150))+t(610,710,fsc(120,120))+t(710,820,fsc(100,100))+rndy(20)+t(rndy(0))+blur(6) ,_TXT)
  101.         BT=_BT+_SK
  102.         ET=_BT+_SK+_KT
  103.         EFT1 = alt(BT,ET, t = 40 , FX1 =frz(-1), FX2 = frz(1), offset = 0, a1 = None,a2 = None)
  104.         EFT2 = alt(BT,ET, t = 40 , FX1 =frz(-1), FX2 = frz(1), offset = 0, a1 = color3("FFFFFF"),a2 = color3("060874"))
  105.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,5),an(5)+b(1)+org(_X,_Y+300)+pos(_X,_Y)+fscy(150)+rndx(10)+blur(8)+t(rndx(0)+fscy(100))+EFT1 ,_TXT)
  106.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,5),an(5)+b(1)+blur(8)+org(_X,_Y+300)+move(_X,_Y+5,_X,_Y-5)+fscy(150)+bord(4)+t(fscy(100))+alpha3(128)+EFT2 ,_TXT)
  107.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,5),an(5)+b(1)+blur(6)+pos(_X,_Y) ,_TXT)
  108.         ass_main(ASS_BUF,SubL(_ET,_ET+30,5),an(5)+b(1)+blur(3)+move(_X,_Y,_X+randint(-800,800),_Y+randint(-30,30))+fad(0,300)+bord(2)+t(frz(randint(-1280,1280))+fsc(randint(20,100),randint(20,100))) ,_TXT)
  109.         for j in range(20):
  110.             ass_main(ASS_BUF,SubL(_BT+_SK-10,_BT+_SK+_KT+50,1),an(5)+be(8)+fad(100,300)+blur(8)+move(_X,_Y,_X-randint(200,400),_Y-randint(-60,60))+fsc(30,30)+p(randint(2,3)) ,"m 20 0 b 20 10 30 20 40 20 b 30 20 20 30 20 40 b 20 30 10 20 0 20 b 10 20 20 10 20 0")
  111.         
  112.         
  113.    
  114.    
  115.    
  116.    
  117.    
  118.    
  119.     return (ASS_BUF, None)
复制代码
预览:
http://pan.baidu.com/s/1veY1J



作者: jijidata    时间: 2013-11-22 00:41:41

  1. # tcc file version

  2. < tcc file version = 1.000 >

  3. # mode configuration

  4. < inherit ass header = false >
  5. < k mode = word >
  6. < text layout = horizontal >
  7. < tcaxpy init = true >
  8. < tcaxpy user = false >
  9. < tcaxpy fin = false >

  10. # py settings
  11. < py file = jiji-005.py >    < beg line = 1 >    < end line = 0 >





  12. < k-timed ass file = kyojinop_k.ass >
  13. < font file = elenat.TTF >    < font face id = 1 >    < font size = 40 >
  14. < fx width = 1280 >    < fx height = 720 >    < fx fps = 23.976 >
  15. < alignment = 2 >
  16. < x offset = 10 >    < y offset = 20 >
  17. < spacing = 0 >    < space scale = 1.000 >



  18. # style settings

  19. < font face name = "" >
  20. < bord = 1 >    < shad = 0 >
  21. < primary color = FFFFFF >    < secondary color = 000000 >    < outline color = 060874 >    < back color = 000000 >
  22. < primary alpha = 0 >    < secondary alpha = 240 >    < outline alpha = 0 >    < back alpha = 240 >

  23. # additional settings

  24. < blur = 0.000 >
复制代码
顺便贴上tcc作为参考




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