TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
TCAX 淡入淡出效果的两种写法格式(Main+User)
[打印本页]
作者:
Seekladoom
时间:
2022-1-28 23:22:26
标题:
TCAX 淡入淡出效果的两种写法格式(Main+User)
本帖最后由 Seekladoom 于 2022-1-28 23:46 编辑
相关链接:
自定义特效编写模板tcaxPy_User函数用法例子
[SAI]034_hyoukaOP2
TCAX 淡入淡出效果的两种写法格式(Main+User).rar
(0 Bytes, 下载次数: 2412)
2022-1-28 23:46:37 上传
下载次数: 2412
注:以下两种写法最终生成的ASS字幕文件完全一致,发出来的主要目的有以下几点:
1.方便对比基础字幕文本写法的差异
2.寻找简化TCAX代码写法的方法
main格式
from tcaxPy import *
def tcaxPy_Init():
pass
def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
ASS_BUF = [] # 保存ASS特效
DY = _Y - 13
ass_main(ASS_BUF, SubL(_BT, _ET, 0),pos(_X,DY)+fad(200,200), _TXT)
return (ASS_BUF,None)
复制代码
user格式
from tcaxPy import *
def tcaxPy_Init():
global resX # horizontal resolution
global resY # vertical resolution
global marginX # horizontal margin
global marginY # vertical margin
global lineNum # number of lines
global textNum # textNum[i], number of texts in ith line
global _BT # _BT[i], start time of a line
global _ET # _ET[i], end time of a line
global _TXT # _TXT[i][j], as name implies
global _L # _L[i], total width of a line
global _A # _A[i][j], advance of a text, usually larger than width
global _AD # _AD[i][j], distance between the current text to the first text of the line
resX = GetVal(val_ResolutionX)
resY = GetVal(val_ResolutionY)
marginX = GetVal(val_OffsetX)
marginY = GetVal(val_OffsetY)
lineNum = GetVal(val_nLines)
textNum = GetVal(val_nTexts)
_BT = GetVal(val_BegTime)
_ET = GetVal(val_EndTime)
_TXT = GetVal(val_Text)
_L = GetVal(val_TextLength)
_A = GetVal(val_TextAdvance)
_AD = GetVal(val_TextAdvanceDiff)
def tcaxPy_User():
ASS_BUF = []
file_name = GetVal(val_OutFile) + '.ass'
ass_header = GetVal(val_AssHeader)
ASS_FILE = CreateAssFile(file_name, ass_header)
for i in range(lineNum):
initPosX = marginX + (resX - _L[i]) / 2 # an 7, 4, 1
initPosY = marginY # an 7, 8, 9
for j in range(textNum[i]):
if _TXT[i][j] == '' or _TXT[i][j] == ' ' or _TXT[i][j] == ' ':
continue
# an 2
DX = initPosX + _AD[i][j] + _A[i][j] / 2
DY = initPosY + resY - 39
ass_main(ASS_BUF, SubL(_BT[i], _ET[i],0),pos(DX,DY)+fad(200,200), _TXT[i][j])
WriteAssFile(ASS_FILE, ASS_BUF) # write the buffer in memory to the file
Progress(i,j)
FinAssFile(ASS_FILE)
复制代码
附件:
TCAX 淡入淡出效果的两种写法格式(Main+User).rar
(2022-1-28 23:46:37, 0 Bytes) / 下载次数 2412
http://tcax.org/forum.php?mod=attachment&aid=Mjg2NnwwZGI0YjY2ZHwxNzMyMjA5OTQ1fDB8MA%3D%3D
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2