TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua

 找回密码
 新人加入
查看: 2758|回复: 0

[完整特效] [SAI]015_xxxholicovaOP [复制链接]

Administrator

Shanzhai Pro.

Rank: 7Rank: 7Rank: 7

发表于 2011-10-22 19:17:42 |显示全部楼层
預覽:http://pan.baidu.com/s/1hqqY9CC#dir/path=%2FSaiyakuFX_Preview
  1. from tcaxPy import *


  2. def tcaxPy_Init():
  3.     # Tips: initialize your global variables here
  4.     global _FontSize
  5.     global pyFont
  6.     _FontSize = GetVal(val_FontSize)
  7.     pyFont    = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), GetVal(val_FontSize), GetVal(val_Spacing), GetVal(val_SpaceScale), 0x0000FF, 0, 0)

  8. def tcaxPy_Main(_I, _J, _N, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
  9.     ASS_BUF = []        # used for saving raw TCS FX data


  10.     PIX = TextPix(pyFont, _TXT)
  11.     InitPosX = _X - int(_A / 2 + 0.5) + PIX[0][0]                # left most position of the pixels in PIX
  12.     InitPosY = _Y - int(_FontSize / 2 + 0.5) + PIX[0][1]        # upper most position of the pixels in PIX
  13.     X_list = []
  14.     Y_list = []
  15.     for h in range(PIX[1][1]):
  16.         PosY  = InitPosY + h                                        # y-position of the current pixel

  17.         for w in range(PIX[1][0]):
  18.             PosX = InitPosX + w                                        # x-position of the current pixel

  19.             X = PosX
  20.             Y = PosY
  21.             
  22.             idx  = 4 * (h * PIX[1][0] + w)
  23.             PixR = PIX[2][idx + 0]
  24.             PixG = PIX[2][idx + 1]
  25.             PixB = PIX[2][idx + 2]
  26.             PixA = PIX[2][idx + 3]
  27.             if PixA != 0:
  28.                 Y_list.append(PosY)   
  29.                 X_list.append(PosX)  
  30.     B = Y_list[randint(0,len(Y_list)-1)]   
  31.     A = X_list[randint(0,len(Y_list)-1)]


  32.    
  33.     distance = []
  34.     for h in range(PIX[1][1]):
  35.         PosY  = InitPosY + h                                        # y-position of the current pixel
  36.         for w in range(PIX[1][0]):
  37.             PosX = InitPosX + w                                        # x-position of the current pixel
  38.             X = PosX
  39.             Y = PosY

  40.             idx  = 4 * (h * PIX[1][0] + w)
  41.             PixR = PIX[2][idx + 0]
  42.             PixG = PIX[2][idx + 1]
  43.             PixB = PIX[2][idx + 2]
  44.             PixA = PIX[2][idx + 3]
  45.             if PixA != 0:
  46.                 import math
  47.                 d = int(math.sqrt((X-A)**2+(Y-B)**2))
  48.                 distance.append(d)   
  49.     dmax = max(distance)
  50.     Color = DivClr('FF37FF','6F1F5B',int(dmax))  
  51.   
  52.     for h in range(PIX[1][1]):
  53.         PosY  = InitPosY + h                                        # y-position of the current pixel
  54.         for w in range(PIX[1][0]):
  55.             PosX = InitPosX + w                                        # x-position of the current pixel
  56.             X = PosX
  57.             Y = PosY

  58.             idx  = 4 * (h * PIX[1][0] + w)
  59.             PixR = PIX[2][idx + 0]
  60.             PixG = PIX[2][idx + 1]
  61.             PixB = PIX[2][idx + 2]
  62.             PixA = PIX[2][idx + 3]
  63.             if PixA != 0:                                        # skip transparent pixels
  64.                 import math
  65.                 d = int(math.sqrt((X-A)**2+(Y-B)**2))-1


  66.                 ass_main(ASS_BUF, SubL(_BT+_SK-80+randint(-20,20),_BT+_SK),mov(X+randint(-100,100),Y+randint(-30,30),X,Y)+bord(0)+alpha1(255-PixA)+color1(Color[d]), PixPt())
  67.                 ass_main(ASS_BUF, SubL(_BT+_SK,_ET),pos(X,Y)+fad(0,100)+bord(0)+alpha1(255-PixA)+color1(Color[d]), PixPt())
  68.                 ass_main(ASS_BUF, SubL(_BT+_SK,_ET),pos(X,Y)+fad(0,100)+bord(0)+alpha1(255-PixA)+color1(Color[d]), PixPt())

  69.     ass_main(ASS_BUF, SubL(_BT+_SK-8,_BT+_SK+_KT-8),pos(_X,_Y)+alpha1(255)+color3("FFFFFF")+t1(0,_KT*10,bord(2)+blur(4)),_TXT)
  70.     ass_main(ASS_BUF, SubL(_BT+_SK+_KT-8,_ET),pos(_X,_Y)+fad(0,100)+alpha1(255)+color3("FFFFFF")+bord(2)+blur(5),_TXT)


  71.     return (ASS_BUF,None)


  72. def tcaxPy_Fin():
  73.     # Tips: finalize your global variables here
  74.     FinFont(pyFont)
复制代码
1

查看全部评分

您需要登录后才可以回帖 登录 | 新人加入

GitHub|TCAX 主页

GMT+8, 2024-3-28 19:40

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部
RealH