- UID
- 3
- 积分
- 8169
- 帖子
- 259
- 主题
- 68
- 论坛币
- 5016
- 威望
- 54
- EP值
- 2533
- MP值
- 20
- 阅读权限
- 200
- 注册时间
- 2011-8-3
- 在线时间
- 1097 小时
- 最后登录
- 2022-10-8
|
发表于 2012-8-21 11:03:15
|显示全部楼层
預覽:http://pan.baidu.com/s/1hqqY9CC#dir/path=%2FSaiyakuFX_Preview
都是逐幀特效,TCAS應該封裝 給兩個狀態 中間自動過渡幀才行嘛
這寫得一口老血- from tcaxPy import *
- from collections import deque
- from extLibs._PythonMagick import *
- def tcaxPy_Init():
- global _FontFileName # 字体文件名
- global _FaceID # 字体Face序号
- global _Fs # 字体大小
- global _TextWidth # 文字宽度
- global _TextHeight # 文字高度
- global _TextLength
- global _TextAdvDiff
- global _ResolutionX
- global _ResolutionY
- global _OffsetX
- global _OffsetY
- global _FD # 一帧的持续时间, 40毫秒
- global Font # 首要字体
- global FontOut # 字体边框
- global Font2
- global _AD
- global _Advance
- _FontFileName = GetVal(val_FontFileName)
- _FaceID = GetVal(val_FaceID)
- _Fs = GetVal(val_FontSize)
- _TextHeight = GetVal(val_TextHeight)
- _TextWidth = GetVal(val_TextWidth)
- _TextLength = GetVal(val_TextLength)
- _TextAdvDiff = GetVal(val_TextAdvanceDiff)
- _ResolutionX = GetVal(val_ResolutionX)
- _ResolutionY = GetVal(val_ResolutionY)
- _OffsetX = GetVal(val_OffsetX)
- _OffsetY = GetVal(val_OffsetY)
- _FD = 1000 / GetVal(val_FXFPS)
- _AD = GetVal(val_TextAdvanceDiff)
- _Advance = GetVal(val_TextAdvance)
- Font = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), MakeRGB(0, 0, 0), 0, False)
- FontOut = InitFont(_FontFileName, _FaceID, _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), MakeRGB(0, 0, 0), 1.5, True)
- Font2 = InitFont(_FontFileName, _FaceID, 48, GetVal(val_Spacing), GetVal(val_SpaceScale), MakeRGB(0, 0, 0), 0, False)
- def tcaxPy_Fin():
- FinFont(Font)
- FinFont(FontOut)
- FinFont(Font2)
- def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
- ASS_BUF = []
- TCAS_BUF = []
- dx = _X - int(_A / 2 + 0.5) # 一个固定操作, 将an5的坐标转换为an7
- dy = _Y - int(_Fs / 2 + 0.5) # ASS特效默认采用an5坐标, TCAS特效则采用an7坐标
- t3 = _BT*10
- t4 = (_BT+_SK)*10
- t5 = (_BT+_SK+_KT)*10
- t6 = _ET*10
- num = int(10 * _KT / _FD)+1
- d = 0
- if _j >= 1:
- d = _AD[_i][_j] + _Advance[_i][_j] / 2 -_AD[_i][_j-1] -_Advance[_i][_j-1] / 2
- if _i > -1:
- n = int((_BT+_SK)*10/_FD)
- TPIX1 = TextPix(Font, _TXT)
- TPIX = TPIX1
- TPIX1 = PixColorRGB(TPIX1, DecRGB('FFFFFF'))
- texture = ImagePix(abspath('sky.png'))
-
- TPIX2 = TextPix(Font2, _TXT)
- TPIX2 = PixTexture(TPIX2,texture)
- TPIX2 = PixPos(TPIX2, TPIX1[0][0] + (TPIX1[1][0] - TPIX2[1][0]) / 2, TPIX1[0][1] + (TPIX1[1][1] - TPIX2[1][1]) / 2)
- SHAD = 2
- OPIX = TextPix(FontOut, _TXT)
- OPIX = PixColorRGB(OPIX, DecRGB('000000'))
- SPIX3 = PixPos(TPIX, TPIX[0][0]+SHAD,TPIX[0][1]+SHAD)
- SPIX3 = PixColorRGB(SPIX3, DecRGB('000000'))
- OSPIX = CombinePixs(SPIX3, OPIX)
- TPIX3 = CombinePixs(OSPIX, TPIX1)
- FPIX1 = ImagePix(abspath('flower.png'))
- FPIX2 = PixResize(FPIX1, _Fs*1.7, _Fs*1.7)
-
- SPIX1 = PixColorRGB(TPIX2, DecRGB('000000'))
- SPIX2 = PixBlur(SPIX1, 1)
- SPIX2 = PixPos(SPIX2, SPIX1[0][0]+1,SPIX1[0][1]+1)
- PIX = CombinePixs(SPIX2, TPIX2)
- tcas_main(TCAS_BUF, TPIX3, t3 , t4, dx, dy, 3)
- tcas_main(TCAS_BUF, TPIX3, t5 , t6, dx, dy, 3)
- img = pmgToImage(FPIX2)
- img.filterType(FilterTypes.QuadraticFilter)
- img.backgroundColor(Color())
- if _j == 0:
- global angle
- angle=0
-
- img0 = img
- for i in range(num):
- img = Image(img0)
- img.rotate(angle + 5.5*i)
- FPIX3 = pmgToPix(img)
- FPIX4 = PixPos(FPIX3, TPIX1[0][0] + (TPIX1[1][0] - FPIX3[1][0]) / 2+i*d/num, TPIX1[0][1] + (TPIX1[1][1] - FPIX3[1][1]) / 2)
- tb = _FD*n + _FD * i
- te = tb + _FD
- if _i < 3:
- tcas_main(TCAS_BUF, FPIX4,tb,te, dx, dy, 0)
- XPIX = PIX
- if i > 3:
- XPIX = PixResizeF(PIX, PIX[1][0] - (i-3)*(PIX[1][0]-TPIX1[1][0])/(num-3),PIX[1][1] - (i-3)*(PIX[1][1]-TPIX1[1][1])/(num-3) ) #PIX[1][1] - i*(PIX[1][1]-TPIX1[1][1])/num
- XPIX = BilinearFilter(XPIX, dx, dy)
- tcas_main(TCAS_BUF, XPIX, tb, te, dx, dy, 10)
- angle += num*5.5
- if _i > 3:
- ZPIX = ImagePix(abspath('s.png'))
- ZPIX = PixResize(ZPIX, _Fs*1.7, _Fs*1.7)
- zimg = pmgToImage(ZPIX)
- zimg.filterType(FilterTypes.QuadraticFilter)
- zimg.backgroundColor(Color())
- zimg.rotate(randint(0,90))
- zimg0 = zimg
- zimg1 = zimg
- for i in range(num):
- zimg3 = Image(zimg0)
- zimg4 = Image(zimg1)
- zimg3.rotate( 5.5*i)
- zimg4.rotate( -5.5*i)
- ZPIX3 = pmgToPix(zimg3)
- ZPIX4 = pmgToPix(zimg4)
- ZPIX3 = PixPos(ZPIX3, TPIX1[0][0] + (TPIX1[1][0] - ZPIX3[1][0]) / 2, TPIX1[0][1] + (TPIX1[1][1] - ZPIX3[1][1]) / 2)
- ZPIX4 = PixPos(ZPIX4, TPIX1[0][0] + (TPIX1[1][0] - ZPIX4[1][0]) / 2, TPIX1[0][1] + (TPIX1[1][1] - ZPIX4[1][1]) / 2)
- tb = _FD*n + _FD * i
- te = tb + _FD
- tcas_main(TCAS_BUF, ZPIX3,tb,te, dx, dy, 0)
- tcas_main(TCAS_BUF, ZPIX4,tb,te, dx, dy, 0)
- return (ASS_BUF, TCAS_BUF)
-
复制代码 |
-
2
查看全部评分
-
|