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

 找回密码
 新人加入
查看: 5787|回复: 4
打印 上一主题 下一主题

[完整特效] [jiji]011_Sword Art OnlineⅡ OP2 Karaoke effect [复制链接]

Rank: 5Rank: 5

跳转到指定楼层
楼主
发表于 2014-11-2 00:41:25 |只看该作者 |倒序浏览
本帖最后由 jijidata 于 2014-11-2 01:13 编辑

很长,但好多都是重复的,就改了个颜色代码...


日文:
  1. from tcaxPy import *
  2. from s import *
  3. from util.gdiFont import *  #加入GDIfont模块
  4. from util.tcCurve import *
  5. import math
  6. import random
  7. from util.cairo import *


  8. def tcaxPy_Init():
  9.     global _FontFileName
  10.     global _FaceID
  11.     global _Fs
  12.     global _TextWidth
  13.     global _TextHeight
  14.     global _TextLength
  15.     global _TextAdvDiff
  16.     global _ResolutionX
  17.     global _FD
  18.     global _TextInitX
  19.     global _Ascender        # 字体上行高度
  20.     global _Descender        # 字体下行高度 通常为负数
  21.     global _H
  22.     global _3C
  23.     global _KarTime         
  24.     _KarTime = GetVal(val_KarTime)# 第i句卡拉OK歌词的第j个字符的Karaoke时间 = !$start!
  25.     _H = GetVal(val_FontSize)
  26.     _3C = GetVal(val_3C)
  27.     _FontFileName = GetVal(val_FontFileName)
  28.     _FaceID       = GetVal(val_FaceID)
  29.     _Fs           = GetVal(val_FontSize)
  30.     _Ascender = GetVal(val_Ascender) #字体上行高度
  31.     _TextHeight   = GetVal(val_TextHeight)# 第i句卡拉OK歌词的j个字符的高度
  32.     _TextWidth    = GetVal(val_TextWidth)# 第i句卡拉OK歌词的j个字符的宽度
  33.     _TextLength   = GetVal(val_TextLength)# 第i句卡拉OK歌词的文字总长度
  34.     _TextAdvDiff  = GetVal(val_TextAdvanceDiff)# 从初始位置到第i句卡拉OK歌词的j个字符的水平步距
  35.     _TextInitX  = GetVal(val_TextInitX)
  36.     _ResolutionX  = GetVal(val_ResolutionX)
  37.     _FD           = 1000 / GetVal(val_FXFPS)
  38.     global GdiFont   #GDIfont
  39.     GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False)   #GDIfont
  40.     global Font
  41.     Font = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
  42.    
  43.     global ctx
  44.     fx_width = GetVal(val_ResolutionX)
  45.     fx_height = GetVal(val_ResolutionY)
  46.     surface = ImageSurface(FORMAT_ARGB32, fx_width, fx_height)
  47.     ctx = Context(surface)


  48. def p(y):#绘图缩放代码
  49.     if y == int(y):
  50.         Y = str(int(y))
  51.     else:
  52.         Y = str(format(y, '.2f'))
  53.     return '\\p{0}'.format(Y)
  54.    
  55. def frxyz(x):
  56.     X1 = randint(-x,x)
  57.     X2 = randint(-x,x)
  58.     X3 = randint(-x,x)
  59.     return frx(X1)+fry(X2)+frz(X3)

  60. def x_filter(x, y, param):
  61.     _A, dx, dy, frame_pct = param
  62.     max_diff_x = randint(-1* 8,1* 8)
  63.     max_diff_y = randint(-1* 8,1* 8)  
  64.     p = 1+0.5*(1-frame_pct)
  65.     new_x = floor(x*p-_A*4*(p-1) +  max_diff_x)
  66.     new_y = floor(y*p-_Fs*4*(p-1) +  max_diff_y)
  67.     return new_x, new_y

  68.    
  69. class Randnon_rep : #生成不重复随机整数
  70.     def __init__(self):
  71.         self.num = []
  72.         
  73.     def randnum(self,n,m) :
  74.         data = random.randint(n,m)
  75.         while True:
  76.             if len(self.num) < (m-n+1) :
  77.                 if data not in self.num:
  78.                     self.num.append(data)
  79.                     return data
  80.                 else :
  81.                     data = random.randint(n,m)
  82.             else :
  83.                 self.num = []
  84. rdm = Randnon_rep()


  85. colour = ["B4942F","614EB6","EAAA95","9A401E","7B9E41","41C9A4","3E9EF2","7F3147","786E34"]
  86. shape = ["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 ","m 6 0 b 12 0 12 7 6 7 b 0 7 0 0 6 0 ","m 15 0 l 10 7 l 0 9 l 9 13 l 5 23 l 15 17 l 25 23 l 21 13 l 31 9 l 20 7 l 15 0 "]

  87. def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
  88.     ASS_BUF = []                # 用于保存ASS特效
  89.     _7X = _X - int((_A + GetVal(val_Spacing)) / 2 + 0.5)              #每个字的上X坐标= !$left!
  90.     _7Y = _Y - int(_Fs / 2 + 0.5)                                                 #每个字的上Y坐标=!$top!
  91.     _bottom = _Y + int(_H / 2 + 0.5)                                        #每个字的下Y坐标

  92.     if (_i > -1 and _i <4) :
  93.         ass_main(ASS_BUF, SubL(_BT-25+rdm.randnum(-5,25),_BT),pos(_X, _Y)+blur(2)+color3(colour[0]), _TXT)
  94.         ass_main(ASS_BUF, SubL(_BT,_BT+_SK-5),an(5)+pos(_X, _Y)+blur(2)+color3(colour[0]), _TXT)
  95.         
  96.         frames = int((_KT+2)*10 / _FD + 0.5)
  97.         for i in range(frames):
  98.             ts = _BT+_SK-5 + i * _FD / 10
  99.             te = _BT+_SK-5 + (i + 1) * _FD / 10
  100.             frame_pct = i / frames
  101.             outline = gfGetOutline(GdiFont, _TXT, 0, 0)
  102.             AssDraw(ctx, outline)
  103.             path_trans(ctx, x_filter,(_A,_X,_Y,frame_pct))
  104.             text = ToAssDraw(ctx)
  105.             EFT = an(7) + pos(_7X,_7Y) +bord(1.5)+blur(3)+color3(colour[0])+color4(colour[0])+ p(4)
  106.             ass_main(ASS_BUF, SubL(ts, te,20), EFT, text)
  107.         for j in range(math.ceil(_KT)):                                      #粒子轨迹
  108.             J = [math.ceil(_KT)]
  109.             step1 = _KT*10*(j-1)/(max(J)*10-1)
  110.             XC1= _7X+_A*(j+1)/max(J)                      #X的实际坐标,从每个字的左边移动到右边(这是spacing为0的情况下,spacing不为0需修改代码,嗯~我偷懒了)
  111.             _SY = _Y - int(_H / 2 + 0.5)*(-1)**_j          #Y坐标初始坐标,依次为每个字的上顶点,下顶点,
  112.             _CY = (-1)**_j*_H*(j+1)/max(J)                 #Y坐标的控制参数,含义为依次加上字符的高度,减去字符的高度
  113.             YC1= _SY+_CY                                       #Y坐标的实际坐标,由以上初始坐标加上控制参数生成
  114.             XC2= XC1-_A*0.1*randint(10,40)
  115.             YC2= YC1+random.uniform(-0.4*_A,0.4*_A)
  116.             CurveMove = move(XC1,YC1,XC2,YC2)
  117.             ass_main(ASS_BUF,SubL(_BT+_SK+step1,_BT+_SK+_KT+step1+70,2),an(5)+color3(colour[0])+blur(4)+bord(0.5)+fad(0,300)+t(frxyz(720))+CurveMove+p(1)+fsc(randint(20,40),randint(20,40)),shape[randint(0,2)])
  118.             
  119.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT-5,_ET,2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[0]) ,_TXT)
  120.         ass_main(ASS_BUF,SubL(_ET,_ET+10+rdm.randnum(-5,10),2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[0]) ,_TXT)

  121.     elif (_i > 3 and _i <6) :
  122.         ass_main(ASS_BUF, SubL(_BT-25+rdm.randnum(-5,25),_BT),pos(_X, _Y)+blur(2)+color3(colour[1]), _TXT)
  123.         ass_main(ASS_BUF, SubL(_BT,_BT+_SK-5),an(5)+pos(_X, _Y)+blur(2)+color3(colour[1]), _TXT)
  124.         
  125.         frames = int((_KT+2)*10 / _FD + 0.5)
  126.         for i in range(frames):
  127.             ts = _BT+_SK-5 + i * _FD / 10
  128.             te = _BT+_SK-5 + (i + 1) * _FD / 10
  129.             frame_pct = i / frames
  130.             outline = gfGetOutline(GdiFont, _TXT, 0, 0)
  131.             AssDraw(ctx, outline)
  132.             path_trans(ctx, x_filter,(_A,_X,_Y,frame_pct))
  133.             text = ToAssDraw(ctx)
  134.             EFT = an(7) + pos(_7X,_7Y) +bord(1.5)+blur(3)+color3(colour[1])+color4(colour[1])+ p(4)
  135.             ass_main(ASS_BUF, SubL(ts, te,20), EFT, text)
  136.         
  137.         for j in range(math.ceil(_KT)):                                      #粒子轨迹
  138.             J = [math.ceil(_KT)]
  139.             step1 = _KT*10*(j-1)/(max(J)*10-1)
  140.             XC1= _7X+_A*(j+1)/max(J)                      #X的实际坐标,从每个字的左边移动到右边(这是spacing为0的情况下,spacing不为0需修改代码,嗯~我偷懒了)
  141.             _SY = _Y - int(_H / 2 + 0.5)*(-1)**_j          #Y坐标初始坐标,依次为每个字的上顶点,下顶点,
  142.             _CY = (-1)**_j*_H*(j+1)/max(J)                 #Y坐标的控制参数,含义为依次加上字符的高度,减去字符的高度
  143.             YC1= _SY+_CY                                       #Y坐标的实际坐标,由以上初始坐标加上控制参数生成
  144.             XC2= XC1-_A*0.1*randint(10,40)
  145.             YC2= YC1+random.uniform(-0.4*_A,0.4*_A)
  146.             CurveMove = move(XC1,YC1,XC2,YC2)
  147.             ass_main(ASS_BUF,SubL(_BT+_SK+step1,_BT+_SK+_KT+step1+70,2),an(5)+color3(colour[1])+blur(4)+bord(0.5)+fad(0,300)+t(frxyz(720))+CurveMove+p(1)+fsc(randint(20,40),randint(20,40)),shape[randint(0,2)])
  148.             

  149.             
  150.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT-5,_ET,2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[1]) ,_TXT)
  151.         ass_main(ASS_BUF,SubL(_ET,_ET+10+rdm.randnum(-5,10),2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[1]) ,_TXT)

  152.     elif (_i > 5 and _i <8) :
  153.         ass_main(ASS_BUF, SubL(_BT-25+rdm.randnum(-5,25),_BT),pos(_X, _Y)+blur(2)+color3(colour[2]), _TXT)
  154.         ass_main(ASS_BUF, SubL(_BT,_BT+_SK-5),an(5)+pos(_X, _Y)+blur(2)+color3(colour[2]), _TXT)
  155.         
  156.         frames = int((_KT+2)*10 / _FD + 0.5)
  157.         for i in range(frames):
  158.             ts = _BT+_SK-5 + i * _FD / 10
  159.             te = _BT+_SK-5 + (i + 1) * _FD / 10
  160.             frame_pct = i / frames
  161.             outline = gfGetOutline(GdiFont, _TXT, 0, 0)
  162.             AssDraw(ctx, outline)
  163.             path_trans(ctx, x_filter,(_A,_X,_Y,frame_pct))
  164.             text = ToAssDraw(ctx)
  165.             EFT = an(7) + pos(_7X,_7Y) +bord(1.5)+blur(3)+color3(colour[2]) + p(4)
  166.             ass_main(ASS_BUF, SubL(ts, te,20), EFT, text)
  167.             
  168.         for j in range(math.ceil(_KT)):                                      #粒子轨迹
  169.             J = [math.ceil(_KT)]
  170.             step1 = _KT*10*(j-1)/(max(J)*10-1)
  171.             XC1= _7X+_A*(j+1)/max(J)                      #X的实际坐标,从每个字的左边移动到右边(这是spacing为0的情况下,spacing不为0需修改代码,嗯~我偷懒了)
  172.             _SY = _Y - int(_H / 2 + 0.5)*(-1)**_j          #Y坐标初始坐标,依次为每个字的上顶点,下顶点,
  173.             _CY = (-1)**_j*_H*(j+1)/max(J)                 #Y坐标的控制参数,含义为依次加上字符的高度,减去字符的高度
  174.             YC1= _SY+_CY                                       #Y坐标的实际坐标,由以上初始坐标加上控制参数生成
  175.             XC2= XC1-_A*0.1*randint(10,40)
  176.             YC2= YC1+random.uniform(-0.4*_A,0.4*_A)
  177.             CurveMove = move(XC1,YC1,XC2,YC2)
  178.             ass_main(ASS_BUF,SubL(_BT+_SK+step1,_BT+_SK+_KT+step1+70,2),an(5)+color3(colour[2])+blur(4)+bord(0.5)+fad(0,300)+t(frxyz(720))+CurveMove+p(1)+fsc(randint(20,40),randint(20,40)),shape[randint(0,2)])
  179.             
  180.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT-5,_ET,2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[2]) ,_TXT)
  181.         ass_main(ASS_BUF,SubL(_ET,_ET+10+rdm.randnum(-5,10),2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[2]) ,_TXT)
  182.         
  183.     elif (_i > 7 and _i < 10 ) :
  184.         if _j < 0.1*_n*randint(3,8) :
  185.             ass_main(ASS_BUF, SubL(_BT-40,_BT-20),move(_X+200, _Y-200,_X+19,_Y-19)+fsc(0,0)+t(fsc(90,90))+fad(100,0)+blur(2)+color3(colour[3]), _TXT)
  186.             ass_main(ASS_BUF, SubL(_BT-20,_BT),move(_X+19,_Y-19,_X,_Y)+fsc(90,90)+t(fsc(100,100))+fad(100,0)+blur(2)+color3(colour[3]), _TXT)
  187.         else :
  188.             ass_main(ASS_BUF, SubL(_BT-30,_BT-10),move(_X+200, _Y-200,_X+19,_Y-19)+fsc(0,0)+t(fsc(90,90))+fad(100,0)+blur(2)+color3(colour[3]), _TXT)
  189.             ass_main(ASS_BUF, SubL(_BT-10,_BT),move(_X+19,_Y-19,_X,_Y)+fsc(90,90)+t(fsc(100,100))+fad(100,0)+blur(2)+color3(colour[3]), _TXT)
  190.         ass_main(ASS_BUF, SubL(_BT,_BT+_SK+5),an(5)+pos(_X, _Y)+blur(2)+color3(colour[3])+fad(0,80), _TXT)
  191.         
  192.         outline = TextOutlinePoints(Font, _TXT, 1.0)                                      #表现方法
  193.         outnline = TextOutlinePoints(_FontFileName, _FaceID, 45, _TXT, 1.0)
  194.         num = len(outline)
  195.         for i in range(num):
  196.             ts = _BT + _SK +int(i/num*_KT)
  197.             te = _BT + _SK +int(i/num*_KT)+50
  198.             x = _7X + outline[i][0]
  199.             y = _7Y + outline[i][1]
  200.             x1 = _7X + outnline[i][0]
  201.             y1 = _7Y + outnline[i][1]-5
  202.             EFT = move(x, y, x1, y1)+alpha1(0)+alpha3(0)+bord(1)+blur(2)+shad(0)+color3(colour[3])+color1(colour[3])+fad(0, 300)
  203.             ass_main(ASS_BUF, SubL(ts, te, 3, Pix_Style), EFT, PixPt())
  204.         
  205.         ass_main(ASS_BUF,SubL(_BT+_SK+49,_ET,2),an(5)+pos(_X, _Y)+fad(100,0)+blur(2)+color3(colour[3]) ,_TXT)
  206.         ass_main(ASS_BUF,SubL(_ET,_ET+30,2),an(5)+org(0,0)+t(frz(rdm.randnum(-6,6))+fsc(0,0)+alpha3(0)+color1(colour[3]))+move(_X,_Y,_X+randint(-400,400),_Y+randint(-400,100))+fad(0,120)+color3(colour[3]) ,_TXT)  
  207.         
  208.     elif _i == 10 or _i == 11:
  209.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[4])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  210.         ass_main(ASS_BUF, SubL(_BT+10,_BT+_SK+5),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[3]))+fad(0,80), _TXT)
  211.         
  212.         outline = TextOutlinePoints(Font, _TXT, 1.0)                                     #表现方法
  213.         outnline = TextOutlinePoints(_FontFileName, _FaceID, 45, _TXT, 1.0)
  214.         num = len(outline)
  215.         for i in range(num):
  216.             ts = _BT + _SK +int(i/num*_KT)
  217.             te = _BT + _SK +int(i/num*_KT)+50
  218.             x = _7X + outline[i][0]
  219.             y = _7Y + outline[i][1]
  220.             x1 = _7X + outnline[i][0]
  221.             y1 = _7Y + outnline[i][1]-5
  222.             EFT = move(x, y, x1, y1)+alpha1(0)+alpha3(0)+bord(1)+blur(2)+shad(0)+color3(colour[3])+color1(colour[3])+fad(0, 300)
  223.             ass_main(ASS_BUF, SubL(ts, te, 3, Pix_Style), EFT, PixPt())
  224.             
  225.         ass_main(ASS_BUF,SubL(_BT+_SK+49,_ET,2),an(5)+pos(_X, _Y)+fad(100,0)+blur(2)+color3(colour[3]) ,_TXT)
  226.         ass_main(ASS_BUF, SubL(_ET,_ET+30),an(5)+pos(_X, _Y)+t(0,50,bord(0)+alpha3(255))+t(30,300,fsc(160,160)+blur(15)+be(15)), _TXT)
  227.         
  228.     elif _i == 12:
  229.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[4])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  230.         ass_main(ASS_BUF, SubL(_BT+10,_BT+_SK+5),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[5]))+fad(0,80), _TXT)
  231.         
  232.         outline = TextOutlinePoints(Font, _TXT, 1.0)                                     #表现方法
  233.         outnline = TextOutlinePoints(_FontFileName, _FaceID, 45, _TXT, 1.0)
  234.         num = len(outline)
  235.         for i in range(num):
  236.             ts = _BT + _SK +int(i/num*_KT)
  237.             te = _BT + _SK +int(i/num*_KT)+50
  238.             x = _7X + outline[i][0]
  239.             y = _7Y + outline[i][1]
  240.             x1 = _7X + outnline[i][0]
  241.             y1 = _7Y + outnline[i][1]-5
  242.             EFT = move(x, y, x1, y1)+alpha1(0)+alpha3(0)+bord(1)+blur(2)+shad(0)+color3(colour[5])+color1(colour[5])+fad(0, 300)
  243.             ass_main(ASS_BUF, SubL(ts, te, 3, Pix_Style), EFT, PixPt())
  244.             
  245.         ass_main(ASS_BUF,SubL(_BT+_SK+49,_ET,2),an(5)+pos(_X, _Y)+fad(100,0)+blur(2)+color3(colour[5]) ,_TXT)
  246.         for s in range(5):
  247.             ass_main(ASS_BUF, SubL(_BT+randint(-30,50),_ET+randint(100,150),2),an(5)+color3(colour[5])+fad(300,500)+blur(6)+fsc(randint(5,50),randint(5,50))+moves4(_X+randint(-90,70),_Y+randint(-80,60),_X+randint(-60,60),_Y+randint(-40,70),_X+randint(-60,60),_Y+randint(-40,68),_X+randint(-50,50),_Y+randint(-60,60)),"{\\p2}m 21 16 b 17 16 17 23 21 23 b 25 23 26 16 21 16 m 24 19 l 43 20 l 24 20 m 18 19 l 0 20 l 18 20 m 20 16 l 21 0 l 22 16 m 20 23 l 21 40 l 22 23 ")
  248.             
  249.         ass_main(ASS_BUF, SubL(_ET,_ET+30+rdm.randnum(-20,15)),an(5)+blur(2)+color3(colour[5])+move(_X, _Y,_X, _Y-randint(650,720))+t(alpha(255)), _TXT)
  250.         
  251.     elif _i == 13:
  252.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[5])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  253.         ass_main(ASS_BUF, SubL(_BT+10,_BT+_SK+5),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[6]))+fad(0,80), _TXT)
  254.         
  255.         outline = TextOutlinePoints(Font, _TXT, 1.0)                                     #表现方法
  256.         outnline = TextOutlinePoints(_FontFileName, _FaceID, 45, _TXT, 1.0)
  257.         num = len(outline)
  258.         for i in range(num):
  259.             ts = _BT + _SK +int(i/num*_KT)
  260.             te = _BT + _SK +int(i/num*_KT)+50
  261.             x = _7X + outline[i][0]
  262.             y = _7Y + outline[i][1]
  263.             x1 = _7X + outnline[i][0]
  264.             y1 = _7Y + outnline[i][1]-5
  265.             EFT = move(x, y, x1, y1)+alpha1(0)+alpha3(0)+bord(1)+blur(2)+shad(0)+color3(colour[6])+color1(colour[6])+fad(0, 300)
  266.             ass_main(ASS_BUF, SubL(ts, te, 3, Pix_Style), EFT, PixPt())
  267.             
  268.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT-10,_ET,2),an(5)+pos(_X, _Y)+fad(100,0)+blur(2)+color3(colour[6]) ,_TXT)
  269.         
  270.         for s in range(5):
  271.             ass_main(ASS_BUF, SubL(_BT+randint(-30,50),_ET+randint(100,150),2),an(5)+color3(colour[6])+fad(300,500)+blur(6)+fsc(randint(5,50),randint(5,50))+moves4(_X+randint(-90,70),_Y+randint(-80,60),_X+randint(-60,60),_Y+randint(-40,70),_X+randint(-60,60),_Y+randint(-40,68),_X+randint(-50,50),_Y+randint(-60,60)),"{\\p2}m 21 16 b 17 16 17 23 21 23 b 25 23 26 16 21 16 m 24 19 l 43 20 l 24 20 m 18 19 l 0 20 l 18 20 m 20 16 l 21 0 l 22 16 m 20 23 l 21 40 l 22 23 ")
  272.             
  273.         ass_main(ASS_BUF, SubL(_ET,_ET+30+rdm.randnum(-20,15)),an(5)+blur(2)+color3(colour[6])+move(_X, _Y,_X, _Y-randint(650,720))+t(alpha(255)), _TXT)


  274.         
  275.     elif _i ==14 :
  276.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[6])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  277.         ass_main(ASS_BUF, SubL(_BT+10,_BT+_SK),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[6]))+fad(0,80), _TXT)
  278.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,1),an(2)+pos(_X,_bottom)+color3(colour[6])+t(0,_KT*10/4.5,0.65,fscy(120)+bord(2)+blur(7))+t(_KT*10/2.5,_KT*10,1.35,fscy(100)+blur(2)+bord(1)) ,_TXT)
  279.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,2),an(5)+pos(_X, _Y)+blur(2)+color3(colour[6]) ,_TXT)
  280.         ass_main(ASS_BUF, SubL(_ET,_ET+30),an(5)+pos(_X, _Y)+t(0,50,bord(0)+alpha3(255))+t(30,300,fsc(160,160)+blur(15)+be(15)), _TXT)

  281.         
  282.         for j in range(10):
  283.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_Y+randint(-50,-10),_X+randint(-50,50),_Y+randint(-5,25)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  284.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_7Y+randint(-50,-10),_X+randint(-50,50),_7Y+randint(-15,15)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  285.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_bottom+randint(-5,5),_X+randint(-50,50),_bottom+randint(-5,100)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  286.         for k in range(3):
  287.             EFT = alt(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75), t = randint(60,100) , FX1 = alpha(255)+fsc(randint(5,10),randint(5,10)), FX2 = alpha(0)+fsc(randint(10,20),randint(10,20)), offset = 0, a1 = None,a2 = None)
  288.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.4)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-5,85))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  289.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.4)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-105,5))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  290.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.5)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-5,85))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  291.             
  292.     else  :
  293.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[8])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  294.         ass_main(ASS_BUF, SubL(_BT+10,_BT+_SK),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[8]))+fad(0,80), _TXT)
  295.         ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT,1),an(2)+pos(_X,_bottom)+color3(colour[8])+t(0,_KT*10/4.5,0.65,fscy(120)+bord(2)+blur(7))+t(_KT*10/2.5,_KT*10,1.35,fscy(100)+blur(2)+bord(1)) ,_TXT)
  296.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,2),an(5)+pos(_X, _Y)+blur(2)+color3(colour[8]) ,_TXT)
  297.         ass_main(ASS_BUF, SubL(_ET,_ET+30),an(5)+pos(_X, _Y)+t(0,50,bord(0)+alpha3(255))+t(30,300,fsc(160,160)+blur(15)+be(15)), _TXT)

  298.         
  299.         for j in range(10):
  300.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_Y+randint(-50,-10),_X+randint(-50,50),_Y+randint(-5,25)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  301.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_7Y+randint(-50,-10),_X+randint(-50,50),_7Y+randint(-15,15)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  302.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_bottom+randint(-5,5),_X+randint(-50,50),_bottom+randint(-5,100)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  303.         for k in range(3):
  304.             EFT = alt(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75), t = randint(60,100) , FX1 = alpha(255)+fsc(randint(5,10),randint(5,10)), FX2 = alpha(0)+fsc(randint(10,20),randint(10,20)), offset = 0, a1 = None,a2 = None)
  305.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.4)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-5,85))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  306.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.4)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-105,5))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  307.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.5)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-5,85))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  308.             
  309.     return (ASS_BUF,None)


  310.         
