TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
[SAI]044_mekakucityactorsOP
[打印本页]
作者:
saiyaku
时间:
2014-4-14 22:32:24
标题:
[SAI]044_mekakucityactorsOP
預覽:
http://pan.baidu.com/s/1hqqY9CC#dir/path=%2FSaiyakuFX_Preview
from tcaxPy import *
from util.cairo import *
from util.gdiFont import *
def tcaxPy_Init():
global _Fs
global _FD # 一帧的持续时间, 约40毫秒
global _Spacing # 字体间距
global Font # 首要字体
global GdiFont
global _TextWidth # 文字宽度
global _TextHeight # 文字高度
global _TextLength
global _TextAdvDiff
global _ResolutionX
global _OffsetX
_TextHeight = GetVal(val_TextHeight)
_TextWidth = GetVal(val_TextWidth)
_TextLength = GetVal(val_TextLength)
_TextAdvDiff = GetVal(val_TextAdvanceDiff)
_ResolutionX = GetVal(val_ResolutionX)
_OffsetX = GetVal(val_OffsetX)
_Fs = GetVal(val_FontSize)
_FD = 1000 / GetVal(val_FXFPS)
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Spacing = GetVal(val_Spacing)
Font = InitFont(_FontFileName, _FaceID, _Fs, _Spacing, GetVal(val_SpaceScale), MakeRGB(255, 255, 255), 0, False)
GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False) #GDIfont
# cairo
global ctx
fx_width = GetVal(val_ResolutionX)
fx_height = GetVal(val_ResolutionY)
surface = ImageSurface(FORMAT_ARGB32, fx_width, fx_height)
ctx = Context(surface)
def tcaxPy_Fin():
FinFont(Font)
gfFinFont(GdiFont) #GDIfont
def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
ASS_BUF = [] # 保存ASS特效
TCAS_BUF = [] # 保存TCAS特效
global COLOR
global COLOR_PRE
if _j==0:
COLOR = ["1BE61A","CBC826","C90075","CC7114","181AC0","17E3BD","1274C8","A25AC9"][randint(0,7)]
COLOR_PRE = COLOR
else:
while COLOR==COLOR_PRE:
COLOR = ["1BE61A","CBC826","C90075","CC7114","181AC0","17E3BD","1274C8","A25AC9"][randint(0,7)]
COLOR_PRE = COLOR
if _i > -1:
dx = _X - int(_A / 2 + 0.5)
dy = _Y - int(_Fs / 2 + 0.5)
T_EFT = 30
frames = int((T_EFT+2)*10 / _FD + 0.5)
rand = randint(3,6)
outline2 = gfGetOutline(GdiFont, _TXT, dx,dy)
for i in range(frames):
ts = _BT+_SK+5-T_EFT + i * _FD / 10
te = _BT+_SK+5-T_EFT + (i + 1) * _FD / 10
frame_pct = i / frames
outline = gfGetOutline(GdiFont, _TXT, 0, 0)
AssDraw(ctx, outline)
path_trans(ctx, paint_filter, (dx, dx, rand, _Fs, frame_pct))
text = ToAssDraw(ctx)
EFT = an(7) + pos(dx,dy)+color1(COLOR)+shad(0) + p(4)
ass_main(ASS_BUF, SubL(ts, te,20), EFT+blur(1.5)+alpha(100), text)
ass_main(ASS_BUF, SubL(te, _ET+_j*5,1), EFT+alpha(180)+blur(1.5), text)
ass_main(ASS_BUF, SubL(te, _ET+_j*5,20), EFT+alpha(230)+blur(5)+clip(4, outline2), text)
outline = gfGetOutline(GdiFont, _TXT, 0, 0)
ass_main(ASS_BUF, SubL(_BT+_j*5, _ET+_j*5,2),an(7)+ pos(dx,dy)+fad(0,150)+shad(1.5)+p(4), outline)
return (ASS_BUF,None)
def paint_filter(x, y, param):
char_left, line_left, line_width, line_height, frame_pct = param
char_x = ceil(x + char_left * 8 - line_left * 8)
max_diff_x = cos(y / line_height * pi / 10 - frame_pct * pi * 5) * 20 * 8
max_diff_y = cos(char_x / line_width * pi / 10 - frame_pct * pi * 5) * 20 * 8
new_x = char_x - floor(max_diff_y * frame_pct)
new_y = y + floor(max_diff_y * frame_pct)
return new_x, new_y
复制代码
作者:
milkyjing
时间:
2014-4-15 21:08:49
脚本比预想的简单好多啊
作者:
saiyaku
时间:
2014-4-15 21:30:56
milkyjing 发表于 2014-4-15 21:08
脚本比预想的简单好多啊
看見OP開頭的扭曲和噴漆 突發奇想用outline矢量變形做塗色
作者:
BurySakura
时间:
2014-4-16 13:54:31
本帖最后由 BurySakura 于 2014-4-16 14:06 编辑
矢量操作不用通过Cairo的。
我个人只是觉得再绕个Cairo有点多此一举。
于是我还没发现Cairo除了渐变、图片像素化文字以外有什么用(死。
呃,对的,可以矢量操作后像素化,嗯,这个想法不错(拖。
可惜外挂用不到,逐帧已经离我很远了(望天。
_ele = SYL_FON_VEC.split()
_mark = 0
for _i,_c in enumerate(_ele):
if not _c in ['m','n','l','b','s','p','c']:
if _mark == 0:
x = int(_c)
_mark = 1
else:
y = int(_c)
x_w = 23<6
y_i = round((x+x_w)/4)
_ele[_i] = str(y-y_i)
_mark = 0
SYL_FON_VEC = ' '.join(_ele)
复制代码
作者:
忘却の小伊
时间:
2014-4-16 23:13:41
这个涂鸦效果咱很喜欢~~~
但是脚本只能勉强看看.....
作者:
Hintay
时间:
2014-4-23 15:11:34
本帖最后由 Hintay 于 2014-4-23 15:17 编辑
不好意思,已经解决了,是true打错了
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2