- UID
- 2
- 积分
- 8682
- 帖子
- 2905
- 主题
- 199
- 论坛币
- 11741
- 威望
- 16
- EP值
- 2349
- MP值
- 15
- 阅读权限
- 200
- 注册时间
- 2011-8-3
- 在线时间
- 2597 小时
- 最后登录
- 2024-8-28
|
说明: 以下脚本需要用到small_code中的tu2lis函数(作用是将图形转换成点).
关于small_code模块, 我已经获得了small大的授权, 以后将以拓展模块的形式发布TCAX兼容(二次修改)版.
关于此脚本我就不做太多解释了, 如有问题, 请直接在此跟帖.- from tcaxPy import *
- from extLibs.small_code import *
- def tcaxPy_Init():
- global _FD # 一帧的时间
- global _Fs # 字体大小
- global FontBord # 首要字体
- _FD = 1000 / GetVal(val_FXFPS)
- _Fs = GetVal(val_FontSize)
- FontBord = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), MakeRGB(0, 0, 0), 2, 0)
- def tcaxPy_Fin():
- FinFont(FontBord)
- 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坐标
- ts_0 = _start - 40 + 2 * _FD / 10 * _j
- ts = ts_0 + 40
- te = _end - 2 * _FD / 10 * (_n - _j - 1)
- te_0 = te + 40
- # 入场效果
- ass_main(ASS_BUF, SubL(Start = ts_0, End = ts_0 + 40, Layer = 1), mov(_x + 50, _y - 20, _x, _y) + fad(300, 0) + bord(3) + blur(2), _txt)
- ass_main(ASS_BUF, SubL(Start = ts_0, End = ts_0 + 40, Layer = 2), mov(_x + 50, _y - 20, _x, _y) + fad(300, 0) + bord(1) + color3('000000'), _txt)
- ass_main(ASS_BUF, SubL(Start = ts_0, End = ts_0 + 40, Layer = 3), mov(_x + 50, _y - 20, _x, _y) + fad(300, 0) + bord(0), _txt)
- # 存在效果 + 随机噪声效果
- PIX = TextPix(FontBord, _txt) # get the pixel info
- PIX_t = PIX
- duration = te - ts
- count = int(duration * 10 / _FD) # 闪光次数
- if _j == 0:
- global rp
- rp = []
- num = int((_end + 50 - _start) * 10 / _FD)
- for i in range(num):
- rp.append((randint(0, 1), randint(0, 1)))
- offset = 2 * _j
- for i in range(count):
- PIX_color = list(PIX_t[2])
- width = PIX_t[1][0]
- height = PIX_t[1][1]
- for j in range(randint(6, 10)): # 闪光点个数
- xr = randint(5, _a - 5)
- yr = randint(0, _Fs - 5)
- R_IMG = RandImg(randint(1, 3), randint(1, 4), randint(1, 4))
- points = tu2lis(R_IMG) # function borrowed from small_code library
- num = len(points)
- for m in range(num):
- w = int(points[m][0]) + xr
- if w >= width:
- continue
- h = int(points[m][1]) + yr
- if h >= height:
- continue
- index = (h * width + w) * 4
- if PIX_color[index + 3] != 0:
- PIX_color[index + 3] = -1
- num = height * width * 4
- for j in range(0, num, 4):
- if PIX_color[j + 3] != -1:
- PIX_color[j + 3] = 0
- else:
- PIX_color[j + 0] = 255
- PIX_color[j + 1] = 255
- PIX_color[j + 2] = 255
- PIX_color[j + 3] = PIX_t[2][j + 3]
- PIX = (PIX_t[0], PIX_t[1], tuple(PIX_color))
- if (10 * ts + i * _FD >= 10 * (_start + _elapk + _k + 5)) or (10 * ts + (i + 1) * _FD < 10 * (_start + _elapk - 5)):
- tcas_main(TCAS_BUF, PIX, 10 * ts + i * _FD, 10 * ts + (i + 1) * _FD, dx + rp[i + offset][0], dy + rp[i + offset][1], 0)
- ass_main(ASS_BUF, SubL(Start = ts + i * _FD / 10, End = ts + (i + 1) * _FD / 10, Layer = 1), pos(_x + rp[i + offset][0], _y + rp[i + offset][1]) + bord(3) + blur(2), _txt)
- ass_main(ASS_BUF, SubL(Start = ts + i * _FD / 10, End = ts + (i + 1) * _FD / 10, Layer = 2), pos(_x + rp[i + offset][0], _y + rp[i + offset][1]) + bord(1) + color3('000000'), _txt)
- ass_main(ASS_BUF, SubL(Start = ts + i * _FD / 10, End = ts + (i + 1) * _FD / 10, Layer = 3), pos(_x + rp[i + offset][0], _y + rp[i + offset][1]) + bord(0), _txt)
- # 特效表现效果
- C3 = '0000FF'
- EFT1 = animation2(0, 4 * _k + 50, 1.3, fs(55) + blur(6) + bord(6) + color3(C3))
- EFT2 = animation1(0, 2 * _k + 50, color1('FFFFFF')) + alpha1(0) + be(1)
- ass_main(ASS_BUF, SubL(Start = _start + _elapk - 5, End = _start + _elapk + _k / 2, Layer = 6), pos(_x, _y) + EFT1 + EFT2, _txt)
- EFT1 = fs(55) + blur(6) + bord(6) + color3(C3) + animation2(_k + 50, 5 * _k + 50, 0.8, fs(_Fs) + blur(0) + bord(0) + color3('FF8A15'))
- EFT2 = color1('FFFFFF') + animation1(0, 3 * _k, color1(C3)) + animation1(3 * _k, 5 * _k + 50, color1('FF8A15')) + alpha1(0) + be(1)
- ass_main(ASS_BUF, SubL(Start = _start + _elapk + _k / 2, End = _start + _elapk + _k + 5, Layer = 6), pos(_x, _y) + EFT1 + EFT2, _txt)
- EFT = color1('FFFFFF') + alpha3(255) + be(1) + animation2(0, 4 * _k + 50, 1.3, fs(53))
- ass_main(ASS_BUF, SubL(Start = _start + _elapk - 5, End = _start + _elapk + _k * 6 / 10 + 5, Layer = 6), pos(_x, _y) + EFT, _txt)
- EFT = color1('FFFFFF') + alpha3(255) + be(1) + fs(53) + animation2(0, 4 * _k, 0.8, fs(_Fs))
- ass_main(ASS_BUF, SubL(Start = _start + _elapk + _k * 6 / 10 + 5, End = _start + _elapk + _k + 5, Layer = 6), pos(_x, _y) + EFT, _txt)
- EFT1 = animation2(0, 4 * _k + 50, 1.3, fs(50) + blur(6) + bord(6) + color3(C3))
- EFT2 = animation1(0, 2 * _k + 50, color1('FFFFFF')) + be(1) + alpha1(0)
- ass_main(ASS_BUF, SubL(Start = _start + _elapk - 5, End = _start + _elapk + _k / 2, Layer = 7), pos(_x, _y) + EFT1 + EFT2, _txt)
- EFT1 = fs(50) + blur(6) + bord(6) + color3(C3) + animation2(_k + 50, 5 * _k + 50, 0.8, fs(_Fs) + blur(0) + bord(0) + color3('FF8A15'))
- EFT2 = color1('FFFFFF') + animation1(0, 3 * _k, color1(C3)) + animation1(3 * _k, 5 * _k + 50, color1('FF8A15')) + be(1) + alpha1(0)
- ass_main(ASS_BUF, SubL(Start = _start + _elapk + _k / 2, End = _start + _elapk + _k + 5, Layer = 7), pos(_x, _y) + EFT1 + EFT2, _txt)
- EFT = color1('FFFFFF') + alpha3(255) + be(1) + animation2(0, 4 * _k + 50, 1.3, fs(48))
- ass_main(ASS_BUF, SubL(Start = _start + _elapk - 5, End = _start + _elapk + _k * 6 / 10 + 5, Layer = 7), pos(_x, _y) + EFT, _txt)
- EFT = color1('FFFFFF') + alpha3(255) + be(1) + fs(48) + animation2(6 * _k + 100, 10 * _k + 100, 0.8, fs(_Fs))
- ass_main(ASS_BUF, SubL(Start = _start + _elapk + _k * 6 / 10 + 5, End = _start + _elapk + _k + 5, Layer = 7), pos(_x, _y) + EFT, _txt)
- # 出场效果
- offset += count
- num = int(400 / _FD)
- te = ts + count * _FD / 10
- for i in range(num):
- ass_main(ASS_BUF, SubL(Start = te + i * _FD / 10, End = te + (i + 1) * _FD / 10, Layer = 1), pos(_x + rp[i + offset][0], _y + rp[i + offset][1]) + alpha(255 * i / num) + bord(3) + blur(2), _txt)
- ass_main(ASS_BUF, SubL(Start = te + i * _FD / 10, End = te + (i + 1) * _FD / 10, Layer = 2), pos(_x + rp[i + offset][0], _y + rp[i + offset][1]) + alpha(255 * i / num) + bord(1) + color3('000000'), _txt)
- ass_main(ASS_BUF, SubL(Start = te + i * _FD / 10, End = te + (i + 1) * _FD / 10, Layer = 3), pos(_x + rp[i + offset][0], _y + rp[i + offset][1]) + alpha(255 * i / num) + bord(0), _txt)
- ##### 将结果返回给tcax进行处理 #####
- return (ASS_BUF, TCAS_BUF)
复制代码 预览请见此帖: http://www.tcax.org/forum.php?mod=viewthread&tid=43
文件名为: [J]028_Nurarihyon_OP.mkv
|
-
2
查看全部评分
-
|