复制代码
#################################################################
中文:
  1. from tcaxPy import *
  2. from s import *
  3. from util.gdiFont import *  #加入GDIfont模块
  4. from util.tcCurve import *
  5. import math
  6. import random
  7. from util.cairo import *


  8. def tcaxPy_Init():
  9.     global _FontFileName
  10.     global _FaceID
  11.     global _Fs
  12.     global _TextWidth
  13.     global _TextHeight
  14.     global _TextLength
  15.     global _TextAdvDiff
  16.     global _ResolutionX
  17.     global _FD
  18.     global _TextInitX
  19.     global _Ascender        # 字体上行高度
  20.     global _Descender        # 字体下行高度 通常为负数
  21.     global _H
  22.     global _3C
  23.     global _KarTime         
  24.     _KarTime = GetVal(val_KarTime)# 第i句卡拉OK歌词的第j个字符的Karaoke时间 = !$start!
  25.     _H = GetVal(val_FontSize)
  26.     _3C = GetVal(val_3C)
  27.     _FontFileName = GetVal(val_FontFileName)
  28.     _FaceID       = GetVal(val_FaceID)
  29.     _Fs           = GetVal(val_FontSize)
  30.     _Ascender = GetVal(val_Ascender) #字体上行高度
  31.     _TextHeight   = GetVal(val_TextHeight)# 第i句卡拉OK歌词的j个字符的高度
  32.     _TextWidth    = GetVal(val_TextWidth)# 第i句卡拉OK歌词的j个字符的宽度
  33.     _TextLength   = GetVal(val_TextLength)# 第i句卡拉OK歌词的文字总长度
  34.     _TextAdvDiff  = GetVal(val_TextAdvanceDiff)# 从初始位置到第i句卡拉OK歌词的j个字符的水平步距
  35.     _TextInitX  = GetVal(val_TextInitX)
  36.     _ResolutionX  = GetVal(val_ResolutionX)
  37.     _FD           = 1000 / GetVal(val_FXFPS)
  38.     global GdiFont   #GDIfont
  39.     GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False)   #GDIfont
  40.     global Font
  41.     Font = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
  42.    
  43.     global ctx
  44.     fx_width = GetVal(val_ResolutionX)
  45.     fx_height = GetVal(val_ResolutionY)
  46.     surface = ImageSurface(FORMAT_ARGB32, fx_width, fx_height)
  47.     ctx = Context(surface)


  48. def p(y):#绘图缩放代码
  49.     if y == int(y):
  50.         Y = str(int(y))
  51.     else:
  52.         Y = str(format(y, '.2f'))
  53.     return '\\p{0}'.format(Y)
  54.    
  55. def frxyz(x):
  56.     X1 = randint(-x,x)
  57.     X2 = randint(-x,x)
  58.     X3 = randint(-x,x)
  59.     return frx(X1)+fry(X2)+frz(X3)

  60. def x_filter(x, y, param):
  61.     _A, dx, dy, frame_pct = param
  62.     max_diff_x = randint(-1* 8,1* 8)
  63.     max_diff_y = randint(-1* 8,1* 8)  
  64.     p = 1+0.5*(1-frame_pct)
  65.     new_x = floor(x*p-_A*4*(p-1) +  max_diff_x)
  66.     new_y = floor(y*p-_Fs*4*(p-1) +  max_diff_y)
  67.     return new_x, new_y

  68. class Randnon_rep : #生成不重复随机整数
  69.     def __init__(self):
  70.         self.num = []
  71.         
  72.     def randnum(self,n,m) :
  73.         data = random.randint(n,m)
  74.         while True:
  75.             if len(self.num) < (m-n+1) :
  76.                 if data not in self.num:
  77.                     self.num.append(data)
  78.                     return data
  79.                 else :
  80.                     data = random.randint(n,m)
  81.             else :
  82.                 self.num = []
  83. rdm = Randnon_rep()

  84. colour = ["B4942F","614EB6","EAAA95","9A401E","7B9E41","41C9A4","3E9EF2","7F3147","786E34"]
  85. shape = ["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 ","m 6 0 b 12 0 12 7 6 7 b 0 7 0 0 6 0 ","m 15 0 l 10 7 l 0 9 l 9 13 l 5 23 l 15 17 l 25 23 l 21 13 l 31 9 l 20 7 l 15 0 "]

  86. def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
  87.     ASS_BUF = []                # 用于保存ASS特效
  88.     _7X = _X - int((_A + GetVal(val_Spacing)) / 2 + 0.5)              #每个字的上X坐标= !$left!
  89.     _7Y = _Y - int(_Fs / 2 + 0.5)                                                 #每个字的上Y坐标=!$top!
  90.     _bottom = _Y + int(_H / 2 + 0.5)                                        #每个字的下Y坐标

  91.     if (_i > -1 and _i <4) :
  92.         ass_main(ASS_BUF, SubL(_BT-25+rdm.randnum(-5,25),_BT),pos(_X, _Y)+blur(2)+color3(colour[0]), _TXT)
  93.         ass_main(ASS_BUF, SubL(_BT,_ET),an(5)+pos(_X, _Y)+blur(2)+color3(colour[0]), _TXT)
  94.         ass_main(ASS_BUF,SubL(_ET,_ET+10+rdm.randnum(-5,10),2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[0]) ,_TXT)

  95.     elif (_i > 3 and _i <6) :
  96.         ass_main(ASS_BUF, SubL(_BT-25+rdm.randnum(-5,25),_BT),pos(_X, _Y)+blur(2)+color3(colour[1]), _TXT)
  97.         ass_main(ASS_BUF, SubL(_BT,_ET),an(5)+pos(_X, _Y)+blur(2)+color3(colour[1]), _TXT)
  98.         ass_main(ASS_BUF,SubL(_ET,_ET+10+rdm.randnum(-5,10),2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[1]) ,_TXT)

  99.     elif (_i > 5 and _i <8) :
  100.         ass_main(ASS_BUF, SubL(_BT-25+rdm.randnum(-5,25),_BT),pos(_X, _Y)+blur(2)+color3(colour[2]), _TXT)
  101.         ass_main(ASS_BUF, SubL(_BT,_ET),an(5)+pos(_X, _Y)+blur(2)+color3(colour[2]), _TXT)
  102.         ass_main(ASS_BUF,SubL(_ET,_ET+10+rdm.randnum(-5,10),2),an(5)+pos(_X,_Y)+blur(2)+color3(colour[2]) ,_TXT)
  103.         
  104.     elif (_i > 7 and _i < 10 ) :
  105.         if _j < 0.1*_n*randint(3,8) :
  106.             ass_main(ASS_BUF, SubL(_BT-40,_BT-20),move(_X+200, _Y-200,_X+19,_Y-19)+fsc(0,0)+t(fsc(90,90))+fad(100,0)+blur(2)+color3(colour[3]), _TXT)
  107.             ass_main(ASS_BUF, SubL(_BT-20,_BT),move(_X+19,_Y-19,_X,_Y)+fsc(90,90)+t(fsc(100,100))+fad(100,0)+blur(2)+color3(colour[3]), _TXT)
  108.         else :
  109.             ass_main(ASS_BUF, SubL(_BT-30,_BT-10),move(_X+200, _Y-200,_X+19,_Y-19)+fsc(0,0)+t(fsc(90,90))+fad(100,0)+blur(2)+color3(colour[3]), _TXT)
  110.             ass_main(ASS_BUF, SubL(_BT-10,_BT),move(_X+19,_Y-19,_X,_Y)+fsc(90,90)+t(fsc(100,100))+fad(100,0)+blur(2)+color3(colour[3]), _TXT)
  111.         ass_main(ASS_BUF, SubL(_BT,_ET),an(5)+pos(_X, _Y)+blur(2)+color3(colour[3]), _TXT)
  112.         ass_main(ASS_BUF,SubL(_ET,_ET+30,2),an(5)+org(0,0)+t(frz(rdm.randnum(-6,6))+fsc(0,0)+alpha3(0)+color1(colour[3]))+move(_X,_Y,_X+randint(-400,400),_Y+randint(-400,100))+fad(0,120)+color3(colour[3]) ,_TXT)  
  113.         
  114.     elif _i == 10 or _i == 11:
  115.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[4])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  116.         ass_main(ASS_BUF, SubL(_BT+10,_ET),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[3])), _TXT)
  117.         ass_main(ASS_BUF, SubL(_ET,_ET+30),an(5)+pos(_X, _Y)+t(0,50,bord(0)+alpha3(255))+t(30,300,fsc(160,160)+blur(15)+be(15)), _TXT)
  118.         
  119.     elif _i == 12:
  120.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[4])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  121.         ass_main(ASS_BUF, SubL(_BT+10,_ET),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[5])), _TXT)
  122.         for s in range(5):
  123.             ass_main(ASS_BUF, SubL(_BT+randint(-30,50),_ET+randint(100,150),2),an(5)+color3(colour[5])+fad(300,500)+blur(6)+fsc(randint(5,50),randint(5,50))+moves4(_X+randint(-90,70),_Y+randint(-80,60),_X+randint(-60,60),_Y+randint(-40,70),_X+randint(-60,60),_Y+randint(-40,68),_X+randint(-50,50),_Y+randint(-60,60)),"{\\p2}m 21 16 b 17 16 17 23 21 23 b 25 23 26 16 21 16 m 24 19 l 43 20 l 24 20 m 18 19 l 0 20 l 18 20 m 20 16 l 21 0 l 22 16 m 20 23 l 21 40 l 22 23 ")
  124.         ass_main(ASS_BUF, SubL(_ET,_ET+30+rdm.randnum(-20,15)),an(5)+blur(2)+color3(colour[5])+move(_X, _Y,_X, _Y-randint(650,720))+t(alpha(255)), _TXT)
  125.         
  126.     elif _i == 13:
  127.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[5])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  128.         ass_main(ASS_BUF, SubL(_BT+10,_ET),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[6])), _TXT)
  129.         for s in range(5):
  130.             ass_main(ASS_BUF, SubL(_BT+randint(-30,50),_ET+randint(100,150),2),an(5)+color3(colour[6])+fad(300,500)+blur(6)+fsc(randint(5,50),randint(5,50))+moves4(_X+randint(-90,70),_Y+randint(-80,60),_X+randint(-60,60),_Y+randint(-40,70),_X+randint(-60,60),_Y+randint(-40,68),_X+randint(-50,50),_Y+randint(-60,60)),"{\\p2}m 21 16 b 17 16 17 23 21 23 b 25 23 26 16 21 16 m 24 19 l 43 20 l 24 20 m 18 19 l 0 20 l 18 20 m 20 16 l 21 0 l 22 16 m 20 23 l 21 40 l 22 23 ")
  131.         ass_main(ASS_BUF, SubL(_ET,_ET+30+rdm.randnum(-20,15)),an(5)+blur(2)+color3(colour[6])+move(_X, _Y,_X, _Y-randint(650,720))+t(alpha(255)), _TXT)

  132.         
  133.     elif _i ==14 :
  134.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[6])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  135.         ass_main(ASS_BUF, SubL(_BT+10,_BT+_SK+_KT),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[6]))+fad(0,80), _TXT)
  136.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,2),an(5)+pos(_X, _Y)+blur(2)+color3(colour[6]) ,_TXT)
  137.         ass_main(ASS_BUF, SubL(_ET,_ET+30),an(5)+pos(_X, _Y)+t(0,50,bord(0)+alpha3(255))+t(30,300,fsc(160,160)+blur(15)+be(15)), _TXT)

  138.         
  139.         for j in range(10):
  140.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_Y+randint(-50,-10),_X+randint(-50,50),_Y+randint(-5,25)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  141.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_7Y+randint(-50,-10),_X+randint(-50,50),_7Y+randint(-15,15)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  142.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_bottom+randint(-5,5),_X+randint(-50,50),_bottom+randint(-5,100)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  143.         for k in range(3):
  144.             EFT = alt(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75), t = randint(60,100) , FX1 = alpha(255)+fsc(randint(5,10),randint(5,10)), FX2 = alpha(0)+fsc(randint(10,20),randint(10,20)), offset = 0, a1 = None,a2 = None)
  145.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.4)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-5,85))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  146.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.4)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-105,5))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  147.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.5)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-5,85))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  148.             
  149.     else  :
  150.         ass_main(ASS_BUF, SubL(_BT-30,_BT+10),an(5)+pos(_X, _Y)+blur(15)+alpha3(255)+be(15)+color3(colour[8])+bord(0)+fsc(160,160)+t(0,300,fsc(100,100)+blur(2)+be(1))+t(200,300,bord(2)+alpha(100)), _TXT)
  151.         ass_main(ASS_BUF, SubL(_BT+10,_BT+_SK+_KT),an(5)+pos(_X, _Y)+blur(2)+t(0,100,color3(colour[8]))+fad(0,80), _TXT)
  152.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,2),an(5)+pos(_X, _Y)+blur(2)+color3(colour[8]) ,_TXT)
  153.         ass_main(ASS_BUF, SubL(_ET,_ET+30),an(5)+pos(_X, _Y)+t(0,50,bord(0)+alpha3(255))+t(30,300,fsc(160,160)+blur(15)+be(15)), _TXT)

  154.         
  155.         for j in range(10):
  156.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_Y+randint(-50,-10),_X+randint(-50,50),_Y+randint(-5,25)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  157.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_7Y+randint(-50,-10),_X+randint(-50,50),_7Y+randint(-15,15)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  158.             ass_main(ASS_BUF,SubL(_BT+_SK+j,_BT+_SK+_KT+j*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(randint(1,15)*0.1)+blur(randint(5,20)*0.1)+fsc(randint(3,8),randint(3,8))+move(_X+randint(-5,5),_bottom+randint(-5,5),_X+randint(-50,50),_bottom+randint(-5,100)) ,"{\p1}m 0 -2 l -3 1 l -1 3 l 1 3 l 3 1 l 0 -2")
  159.         for k in range(3):
  160.             EFT = alt(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75), t = randint(60,100) , FX1 = alpha(255)+fsc(randint(5,10),randint(5,10)), FX2 = alpha(0)+fsc(randint(10,20),randint(10,20)), offset = 0, a1 = None,a2 = None)
  161.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.4)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-5,85))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  162.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.4)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-105,5))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  163.             ass_main(ASS_BUF,SubL(_BT+_SK+k,_BT+_SK+_KT+k*5+randint(25,75),2),an(5)+fad(20,50)+color1("FFFFFF")+color3("DC76FF")+bord(0.5)+blur(4)+fsc(5,5)+move(_X+randint(-5,5),_Y+randint(-5,5),_X+randint(-40,40),_Y+randint(-5,85))+EFT ,"{\p1}m 46 54 l 1 56 l 46 57 b 46 58 47 60 47 60 b 42 66 37 72 32 77 b 38 72 43 67 49 62 b 49 63 51 64 52 64 b 53 79 53 93 54 107 b 54 93 55 79 56 64 b 56 65 58 63 59 62 l 76 78 l 60 61 b 61 60 61 57 61 57 l 106 56 l 61 54 b 61 54 60 51 60 51 l 75 35 l 59 49 b 58 48 57 47 55 47 l 54 1 l 52 47 b 50 47 49 48 49 49 l 32 34 l 47 51 b 47 52 46 53 46 54")
  164.             
  165.     return (ASS_BUF,None)


  166.         
