- UID
- 2546
- 积分
- 159
- 帖子
- 30
- 主题
- 5
- 论坛币
- 868
- 威望
- 0
- EP值
- 134
- MP值
- 0
- 阅读权限
- 50
- 注册时间
- 2015-5-9
- 在线时间
- 52 小时
- 最后登录
- 2024-10-20
|
本帖最后由 Seekladoom 于 2021-6-27 08:49 编辑
看如下内容前请先看此贴:
常用自定义函数AutoTags及其变种的介绍
http://tcax.org/forum.php?mod=viewthread&tid=1230
此函数和AutoTags有相似之处,都能做闪烁字幕效果,不同点在于AutoTags可以按时间变化增加t标签的数量做均匀地来回闪烁,而tag.glitter最多只生成四个t标签,具体代码如下:- function tag.glitter( DurTotal, ExtraTags_i, ExtraTags_f )
- local time_ini, t, t1, t2, t3, t4, Tag_fx = 0, 0, 0, 0, 0, 0, "\\shad0"
- local GT_i, GT_f
- local time_fin = DurTotal or fx.dur
- if type( DurTotal ) == "table" then
- time_ini = DurTotal[ 1 ] or 0
- time_fin = DurTotal[ 2 ] or fx.dur
- elseif type( DurTotal ) == "function" then
- time_ini = DurTotal( )[ 1 ] or 0
- time_fin = DurTotal( )[ 2 ] or fx.dur
- end
- effector.print_error( time_ini, "numbertable", "tag.glitter", 1 )
- effector.print_error( time_fin, "numbertable", "tag.glitter", 1 )
- ----------------------------------------------------------------------
- if retime_mode then
- time_ini, time_fin = retimettag( retime_mode, time_ini, time_fin )
- end --september 09th 2017
- ----------------------------------------------------------------------
- local time_tot = time_fin - time_ini
- i = 0
- while time_tot > t do
- t1 = t + Rrd( 1, time_tot / 2, 1, 2 * i )
- t2 = t1 + 1
- t3 = t2 + frame_dur
- t4 = t3 + 2.5 * frame_dur
- size1 = Rrd( 1.5 * fx.sizex, 2.5 * fx.sizex, 1, i )
- size2 = Rrd( 0.5 * fx.sizex, 1.5 * fx.sizex, 1, -pi * i )
- GT_i = ExtraTags_i or ""
- if type( ExtraTags_i ) == "function" then
- GT_i = ExtraTags_i( i )
- end
- GT_f = ExtraTags_f or ""
- if type( ExtraTags_f ) == "function" then
- GT_f = ExtraTags_f( i )
- end
- ---------------------
- if t4 > time_tot then
- t4 = time_tot
- end
- -- march 12th 2018 --
- Tag_fx = Tag_fx .. format( "\\t(%d,%d,%s\\fscx%d\\fscy%d)\\t(%d,%d,%s\\fscx%d\\fscy%d)",
- time_ini + t1, time_ini + t2, GT_i, size1, size1,
- time_ini + t3, time_ini + t4, GT_f, size2, size2
- )
- t = t4
- i = i + 1
- end
- Tag_fx = string.i( Tag_fx )
- return Tag_fx
- end
复制代码 由于是在Lua文件里面写的,所以tag.glitter加了很多类型判断,而AutoTags的部分逻辑已经由Aegisub自带的Kara-templater.lua实现了,因此省略了很多。
另外AutoTags用于确定t标签的相关循环代码为for循环,而tag.glitter这里是while循环,如果要把tag.glitter改写到AutoTags的话就需要把while代码贴过去并进行相应修改。 |
|