TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
[jiji]009_STRIKE THE BLOOD-op2
[打印本页]
作者:
jijidata
时间:
2014-3-23 15:07:33
标题:
[jiji]009_STRIKE THE BLOOD-op2
from tcaxPy import *
from s import *
from util.gdiFont import * #加入GDIfont模块
from util.tcCurve import *
import math
import random
def tcaxPy_Init():
global _FontFileName
global _FaceID
global _Fs
global _TextWidth
global _TextHeight
global _TextLength
global _TextAdvDiff
global _ResolutionX
global _FD
global _TextInitX
global _Ascender # 字体上行高度
global _Descender # 字体下行高度 通常为负数
global _H
global _3C
global _KarTime
_KarTime = GetVal(val_KarTime)# 第i句卡拉OK歌词的第j个字符的Karaoke时间 = !$start!
_H = GetVal(val_FontSize)
_3C = GetVal(val_3C)
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Fs = GetVal(val_FontSize)
_Ascender = GetVal(val_Ascender) #字体上行高度
_TextHeight = GetVal(val_TextHeight)# 第i句卡拉OK歌词的j个字符的高度
_TextWidth = GetVal(val_TextWidth)# 第i句卡拉OK歌词的j个字符的宽度
_TextLength = GetVal(val_TextLength)# 第i句卡拉OK歌词的文字总长度
_TextAdvDiff = GetVal(val_TextAdvanceDiff)# 从初始位置到第i句卡拉OK歌词的j个字符的水平步距
_TextInitX = GetVal(val_TextInitX)
_ResolutionX = GetVal(val_ResolutionX)
_FD = 1000 / GetVal(val_FXFPS)
global GdiFont #GDIfont
GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False) #GDIfont
global Font
Font = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
def p(y):#绘图缩放代码
if y == int(y):
Y = str(int(y))
else:
Y = str(format(y, '.2f'))
return '\\p{0}'.format(Y)
def frxyz(x):
X1 = randint(-x,x)
X2 = randint(-x,x)
X3 = randint(-x,x)
return frx(X1)+fry(X2)+frz(X3)
def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
ASS_BUF = [] # 用于保存ASS特效
_7X = _X - int(_A / 2 + 0.5) #每个字的上X坐标= !$left!
_7Y = _Y - int(_H / 2 + 0.5) #每个字的上Y坐标=!$top!
_bottom = _Y + int(_H / 2 + 0.5) #每个字的下Y坐标
if _i > -1 and _i < 9 :
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)#入场效果
for i in range(15):
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)#表现方式
ass_main(ASS_BUF,SubL(_BT+_SK+_KT,_ET,2),an(5)+pos(_X,_Y)+color1("FFFFFF")+color3("000000")+blur(1)+bord(1) ,_TXT)
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)
if _i > 8 and _i < 10 :
PIX = TextPix(Font, _TXT)
InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0] # 第一个像素的X轴坐标
InitPosY = _Y - int(_Fs / 2 + 0.5) + PIX[0][1] # 第一个像素的Y轴坐标
for h in range(PIX[1][1]): # 开始纵向扫描
PosY = InitPosY + h # 当前像素Y轴坐标
for w in range(PIX[1][0]): # 开始横向扫描
PosX = InitPosX + w
X = PosX-randint(-50,50)
Y = PosY-randint(-50,50) # 当前像素X轴坐标
idx = 4 * (h * PIX[1][0] + w) # 脚标
PixR = PIX[2][idx + 0] # 当前像素的红色分量
PixG = PIX[2][idx + 1] # 当前像素的绿色分量
PixB = PIX[2][idx + 2] # 当前像素的蓝色分量
PixA = PIX[2][idx + 3] # 当前像素的透明度
if PixA != 0: # 如果当前像素不为透明则进行如下操作
S = randint(-30,30)
H = randint(-10,10)
Start = int(_BT-50+w*(_KT/PIX[1][0]))+H
End = int(_BT)
Bezier3 = moves3(PosX+randint(-150,20),PosY+randint(-160,10),PosX+randint(-100,10),PosY+randint(-10,110),PosX,PosY)
Bezier2 = moves3(PosX,PosY,PosX+randint(-150,80),PosY+randint(-60,10),PosX+randint(100,210),PosY+randint(-40,0))
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())
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())
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)
for i in range(15):
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)#表现方式
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)
if _i > 9 and _i < 13 or _i > 13 and _i < 19 :
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)
for j in range(30) :
CLIP = clip(_7X+j,_7Y+j,_7X+_A,_7Y+_H)
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)
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)
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)
return (ASS_BUF, None)
复制代码
预览
http://pan.baidu.com/s/1kT7cJdl
作者:
我们的夏天
时间:
2014-3-24 02:36:23
越看越赞!
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2