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

 找回密码
 新人加入
查看: 4630|回复: 4
打印 上一主题 下一主题

[已解决] Gradation colors [复制链接]

Rank: 4

跳转到指定楼层
楼主
发表于 2013-10-31 12:38:28 |只看该作者 |倒序浏览
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)               
复制代码

Administrator

Shanzhai Pro.

Rank: 7Rank: 7Rank: 7

沙发
发表于 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.

Rank: 4

板凳
发表于 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



Administrator

Shanzhai Pro.

Rank: 7Rank: 7Rank: 7

地板
发表于 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.

Rank: 4

5#
发表于 2013-10-31 19:32:43 |只看该作者
Yeah it is

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

GitHub|TCAX 主页

GMT+8, 2024-11-1 07:59

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部
RealH