复制代码
日文tcc:
  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-011.py >    < beg line = 1 >    < end line = 0 >





  12. < k-timed ass file = OP2-JP_k.ass >
  13. < font file = DFMrg7.ttc >    < font face id = 2 >    < font size = 38 >
  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 = 2 >    < shad = 0 >
  21. < primary color = FFFFFF >    < secondary color = 000000 >    < outline color = B4942F >    < back color = 000000 >
  22. < primary alpha = 0 >    < secondary alpha = 240 >    < outline alpha = 0 >    < back alpha = 240 >

  23. # additional settings

  24. < blur = 0.000 >
复制代码
预览:
http://pan.baidu.com/s/1kTwtXB5


5

查看全部评分

Rank: 4

沙发
发表于 2014-11-3 22:49:01 |只看该作者
期待jiji更多作品。

Rank: 5Rank: 5

板凳
发表于 2014-11-4 21:24:59 |只看该作者
季季大大越来越赞了

Rank: 4

地板
发表于 2015-1-19 19:23:08 |只看该作者
好评中。。看不懂,学习!

Rank: 4

5#
发表于 2015-12-12 23:40:44 |只看该作者
都很不错啊·········

Rank: 4

6#
发表于 2021-12-8 17:35:30 |只看该作者
本帖最后由 Seekladoom 于 2021-12-8 21:07 编辑

