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

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

[完整特效] [jiji]009_STRIKE THE BLOOD-op2 [复制链接]

Rank: 5Rank: 5

跳转到指定楼层
楼主
发表于 2014-3-23 15:07:33 |只看该作者 |倒序浏览
  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. def tcaxPy_Init():
  8.     global _FontFileName
  9.     global _FaceID
  10.     global _Fs
  11.     global _TextWidth
  12.     global _TextHeight
  13.     global _TextLength
  14.     global _TextAdvDiff
  15.     global _ResolutionX
  16.     global _FD
  17.     global _TextInitX
  18.     global _Ascender        # 字体上行高度
  19.     global _Descender        # 字体下行高度 通常为负数
  20.     global _H
  21.     global _3C
  22.     global _KarTime         
  23.     _KarTime = GetVal(val_KarTime)# 第i句卡拉OK歌词的第j个字符的Karaoke时间 = !$start!
  24.     _H = GetVal(val_FontSize)
  25.     _3C = GetVal(val_3C)
  26.     _FontFileName = GetVal(val_FontFileName)
  27.     _FaceID       = GetVal(val_FaceID)
  28.     _Fs           = GetVal(val_FontSize)
  29.     _Ascender = GetVal(val_Ascender) #字体上行高度
  30.     _TextHeight   = GetVal(val_TextHeight)# 第i句卡拉OK歌词的j个字符的高度
  31.     _TextWidth    = GetVal(val_TextWidth)# 第i句卡拉OK歌词的j个字符的宽度
  32.     _TextLength   = GetVal(val_TextLength)# 第i句卡拉OK歌词的文字总长度
  33.     _TextAdvDiff  = GetVal(val_TextAdvanceDiff)# 从初始位置到第i句卡拉OK歌词的j个字符的水平步距
  34.     _TextInitX  = GetVal(val_TextInitX)
  35.     _ResolutionX  = GetVal(val_ResolutionX)
  36.     _FD           = 1000 / GetVal(val_FXFPS)
  37.     global GdiFont   #GDIfont
  38.     GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False)   #GDIfont
  39.     global Font
  40.     Font = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)



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

  53.    


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





  59.     if _i > -1 and _i < 9 :
  60.         
  61.         ass_main(ASS_BUF,SubL(_BT-15,_BT+_SK,2),an(5)+fad(50,0)+pos(_X,_Y)+bord(1)+color1("030291")+color3("030291")+blur(5)+t(100,150,color1("FFFFFF")+color3("000000")+blur(1)) ,_TXT)#入场效果
  62.         for i in range(15):
  63.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+_KT*0.1,2),an(5)+bord(1)+blur(4.5)+color1("FFFFFF")+color3("5617F5")+bord(0.5)+fscx(100*(i*2/15))+alpha(128+127*i/15)+pos(_X,_Y)+t(0,_KT*4,fscx(100*(i*2.2/15))+blur(6)+bord(0))+t(_KT*4,_KT*10,bord(1)+blur(4.5)+fscx(100)) ,_TXT)#表现方式
  64.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,2),an(5)+pos(_X,_Y)+color1("FFFFFF")+color3("000000")+blur(1)+bord(1) ,_TXT)
  65.         ass_main(ASS_BUF,SubL(_ET,_ET+15,2),an(5)+pos(_X,_Y)+color1("FFFFFF")+color3("000000")+blur(1)+bord(1)+fad(0,50)+t(10,80,color1("030291")+color3("030291")+blur(5)) ,_TXT)
  66.         
  67.     if _i > 8 and _i < 10 :
  68.         PIX = TextPix(Font, _TXT)
  69.         InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0]        # 第一个像素的X轴坐标
  70.         InitPosY = _Y - int(_Fs / 2 + 0.5) + PIX[0][1]        # 第一个像素的Y轴坐标
  71.         for h in range(PIX[1][1]):                                # 开始纵向扫描
  72.             PosY  = InitPosY + h                                      # 当前像素Y轴坐标
  73.             for w in range(PIX[1][0]):                        # 开始横向扫描
  74.                 PosX = InitPosX + w
  75.                 X = PosX-randint(-50,50)
  76.                 Y = PosY-randint(-50,50)                        # 当前像素X轴坐标
  77.                 idx  = 4 * (h * PIX[1][0] + w)                # 脚标
  78.                 PixR = PIX[2][idx + 0]                        # 当前像素的红色分量
  79.                 PixG = PIX[2][idx + 1]                        # 当前像素的绿色分量
  80.                 PixB = PIX[2][idx + 2]                        # 当前像素的蓝色分量
  81.                 PixA = PIX[2][idx + 3]                        # 当前像素的透明度
  82.                 if PixA != 0:                                # 如果当前像素不为透明则进行如下操作
  83.                     S = randint(-30,30)
  84.                     H = randint(-10,10)
  85.                     Start = int(_BT-50+w*(_KT/PIX[1][0]))+H
  86.                     End = int(_BT)
  87.                     Bezier3 = moves3(PosX+randint(-150,20),PosY+randint(-160,10),PosX+randint(-100,10),PosY+randint(-10,110),PosX,PosY)
  88.                     Bezier2 = moves3(PosX,PosY,PosX+randint(-150,80),PosY+randint(-60,10),PosX+randint(100,210),PosY+randint(-40,0))
  89.                     ass_main(ASS_BUF, SubL(Start,End ,5, Pix_Style),an(7)+Bezier3+fad(100,0)+alpha(255-PixA)+shad(0)+bord(0.2)+blur(2)+org(_X,_Y)+color1("FFFFFF")+color3("FFFFFF"), PixPt())
  90.                     ass_main(ASS_BUF, SubL(_ET-5,_ET+w*(_KT/PIX[1][0])+20+H ,5, Pix_Style),an(7)+Bezier2+fad(0,100)+alpha(255-PixA)+shad(0)+bord(0.2)+blur(2)+org(_X,_Y)+color1("FFFFFF")+color3("FFFFFF"), PixPt())
  91.         ass_main(ASS_BUF,SubL(_BT-10,_BT+_SK,2),an(5)+pos(_X,_Y)+fad(100,0)+color1("FFFFFF")+color3("000000")+blur(1)+bord(1) ,_TXT)
  92.         for i in range(15):
  93.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+_KT*0.1,2),an(5)+bord(1)+blur(4.5)+color1("FFFFFF")+color3("5617F5")+bord(0.5)+fscx(100*(i*2/15))+alpha(128+127*i/15)+pos(_X,_Y)+t(0,_KT*4,fscx(100*(i*2.2/15))+blur(6)+bord(0))+t(_KT*4,_KT*10,bord(1)+blur(4.5)+fscx(100)) ,_TXT)#表现方式
  94.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,2),an(5)+pos(_X,_Y)+color1("FFFFFF")+color3("000000")+blur(1)+bord(1)+fad(0,50) ,_TXT)
  95.         
  96.     if _i > 9 and _i < 13 or _i > 13 and _i < 19 :
  97.         ass_main(ASS_BUF,SubL(_BT-15,_BT+_SK,2),an(5)+fad(50,0)+pos(_X,_Y)+bord(1)+color1("030291")+color3("030291")+blur(5)+t(100,150,color1("FFFFFF")+color3("000000")+blur(1)) ,_TXT)
  98.         for j in range(30) :
  99.             CLIP = clip(_7X+j,_7Y+j,_7X+_A,_7Y+_H)
  100.             ass_main(ASS_BUF,SubL(_BT+_SK,_BT+_SK+_KT+15,2),an(5)+pos(_X,_Y)+fsc(150,150)+jitter(1,1,1,1,50)+t(jitter(4,4,4,4,40,randint(10,40)))+fsc(100,100)+bord(0.8)+CLIP+color3("5617F5") ,_TXT)
  101.         ass_main(ASS_BUF,SubL(_BT+_SK+_KT+15,_ET,2),an(5)+pos(_X,_Y)+color1("FFFFFF")+color3("000000")+blur(1)+bord(1) ,_TXT)
  102.         ass_main(ASS_BUF,SubL(_ET,_ET+15,2),an(5)+pos(_X,_Y)+color1("FFFFFF")+color3("000000")+blur(1)+bord(1)+fad(0,50)+t(10,80,color1("030291")+color3("030291")+blur(5)) ,_TXT)

  103.         
  104.     return (ASS_BUF, None)
复制代码
预览
http://pan.baidu.com/s/1kT7cJdl
1

查看全部评分

Rank: 5Rank: 5

沙发
发表于 2014-3-24 02:36:23 |只看该作者
越看越赞!
您需要登录后才可以回帖 登录 | 新人加入

GitHub|TCAX 主页

GMT+8, 2024-4-26 00:37

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部
RealH