- UID
- 2546
- 积分
- 159
- 帖子
- 30
- 主题
- 5
- 论坛币
- 868
- 威望
- 0
- EP值
- 134
- MP值
- 0
- 阅读权限
- 50
- 注册时间
- 2015-5-9
- 在线时间
- 52 小时
- 最后登录
- 2024-10-20
|
本帖最后由 Seekladoom 于 2022-2-2 20:22 编辑
[youkaze]004 Natsume Yuujinchou Shi OP.py
(4.28 KB, 下载次数: 2191)
整理了下楼主的代码排列顺序并添加注释,方便理解:
- from tcaxPy import *
- def tcaxPy_Init():
- global _FontFileName
- global _FaceID
- global _Fs
- global Font
- _FontFileName = GetVal(val_FontFileName)
- _FaceID = GetVal(val_FaceID)
- _Fs = GetVal(val_FontSize)
- Font = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
- def tcaxPy_Fin():
- FinFont(Font)
- def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT,):
- ASS_BUF = []
- #一些变量
- DY = _Y - 13
- _7X = _X - int(_A / 2 + 0.5) # 第i句卡拉OK歌词的j个字符的左上角X轴坐标
- _7Y = DY - int(_Fs / 2 + 0.5) # 第i句卡拉OK歌词的j个字符的左上角Y轴坐标
- COLOR=[ "C9F2DC", "C9F2DC","C9F2DC","C9F2DC","C9F2DC","A5BDED","C9F2DC" ]
- COLOR1=color1(COLOR[randint(0,6)])
- dx = _X - int(_A / 2 + 0.5)
- dy = DY - int(_Fs / 2 + 0.5)
- mask = TextOutlineDraw(Font, _TXT, dx, dy)
- #----------全行通用区----------
- #随机绿字、红字
- ass_main(ASS_BUF, SubL(_BT+(_j+1)*5,_BT+_SK),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(180)+alpha3(100), _TXT)
- ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(180)+alpha3(100)+color3('2E2E2E')+t(alpha3(70)+color3('000000')), _TXT)
- ass_main(ASS_BUF, SubL(_BT+_SK+_KT,_ET,10),pos(_X-0.3,DY-0.2)+bord(2.3)+alpha1(0)+alpha3(0)+COLOR1, _TXT)
- ass_main(ASS_BUF, SubL(_BT+_SK-20, _BT+_SK+_KT),an(5) + pos(_X+randint(-15,15), DY+randint(-15,15)) + COLOR1 + bord(0)+blur(4)+ alpha1(0)+fs(1)+t(0,_KT*10,fs(100)) + clip2(7, mask), "●")
- #伪像素化文字切割
- for i in range(0,_A,5):
- for j in range(0,_Fs,5):
- Xx = 40+randint(-20,20)
- Yy = randint(-20,20)
- CLIP1 = clip(_7X+i+Xx,_7Y+j+Yy,_7X+i+5+Xx,_7Y+j+5+Yy)+t(clip(_7X+i,_7Y+j,_7X+i+5,_7Y+j+5))
- CLIP2 = clip(_7X+i,_7Y+j,_7X+i+5,_7Y+j+5)
- MOVE = move(_X-0.3+Xx,DY-0.2+Yy,_X-0.3,DY-0.2)
- POS = pos(_X-0.3,DY-0.2)
- ass_main(ASS_BUF, SubL(_BT-40-8+_j*5+randint(-10,10),_BT+(_j+1)*5),CLIP1+MOVE+bord(2.3)+alpha1(180)+alpha3(100)+fad(200,0), _TXT)
- ass_main(ASS_BUF, SubL(_ET,_ET+10-8+_j*5+randint(-10,10)),CLIP2+POS+bord(2.3)+alpha1(0)+alpha3(00)+COLOR1+fad(0,50), _TXT)
- #----------分行判断区----------
- #白边发光文字
- if _i > -1 and _i < 4:
- EFT = alpha1(255) + color3('FFFFFF') + alpha3(0) +bord(0) + t(bord(3) + blur(5))
- ass_main(ASS_BUF, SubL(_BT+_SK-10,_BT+_SK+_KT/2),pos(_X-0.3,DY-0.2) + EFT, _TXT)
- EFT = alpha1(255) + color3('FFFFFF') + alpha3(0) +bord(3) + blur(5) + t(bord(0) + blur(0) + alpha3(255))
- ass_main(ASS_BUF, SubL(_BT+_SK+_KT/2,_BT+_SK+_KT),pos(_X-0.3,DY-0.2) + EFT, _TXT)
- #白边透明文字变大
- if _i > 3:
- ass_main(ASS_BUF, SubL(_BT+_SK,_BT+_SK+_KT), pos(_X-0.3,DY-0.2)+blur(2)+bord(3)+ alpha3(0)+ alpha1(255)+color3('FFFFFF')+fs(53)+t(fs(90))+fad(100,200), _TXT)
- #旋转光线
- if _i == 7 and _TXT == 'と':
- sb1=""
- for i in range (0,30):
- a = -0.15+0.01*i
- l = (pow((abs(a)/0.15),0.3)+0.5)*60*8
- sb1= sb1 + "m 0 0 l"+" "+str(int(l*cos(a)))+" "+str(int(l*sin(a)))+" 0 1 c "
- sb2 = ""
- for j in range (0,30):
- a = -0.15+0.01*j
- l = (pow((abs(a)/0.15),0.3)+0.5)*20*8
- sb2 = sb2 +"m 0 0 l"+" "+str(int(l*cos(a)))+" "+str(int(l*sin(a)))+" 0 1 c "
- tStep = 2
- for ptt0 in range(_BT+_SK - 10,_BT+_SK+_KT,tStep):
- startag = randint(0, 359)
- endag = startag + randint(0,9)/10 * randint(50, 100)
- ass_main(ASS_BUF, SubL(ptt0,ptt0 + 100), an(7)+pos(_X,DY)+fad(300, 300)+alpha1(0)+be(1)+shad(0)+bord(0)+color1("A5BDED")+ frz(startag) + t1(0,1000,frz(endag)),"{\p4}"+sb1)
- ass_main(ASS_BUF, SubL(ptt0,ptt0 + 100), an(7)+pos(_X,DY)+fad(300, 300)+alpha1(17)+be(1)+shad(0)+bord(0)+color1("FFFFFF")+ frz(startag) + t1(0,1000,frz(endag)),"{\p4}"+sb2)
- #频闪文字
- if _i == 7 and _TXT == 'と':
- for i in range(_BT+_SK,_BT+_SK+_KT,10):
- ass_main(ASS_BUF, SubL(i,i+10), pos(_X-0.3,DY-0.2)+blur(2)+shad(0)+bord(3)+ alpha3(0)+ alpha1(0)+color1("FFFFFF")+ color3('FFFFFF')+fad(10,50), _TXT)
- return (ASS_BUF, None)
复制代码
|
|