补充:楼主脚本中用到的TextOutlinePoints函数有两种写法格式(其他Text函数同理):
Text函数.png

【第1种】
  1. def tcaxLib.TextOutlinePoints(font_file,face_id,font_size,text,density)
复制代码
注:如果使用上面这种写法,font_size一栏的数值必须大于等于tcc文件中的字体字号,否则会报错。


【第2种】

  1. def tcaxLib.TextOutlinePoints(pyFont,text,density)
复制代码


写法来源如下,这部分内容在奶大的tcaxlib函数手册中,可使用谷歌机翻翻译成中文进一步理解:
http://www.tcax.org/docs/tcaxLib ... 5ea8b85cb23e7b01c9f
TextOutlinePoints.png

Rank: 4

7#
发表于 2021-12-8 21:17:47 |只看该作者
本帖最后由 Seekladoom 于 2021-12-8 21:23 编辑

补充:楼主脚本中的文字描绘特效在word模式,如果碰到英文单词,就会出现只有第一个字母有特效的情况,如下图所示:
word mode.png
word bug.png

换成syl模式才能确保其他三个字母也有特效。
syl mode.png
syl.jpg

因此目前要在word模式下让四个字母同时出现特效,暂时还做不到。
您需要登录后才可以回帖 登录 | 新人加入

GitHub|TCAX 主页

GMT+8, 2024-11-22 06:26

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部
RealH