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

标题: Gradation colors [打印本页]

作者: Alex    时间: 2013-10-31 12:38:28     标题: Gradation colors

Hi everyone

I was trying to make gradation colors but i got problem

Untitled.png


my code
  1. from tcaxPy import *                 


  2. def tcaxPy_Init():


  3.     global _FontFileName
  4.     global _FaceID
  5.     global _Fs
  6.     global _Wd
  7.     global _Ht
  8.     global _Dx
  9.     global _Dy
  10.     global _Spc
  11.     global _Sps
  12.     global _Br
  13.     global _FD                         
  14.     global COLOR

  15.     _FontFileName  = GetVal(val_FontFileName)
  16.     _FaceID        = GetVal(val_FaceID)
  17.     _Fs            = GetVal(val_FontSize)
  18.     _Wd            = GetVal(val_ResolutionX)
  19.     _Ht            = GetVal(val_ResolutionY)
  20.     _Dx            = GetVal(val_OffsetX)
  21.     _Dy            = GetVal(val_OffsetY)
  22.     _Spc           = GetVal(val_Spacing)
  23.     _Sps           = GetVal(val_SpaceScale)
  24.     _Br            = GetVal(val_Blur)
  25.     _FD           = 1000 / GetVal(val_FXFPS)
  26.     COLOR = DivClr(GetVal(val_1C), GetVal(val_2C), _Fs)
  27.     global _FontSize
  28.     global pyFont
  29.     _FontSize = GetVal(val_FontSize)
  30.     pyFont    = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), GetVal(val_FontSize), GetVal(val_Spacing), GetVal(val_SpaceScale), 0x0000FF, 0, 0)


  31. def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):

  32.     ASS_BUF = []                 
  33.     TCAS_BUF = []                 

  34.     _7X = _X - int(_A / 2 + 0.5)
  35.     _7Y = _Y - int(_FontSize / 2 + 0.5)
  36.     _H = _FontSize

  37.     if _i==0:
  38.         Blur = blur(2)
  39.         Be = be(1)
  40.         Bord =bord(2)
  41.         for i in range(_H + 2):
  42.             CLIP = clip(_7X - 1-5, _7Y + i - 1, _7X + 1 + _H+5, _7Y + i)
  43.             M = t1(0,50,mov(_X,_Y,_X+randint(-2,2),_Y))+ color1(COLOR[i])+t1(50,100,mov(_X,_Y,_X+randint(-2,2),_Y))+t1(100,150,mov(_X,_Y,_X+randint(-2,2),_Y))
  44.             for k in range(AdvInt(_KT/10)):
  45.                 ass_main(ASS_BUF, SubL(_BT+_SK+k*10,_BT+_SK+(k+1)*10),Be +Blur+ Bord + M +CLIP, _TXT)
  46.         ass_main(ASS_BUF, SubL(_BT+_SK+(k+1)*10,_ET),pos(_X,_Y)+Be +Blur+Bord, _TXT)   


  47.     return (ASS_BUF, TCAS_BUF)               
复制代码


图片附件: Untitled.png (2013-10-31 12:36:08, 39.78 KB) / 下载次数 1672
http://tcax.org/forum.php?mod=attachment&aid=MTQ4NXwyNjc5NDQ0Y3wxNzMyMjk1NTE4fDB8MA%3D%3D


作者: saiyaku    时间: 2013-10-31 17:37:27

Please change "COLOR = DivClr(GetVal(val_1C), GetVal(val_2C), _Fs)" to "COLOR = DivClr(GetVal(val_1C), GetVal(val_2C), _H + 2)".
The third parameter of fuction DivCLr means the number of pieces into which the color is devided.

作者: Alex    时间: 2013-10-31 18:52:44

本帖最后由 Alex 于 2013-10-31 18:53 编辑

Sooka!

but still there is something missing until script working, is definition _H. so i wrote

|    _FontSize = GetVal(val_FontSize)
|    _H = _FontSize
|    COLOR = DivClr(GetVal(val_1C), GetVal(val_2C), _H + 2)

now everything OK =D

-------------

I have another question, is there any example to do like this gradation colors?


1.png





图片附件: 1.png (2013-10-31 18:52:29, 100.25 KB) / 下载次数 1650
http://tcax.org/forum.php?mod=attachment&aid=MTQ4Nnw0NzZjMTZjNnwxNzMyMjk1NTE4fDB8MA%3D%3D


作者: saiyaku    时间: 2013-10-31 19:04:46

Alex 发表于 2013-10-31 18:52
Sooka!

but still there is something missing until script working, is definition  _H. so i wrote

GJ!

And...
http://www.tcax.org/forum.php?mod=viewthread&tid=270
I think 'main_m003.py' is the example you want.
作者: Alex    时间: 2013-10-31 19:32:43

Yeah it is

Shukran jazilan =D




欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/) Powered by Discuz! X2