- UID
- 3
- 积分
- 8169
- 帖子
- 259
- 主题
- 68
- 论坛币
- 5016
- 威望
- 54
- EP值
- 2533
- MP值
- 20
- 阅读权限
- 200
- 注册时间
- 2011-8-3
- 在线时间
- 1097 小时
- 最后登录
- 2022-10-8
|
預覽:http://pan.baidu.com/s/1hqqY9CC#dir/path=%2FSaiyakuFX_Preview
第一次用tcvideo 稍微寫了點注釋 tcvideo這個模塊貌似沒發 改天發吧- from tcaxPy import *
- from util.tcVideo import *
- def tcaxPy_Init():
- global _Fs
- global Font
- global fx_fps
- global _FD
- global video
- global _L
- _L = GetVal(val_TextLength)
- _Fs = GetVal(val_FontSize)
- Font = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
- fx_fps = GetVal(val_FXFPS)
- _FD = 1000 / GetVal(val_FXFPS)
- tcVideoInit() # tcvideo初始化
- video = tcVideoOpen('test.mp4') #打開媒體文件
- global light
- light = []
- r_o = 65
- l_o = 0
- for i in range (2200):
- PIX = tcVideoGetFrame(video, int((getBT(0)*10/_FD)+0.5)+i) # 獲取int((getBT(0)*10/_FD)+0.5)+i幀的畫面像素信息
- cc = 30 #這邊沒什麼用 只是在調整 畫面黑白的計算容差
- if int((getBT(0)*10/_FD)+0.5)+i > 30200:
- cc = 15
- if int((getBT(0)*10/_FD)+0.5)+i > 30840:
- cc = 30
- if int((getBT(0)*10/_FD)+0.5)+i > 31040:
- cc = 15
- if int((getBT(0)*10/_FD)+0.5)+i > 31810:
- cc = 5
-
- h = 265 #像素Y坐標
- w = 618 #像素X坐標
- idx = 4 * (h * PIX[1][0] + w) #list腳標
- r = PIX[2][idx + 0] # RGB顏色 R值
- #print(r) #debug用
- if r - r_o > cc:
- l = 1
- elif r_o -r >cc:
- l = 0
- else:
- l=l_o
- light.append(l)
-
- r_o = r
- l_o = l
- def tcaxPy_Fin():
- FinFont(Font)
- tcVideoClose(video) #關閉
- tcVideoFin()
- def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
- ASS_BUF = [] # 保存ASS特效
- TCAS_BUF = [] # 保存TCAS特效
-
- dx = _X - int(_A / 2 + 0.5)
- dy = _Y - int(_Fs / 2 + 0.5)
- outline = TextOutlineDraw(Font, _TXT, dx, dy)
- t0 = _BT - 15 + _j * 7
- t1 = t0 + 50
- t2 = _BT + _SK - 5
- t3 = _BT + _SK + _KT
- t4 = _ET - 60 + _j * 7
- t5 = t4 + 15
- scol = 'FFFFFF'
- T = 120
- if _KT>120:
- T = _KT
-
- ass_main(ASS_BUF, SubL(t2, t2+T, 11, Pix_Style), pos(0, 0) + fad(0, 900) + alpha1(0) + alpha3(HexToDec('77')) + \
- blur(5) + bord(5) + t(bord(0)), '{\\p7}' + outline + '{\\p0}')
- ass_main(ASS_BUF, SubL(t0, t5, 5, Pix_Style), pos(1, 1) + fad(500, 500) + alpha1(0) + blur(1.3) + color1('000000'), \
- '{\\p7}' + outline + '{\\p0}')
- bframe = int((t0-getBT(0))*10/_FD)
- if light[bframe]==1:
- ass_main(ASS_BUF, SubL(t0, t1, 6, Pix_Style), pos(0, 0) + fad(500, 0) + alpha1(150) + color1('FFFFFF'),'{\\p7}' + outline + '{\\p0}')
- else:
- ass_main(ASS_BUF, SubL(t0,t1, 6, Pix_Style), pos(0, 0) + fad(500, 0) + alpha1(120) + color1('000000'),'{\\p7}' + outline + '{\\p0}')
-
- frames = int((_ET - 60-t1)*10 / _FD + 0.5) #總幀數
- bframe = int((t1-getBT(0))*10/_FD) #開始幀
- ts = t1
- te = t1
- ll = light[bframe]
- ll_o = light[bframe]
- for i in range(frames): #逐幀
- te += _FD / 10
- ll = light[bframe+i]
- if ll != ll_o:
- ll_o = ll
- if te < _ET - 60:
- if ll!=1:
- ass_main(ASS_BUF, SubL(ts, te - _FD / 10, 6, Pix_Style), pos(0, 0) +fad(30,30) + alpha1(150) + color1('FFFFFF'),'{\\p7}' + outline + '{\\p0}')
- else:
- ass_main(ASS_BUF, SubL(ts,te - _FD / 10, 6, Pix_Style), pos(0, 0) +fad(30,30) + alpha1(120) + color1('000000'),'{\\p7}' + outline + '{\\p0}')
- ts = te - _FD / 10
- # 這下面就沒什麼好講的了 無視
- lastptx0 = 0
- lastpty0 = 0
- first = True
- ti = t0 - 100 + randint(-30, 30)
- while ti <= t5 - 150:
- ptt0 = ti
- ptt1 = ptt0 + 300
- ptx0 = randint(_X - 20, _X + 20)
- pty0 = randint(_Y - 20, _Y + 20)
- if not first:
- for i in range(2):
- ptx0_tmp = randint(_X - 20, _X + 20)
- pty0_tmp = randint(_Y - 20, _Y + 20)
- if GetDistance(lastptx0, lastpty0, ptx0, pty0) < GetDistance(lastptx0, lastpty0, ptx0_tmp, pty0_tmp):
- ptx0 = ptx0_tmp
- pty0 = pty0_tmp
- first = False
- lastptx0 = ptx0
- lastpty0 = pty0
- ptcol = 'FFFFFF'
- lumsz = 15 + GetDistance(_X, _Y, ptx0, pty0) * 0.5
- if ptt0 >= t2:
- ptcol = scol
- ts0 = ''
- if ptt0 < t2 and ptt1 > t2:
- ts0 = t(10 * (t2 - ptt0) - 10, 10 * (t2 - ptt0), color1(scol) + color3(scol))
- dup = 1
- if _j >= 4:
- dup = 2
- while dup > 0:
- ass_main(ASS_BUF, SubL(ptt0, ptt1, 10, Pix_Style), pos(ptx0, pty0) + clip(7, outline) + org(_X, _Y) + t(frz(RandSign() * randint(80, 120))) + \
- fad(800, 800) + t(0, 10 * (ptt1 - ptt0), bord(lumsz) + blur(lumsz)) + alpha1(HexToDec('44')) + alpha3(HexToDec('44')) + color1(ptcol) + color3(ptcol) + \
- ts0 + t((ptt1 - ptt0) * 700, ptt1, color1('000000') + color3('000000')), PixPt())
- dup -= 1
- ti += randint(120, 165)
-
-
- return (ASS_BUF, TCAS_BUF)
复制代码 |
-
3
查看全部评分
-
|