- UID
- 2
- 积分
- 8682
- 帖子
- 2905
- 主题
- 199
- 论坛币
- 11566
- 威望
- 16
- EP值
- 2349
- MP值
- 15
- 阅读权限
- 200
- 注册时间
- 2011-8-3
- 在线时间
- 2597 小时
- 最后登录
- 2024-8-28
![Rank: 7](static/image/common/star_level3.gif) ![Rank: 7](static/image/common/star_level2.gif) ![Rank: 7](static/image/common/star_level1.gif)
|
- from tcaxPy import *
- from pixLibs.ImageStone.pixStone import *
- def tcaxPy_Init():
- global _FD # 一帧的时间
- global _Fs
- global _TextLength
- global Font
- global FontOut
- global PIX_tex
- global PIX_tex2
- _FD = 1000 / GetVal(val_FXFPS)
- _Fs = GetVal(val_FontSize)
- _TextLength = GetVal(val_TextLength)
- _FontFileName = GetVal(val_FontFileName)
- _FaceID = GetVal(val_FaceID)
- Font = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), MakeRGB(0, 0, 0), 1, 0)
- FontOut = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), MakeRGB(180, 180, 180), 5, 1)
- PIX_tex = ImagePix(abspath('tex2.png'), _Fs, 0)
- PIX_tex2 = ImagePix(abspath('tex5.png'))
- def tcaxPy_Fin():
- FinFont(Font)
- FinFont(FontOut)
- def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):
- ASS_BUF = [] # 保存ASS特效
- TCAS_BUF = [] # 保存TCAS特效
- ##### 主要特效编写操作 #####
- dx = _x - int(_a / 2 + 0.5) # 一个固定操作, 将an5的坐标转换为an7
- dy = _y - int(_Fs / 2 + 0.5) # ASS特效默认采用an5坐标, TCAS特效则采用an7坐标
- if (_i == 12):
- dy += _Fs + 8
- ts_0 = _start - _FD * 10 / 10
- ts = _start
- te = _end
- te_0 = te + _FD * 5 / 10
- tm = _start + _elapk
- PIX_t = TextPix(Font, _txt) # 获取文字
- PIX_t = PixTexture(PIX_t, PIX_tex) # 增加纹理
- PIX_out = TextPix(FontOut, _txt) # 获取边框
- PIX_out = PixTexture(PIX_out, PIX_tex2)
- PIX_out = PixColorMul(PIX_out, 1, 1, 1, 0.9) # 增加透明度
- PIX_out = PixBlur(PIX_out, 6) # 增加模糊
- PIX_ori = CombinePixs(PIX_out, PIX_t) # 混合文字主体和边框 (边框作底)
- center = _n / 2 - 0.5 # center index of 5 texts is 2, center index of 6 is 2.5
- x = dx + 50 * (_j - center) / center
- y = dy + 10
- for i in range(10):
- x = x + (dx - x) * (i + 1) / 5
- y = y + (dy - y) * (i + 1) / 5
- PIX = PixBlur(PIX_ori, 40 - i * 4)
- tcas_main(TCAS_BUF, PIX, 10 * ts_0 + _FD * i, 10 * ts_0 + _FD * (i + 1), x, y, 0)
- PIX = PIX_ori
- tcas_main(TCAS_BUF, PIX, 10 * ts, 10 * te, dx, dy, 0)
- for i in range(0, 10 * _k, int(2 * _FD)):
- PIX = PIX_ori
- PIX = PixBlur(PIX, 0)
- PIX = pstSoftGlow(PIX, 10, 60, 110)
- tcas_main(TCAS_BUF, PIX, 10 * tm + i, 10 * tm + i + _FD, dx, dy, 0) # PixBlur(PIX, 0) 有特殊效果
- for i in range(5):
- PIX = PixBlur(PIX_ori, (i + 1) * 4)
- #PIX = PixColorMul(PIX, 1, 1, 1, 0.5 + 0.5 * (5 - i - 1) / 5)
- tcas_main(TCAS_BUF, PIX, 10 * te_0 - _FD * (5 - i), 10 * te_0 - _FD * (5 - i - 1), dx, dy, 0)
- # ASS
- if IsLineChanged(_i):
- num = int(_TextLength[_i] / 2)
- points = Bezier1(num, dx, 10, dx + _TextLength[_i], 10)
- for i in range(num):
- ass_main(ASS_BUF, SubL(_start + i / 5, _start + i / 5 + 80, 0, Pix_Style), \
- pos(points[i][0], points[i][1]) + alpha1(HexToDec('77')) + alpha3(HexToDec('F4')) + bord(1) + blur(1) + color3('A54AFF') + color1('A54AFF') + \
- t(0, 200, bord(6) + blur(6)) + t(600, 800, bord(1) + blur(1)), PixPt())
- ass_main(ASS_BUF, SubL(_start + i / 5, _start + i / 5 + 80, 1, Pix_Style), \
- pos(points[i][0], points[i][1]) + alpha1(HexToDec('77')) + alpha3(HexToDec('AA')) + bord(1) + blur(1) + color3('A54AFF') + color1('A54AFF') + \
- t(0, 100, bord(1.8) + blur(1.8)) + t(100, 200, bord(2.3) + blur(2.3)) +\
- t(200, 600, bord(1.8) + blur(1.8)) + t(600, 800, bord(1) + blur(1)), PixPt())
- ass_main(ASS_BUF, SubL(_start + i / 5, _start + i / 5 + 80, 2, Pix_Style), \
- pos(points[i][0], points[i][1]) + alpha1(HexToDec('77')) + alpha3(HexToDec('AA')) + bord(0.7) + blur(0.7) + color3('FFFFFF') + color1('FFFFFF') + \
- t(0, 100, bord(1.6) + blur(1.6)) + t(100, 200, bord(2.1) + blur(2.1)) +\
- t(200, 600, bord(1.6) + blur(1.6)) + t(600, 800, bord(0.8) + blur(0.8) + alpha3(255)), PixPt())
- points = Bezier1(num, dx + _TextLength[_i], dy + _Fs + 10, dx, dy + _Fs + 10)
- for i in range(num):
- ass_main(ASS_BUF, SubL(_start + i / 5, _start + i / 5 + 80, 0, Pix_Style), \
- pos(points[i][0], points[i][1]) + alpha1(HexToDec('77')) + alpha3(HexToDec('F4')) + bord(1) + blur(1) + color3('A54AFF') + color1('A54AFF') + \
- t(0, 200, bord(6) + blur(6)) + t(600, 800, bord(1) + blur(1)), PixPt())
- ass_main(ASS_BUF, SubL(_start + i / 5, _start + i / 5 + 80, 1, Pix_Style), \
- pos(points[i][0], points[i][1]) + alpha1(HexToDec('77')) + alpha3(HexToDec('AA')) + bord(1) + blur(1) + color3('A54AFF') + color1('A54AFF') + \
- t(0, 100, bord(1.8) + blur(1.8)) + t(100, 200, bord(2.3) + blur(2.3)) +\
- t(200, 600, bord(1.8) + blur(1.8)) + t(600, 800, bord(1) + blur(1)), PixPt())
- ass_main(ASS_BUF, SubL(_start + i / 5, _start + i / 5 + 80, 2, Pix_Style), \
- pos(points[i][0], points[i][1]) + alpha1(HexToDec('77')) + alpha3(HexToDec('AA')) + bord(0.7) + blur(0.7) + color3('FFFFFF') + color1('FFFFFF') + \
- t(0, 100, bord(1.6) + blur(1.6)) + t(100, 200, bord(2.1) + blur(2.1)) +\
- t(200, 600, bord(1.6) + blur(1.6)) + t(600, 800, bord(0.8) + blur(0.8) + alpha3(255)), PixPt())
- ##### 将结果返回给tcax进行处理 #####
- return (ASS_BUF, TCAS_BUF)
复制代码 预览见此帖: http://www.tcax.org/forum.php?mod=viewthread&tid=43
文件名为: [J]030_working_II_op.mkv
附完整特效工程 (包含所有需要的文件): http://www.tcax.org/forum.php?mod=viewthread&tid=117
|
-
1
查看全部评分
-
|