- UID
- 9
- 积分
- 4251
- 帖子
- 293
- 主题
- 40
- 论坛币
- 8462
- 威望
- 29
- EP值
- 1646
- MP值
- 8
- 阅读权限
- 100
- 注册时间
- 2011-8-3
- 在线时间
- 151 小时
- 最后登录
- 2022-8-8
|
本帖最后由 四月一日 君寻 于 2013-3-8 23:23 编辑
- from tcaxPy import *
- from gdiFont import *
- def tcaxPy_Init():
- global _FD
- global _Fs
- global _TextLength
- global _ResolutionX
- global GdiFont #GDIfont
- global Font
-
- _FD = 1000 / GetVal(val_FXFPS)
- _Fs = GetVal(val_FontSize)
- _TextLength = GetVal(val_TextLength)
- _ResolutionX = GetVal(val_ResolutionX)
- _FontFileName = GetVal(val_FontFileName)
- _FaceID = GetVal(val_FaceID)
- GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False) #GDIfont
- Font = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
-
- def tcaxPy_Fin():
- gfFinFont(GdiFont) #GDIfont
- FinFont(Font)
-
- def tcaxPy_User():
- # 创建ASS文件
- file_name = GetVal(val_OutFile) + '.ass'
- ass_header = GetVal(val_AssHeader)
- ASS_FILE = CreateAssFile(file_name, ass_header)
- # 创建TCAS文件
- file_name = GetVal(val_OutFile) + '.tcas'
- fx_width = GetVal(val_ResolutionX)
- fx_height = GetVal(val_ResolutionY)
- fx_fps = GetVal(val_FXFPS)
- TCAS_FILE = CreateTcasFile(file_name, fx_width, fx_height, fx_fps)
- # 基本数据, 如果需要查看含义, 请取消下面两行代码的注释
- #GetHelp()
- #Pause()
- fontSize = GetVal(val_FontSize)
- marginX = GetVal(val_OffsetX)
- marginY = GetVal(val_OffsetY)
- spacing = GetVal(val_Spacing)
- lineNum = GetVal(val_nLines)
- textNum = GetVal(val_nTexts)
- start = GetVal(val_BegTime)
- end = GetVal(val_EndTime)
- kar = GetVal(val_KarTime)
- elapKar = GetVal(val_KarTimeDiff)
- text = GetVal(val_Text)
- textLength = GetVal(val_TextLength)
- advance = GetVal(val_TextAdvance)
- advDiff = GetVal(val_TextAdvanceDiff)
- # 主循环
- for i in range(lineNum):#lineNum
- #initPosX = marginX # an 7, 4, 1
- initPosX = (fx_width - textLength[i]) / 2 + marginX # an 8, 5, 2
- #initPosX = fx_width - textLength[i] - marginX # an 9, 6, 3
- initPosY = marginY # an 7, 8, 9
- #initPosY = fx_height / 2 - marginY # an 4, 5, 6
- #initPosY = fx_height - fontSize - marginY # an 1, 2, 3
- for j in range(textNum[i]):
- posX = initPosX + advDiff[i][j] + advance[i][j] / 2
- posY = initPosY + fontSize / 2
- # Fake1 一直有效
- if text[i][j] == ' ': #text[i][j] == '' text[i][j] == ' '
- continue
- ASS_BUF, TCAS_BUF = tcaxPy_Main_Fake1(i, j, textNum[i], start[i], end[i], elapKar[i][j], kar[i][j], posX, posY, advance[i][j], text[i][j])
- if len(ASS_BUF) > 0:
- WriteAssFile(ASS_FILE, ASS_BUF)
- if len(TCAS_BUF) > 0:
- WriteTcasFile(TCAS_FILE, TCAS_BUF)
- Progress(i, j) # 显示进度
- FinAssFile(ASS_FILE)
- FinTcasFile(TCAS_FILE)
-
- def tcaxPy_Main_Fake1(_i, _j, _n, _BT, _ET, _SK, _KT, _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坐标
-
- for i in range(0,_a):
- ass_main(ASS_BUF, SubL(_BT+_SK+int(i*_KT/_a),_BT+_SK+int(i*_KT/_a)+30,1), pos(dx+i,_y-8)+fscy(400)+fscx(400)+fad(0,200)+color1('1815FD')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(_BT+_SK+int(i*_KT/_a),_BT+_SK+int(i*_KT/_a)+30,1), pos(dx+i,_y-4)+fscy(400)+fscx(400)+fad(0,200)+color1('05F6FA')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(_BT+_SK+int(i*_KT/_a),_BT+_SK+int(i*_KT/_a)+30,1), pos(dx+i,_y)+fscy(400)+fscx(400)+fad(0,200)+color1('33CF11')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(_BT+_SK+int(i*_KT/_a),_BT+_SK+int(i*_KT/_a)+30,1), pos(dx+i,_y+4)+fscy(400)+fscx(400)+fad(0,200)+color1('D1D415')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(_BT+_SK+int(i*_KT/_a),_BT+_SK+int(i*_KT/_a)+30,1), pos(dx+i,_y+8)+fscy(400)+fscx(400)+fad(0,200)+color1('DD4433')+bord(0)+blur(1.5), PixPt())
- for i in range(0,14):
- if _i == i:
- global stat
- stat = _ET
- if _n == _j + 1:
- global POS
- POS = [_x,_y]
- if _i == i+1:
- global edat
- edat = _BT
- if _j == 0:
- global POS2
- POS2 = [_x,_y]
- num = _TextLength[_i]
- EKT = edat-stat
- points1 = Bezier1(num, POS[0]+_a/2, _y-8, POS2[0]-_a/2, _y-8)
- points2 = Bezier1(num, POS[0]+_a/2, _y-4, POS2[0]-_a/2, _y-4)
- points3 = Bezier1(num, POS[0]+_a/2, _y, POS2[0]-_a/2, _y)
- points4 = Bezier1(num, POS[0]+_a/2, _y+4, POS2[0]-_a/2, _y+4)
- points5 = Bezier1(num, POS[0]+_a/2, _y+8, POS2[0]-_a/2, _y+8)
- for i in range(num):
- POS1 = pos(points1[i][0], points1[i][1])
- POS2 = pos(points2[i][0], points2[i][1])
- POS3 = pos(points3[i][0], points3[i][1])
- POS4 = pos(points4[i][0], points4[i][1])
- POS5 = pos(points5[i][0], points5[i][1])
- ass_main(ASS_BUF, SubL(stat+int(i*EKT/num),stat+int(i*EKT/num)+30,1), POS1+fscy(400)+fscx(400)+fad(0,200)+color1('1815FD')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(stat+int(i*EKT/num),stat+int(i*EKT/num)+30,1), POS2+fscy(400)+fscx(400)+fad(0,200)+color1('05F6FA')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(stat+int(i*EKT/num),stat+int(i*EKT/num)+30,1), POS3+fscy(400)+fscx(400)+fad(0,200)+color1('33CF11')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(stat+int(i*EKT/num),stat+int(i*EKT/num)+30,1), POS4+fscy(400)+fscx(400)+fad(0,200)+color1('D1D415')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(stat+int(i*EKT/num),stat+int(i*EKT/num)+30,1), POS5+fscy(400)+fscx(400)+fad(0,200)+color1('DD4433')+bord(0)+blur(1.5), PixPt())
-
- if _i == 0 and _j == 0:
- global POSR
- POSR = [_x,_y]
- global statr
- statr = _BT-50
- global edatr
- edatr = _BT
- num = _TextLength[_i]+300
- EKTR = edatr-statr
- pr1 = Bezier1(num, _x-_ResolutionX+_TextLength[_i]-60, _y-8, POSR[0]-_a/2, _y-8)
- pr2 = Bezier1(num, _x-_ResolutionX+_TextLength[_i]-60, _y-4, POSR[0]-_a/2, _y-4)
- pr3 = Bezier1(num, _x-_ResolutionX+_TextLength[_i]-60, _y, POSR[0]-_a/2, _y)
- pr4 = Bezier1(num, _x-_ResolutionX+_TextLength[_i]-60, _y+4, POSR[0]-_a/2, _y+4)
- pr5 = Bezier1(num, _x-_ResolutionX+_TextLength[_i]-60, _y+8, POSR[0]-_a/2, _y+8)
- for i in range(num):
- POSR1 = pos(pr1[i][0], pr1[i][1])
- POSR2 = pos(pr2[i][0], pr2[i][1])
- POSR3 = pos(pr3[i][0], pr3[i][1])
- POSR4 = pos(pr4[i][0], pr4[i][1])
- POSR5 = pos(pr5[i][0], pr5[i][1])
- ass_main(ASS_BUF, SubL(statr+int(i*EKTR/num),statr+int(i*EKTR/num)+30,1), POSR1+fscy(400)+fscx(400)+fad(0,200)+color1('1815FD')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(statr+int(i*EKTR/num),statr+int(i*EKTR/num)+30,1), POSR2+fscy(400)+fscx(400)+fad(0,200)+color1('05F6FA')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(statr+int(i*EKTR/num),statr+int(i*EKTR/num)+30,1), POSR3+fscy(400)+fscx(400)+fad(0,200)+color1('33CF11')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(statr+int(i*EKTR/num),statr+int(i*EKTR/num)+30,1), POSR4+fscy(400)+fscx(400)+fad(0,200)+color1('D1D415')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(statr+int(i*EKTR/num),statr+int(i*EKTR/num)+30,1), POSR5+fscy(400)+fscx(400)+fad(0,200)+color1('DD4433')+bord(0)+blur(1.5), PixPt())
-
- if _i == 14 and _n == _j + 1:
- global POSC
- POSC = [_x,_y]
- global statc
- statc = _ET
- global edatc
- edatc = _ET+50
- num = _TextLength[_i]+300
- EKTC = edatc-statc
- pc1 = Bezier1(num, POSC[0]+_a/2, _y-8, _x+_ResolutionX+_TextLength[_i]+60, _y-8)
- pc2 = Bezier1(num, POSC[0]+_a/2, _y-4, _x+_ResolutionX+_TextLength[_i]+60, _y-4)
- pc3 = Bezier1(num, POSC[0]+_a/2, _y, _x+_ResolutionX+_TextLength[_i]+60, _y)
- pc4 = Bezier1(num, POSC[0]+_a/2, _y+4, _x+_ResolutionX+_TextLength[_i]+60, _y+4)
- pc5 = Bezier1(num, POSC[0]+_a/2, _y+8, _x+_ResolutionX+_TextLength[_i]+60, _y+8)
- for i in range(num):
- POSC1 = pos(pc1[i][0], pc1[i][1])
- POSC2 = pos(pc2[i][0], pc2[i][1])
- POSC3 = pos(pc3[i][0], pc3[i][1])
- POSC4 = pos(pc4[i][0], pc4[i][1])
- POSC5 = pos(pc5[i][0], pc5[i][1])
- ass_main(ASS_BUF, SubL(statc+int(i*EKTC/num),statc+int(i*EKTC/num)+30,1), POSC1+fscy(400)+fscx(400)+fad(0,200)+color1('1815FD')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(statc+int(i*EKTC/num),statc+int(i*EKTC/num)+30,1), POSC2+fscy(400)+fscx(400)+fad(0,200)+color1('05F6FA')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(statc+int(i*EKTC/num),statc+int(i*EKTC/num)+30,1), POSC3+fscy(400)+fscx(400)+fad(0,200)+color1('33CF11')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(statc+int(i*EKTC/num),statc+int(i*EKTC/num)+30,1), POSC4+fscy(400)+fscx(400)+fad(0,200)+color1('D1D415')+bord(0)+blur(1.5), PixPt())
- ass_main(ASS_BUF, SubL(statc+int(i*EKTC/num),statc+int(i*EKTC/num)+30,1), POSC5+fscy(400)+fscx(400)+fad(0,200)+color1('DD4433')+bord(0)+blur(1.5), PixPt())
-
-
- for i in range(50):
- ass_main(ASS_BUF, SubL(_BT-8+_j*5,_BT+(_j+1)*5,1), mov(_x+30+i,_y,_x,_y)+fad(0,70)+color1('71412B')+blur(1)+bord(1.5)+alpha(220+i), _txt)
-
- ass_main(ASS_BUF, SubL(_BT+(_j+1)*5,_BT+_SK,1), pos(_x,_y)+color1('71412B')+alpha(155)+bord(1.5), _txt)
- ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT,1), pos(_x,_y)+color1('71412B')+alpha(155)+bord(1.5), _txt)
- ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT,1), pos(_x,_y)+clip(dx-10,dy-20,dx-10,dy+_Fs+20)+t(clip(dx-10,dy-20,dx+10+_a,dy+_Fs+20))+alpha1(255)+color3('000000')+bord(2)+blur(0.5), _txt)
- ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT,1), pos(_x,_y)+clip(dx-10,dy-20,dx-10,dy+_Fs+20)+t(clip(dx-10,dy-20,dx+10+_a,dy+_Fs+20))+color1('FFFFFF')+bord(0), _txt)
- for i in range(10):
- ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT,1), pos(_x,_y)+clip(dx-10-i,dy-20,dx-10+i,dy+_Fs+20)+alpha(0+(i*30))+t(clip(dx+10+_a-i,dy-20,dx+10+_a+i,dy+_Fs+20))+alpha1(255)+bord(3)+blur(1), _txt)
- ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT,3), pos(_x,_y)+clip(dx-10-i,dy-20,dx-10+i,dy+_Fs+20)+alpha(0+(i*30))+t(clip(dx+10+_a-i,dy-20,dx+10+_a+i,dy+_Fs+20))+color1('000000')+bord(0)+blur(1), _txt)
-
- ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET-8+_j*5,3), pos(_x,_y)+color3('000000')+bord(2)+blur(0.5)+fad(0,250), _txt)
- return (ASS_BUF, TCAS_BUF)
复制代码 19号 这个OP要被撸出血了 嗯 没什么特别的 就是这样……
预览下载地址:
http://pan.baidu.com/share/link?shareid=316422&uk=900964 |
-
2
查看全部评分
-
|