- UID
- 2
- 积分
- 8682
- 帖子
- 2905
- 主题
- 199
- 论坛币
- 11739
- 威望
- 16
- EP值
- 2349
- MP值
- 15
- 阅读权限
- 200
- 注册时间
- 2011-8-3
- 在线时间
- 2597 小时
- 最后登录
- 2024-8-28
|
执行此例子可能需要新模块
gdiFont.rar
(6.37 KB, 下载次数: 3430)
解压后放到TCAX根目录下, 或者是当前特效工程目录下.
完整特效工程
stab_text.rar
(3.41 KB, 下载次数: 3572)
该例子同时展示了利用新模块来消除像素字(包括Mask文字)与普通字之间的定位偏差.- from tcaxPy import *
- from gdiFont import *
- def tcaxPy_Init():
- global _Fs
- global _FD # 一帧的持续时间, 约40毫秒
- global _Spacing # 字体间距
- global Font # 首要字体
- global GdiFont # GDI 字体
- _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, _Spacing, GetVal(val_SpaceScale), 0, False)
- def tcaxPy_Fin():
- FinFont(Font)
- gfFinFont(GdiFont)
- def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):
- ASS_BUF = [] # 保存ASS特效
- TCAS_BUF = [] # 保存TCAS特效
- ##### 主要特效编写操作 ####
- dx = _x - int((_a + _Spacing) / 2 + 0.5) # 一个固定操作, 将an5的坐标转换为an7
- dy = _y - int(_Fs / 2 + 0.5) # ASS特效默认采用an5坐标, TCAS特效则采用an7坐标
- # 文字主体
- shap = 'm 1 0 l 0 -70 l 0 0 l -60 1 l 0 1 l 1 62 l 1 1 l 60 0 l 0 0' # DRAWING BY Alkoon
- shap2 = 'm 0 -1 l 50 -50 l 1 0 l 50 50 l 0 1 l -50 50 l -1 0 l -50 -50' # DRAWING BY Tenka
- c1 = 'FFFFFF'
- c3 = '000000'
- ts1 = _start - 70 + _j * 2
- te1 = ts1 + 62
- EFT1 = an(7) + color1(c1) + color3(c3) + move(dx + 120, dy, dx, dy) + fad(120, 0) + org(dx, dy)
- EFT2 = bord(1) + fsc(80, 80) + t(100, 400, fsc(150, 150) + frz(50)) + t(450, 800, fsc(100, 100) + frz(0))
- ts2 = te1
- te2 = _start + _elapk + _k
- ass_main(ASS_BUF, SubL(ts1, te1, 2), EFT1 + EFT2, _txt)
- EFT = an(7) + color1(c1) + color3(c3) + move(dx, dy, dx, dy) + bord(1)
- ass_main(ASS_BUF, SubL(ts2, te2, 2), EFT, _txt)
- ###PIX = TextPix(Font, _txt)
- points = gfGetPoints(GdiFont, _txt) ###PixPoints(PIX)
- pt_num = len(points)
- dx = _x - int((_a + _Spacing) / 2 + 0.5) ### + PIX[0][0]
- dy = _y - int(_Fs / 2 + 0.5) ### + PIX[0][1] + 1
- dur = _k * 10
- ts1 = _start + _elapk
- te1 = _start + _elapk + _k
- ts2 = te1
- te2 = _start + _elapk + 100
- for i in range(pt_num):
- rand = randint(-100, 100)
- randx = randint(-200, 200)
- randy = randint(-500, 500)
- x = dx + points[i][0]
- y = dy + points[i][1]
- EFT1 = an(7) + color1(c1) + shad(0) + bord(0) + fsc(20, 20) + fr(rand)
- EFT2 = t(0, dur / 2, fr(randx) + fsc(60, 60)) + t(dur / 2, dur, fr(randy) + fsc(25, 25)) + move(x, y, x, y) + p(2)
- ass_main(ASS_BUF, SubL(ts1, te1, 3), EFT1 + EFT2, shap)
- EFT1 = an(7) + color1(c1) + shad(0) + bord(0) + fsc(26, 26)
- EFT2 = t(0, 1000, fsc(10, 10) + fad(0, 250)) + t(fr(randy)) + move(x, y, x, y) + p(2)
- ass_main(ASS_BUF, SubL(ts2, te2 + 10 * i / pt_num, 3), EFT1 + EFT2, shap)
- ##### 将结果返回给tcax进行处理 #####
- return (ASS_BUF, TCAS_BUF)
复制代码 |
-
1
查看全部评分
-
|