最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【Aegisub】Bezier_Move之N次貝塞爾粒子曲線

2019-11-07 10:41 作者:多華宮與火火里  | 我要投稿

Bezier_Move函數(shù)的定義:

function Bezier_Move(s_time,e_time,aftimg_dur,x_blur,y_blur,accel,max_space,...)?

? ? ? ? ? ?a = {...}?

? ? ? ? if j == 1 then?

? ? ? ? ? t1 = s_time?

? ? ? ? ? t2 = e_time?

? ? ? ? ? dur = t2-t1?

? ? ? ? ? ?n = #a/2?

? ? ? ? for i = 1,n*2-1,2 do?

? ? ? ? ? x[(i+1)/2] = a[i]?

? ? ? ? end?

? ? ? ?for i = 2, n*2,2 do?

? ? ? ? ? ?y[i/2] = a[i]?

? ? ? ? ? ? end?

? ? ? ? ? c_t = 0?

? ? ? ? ? maxloop(2)?

? ? ? ? ? f_t = 1/(dur/frame_dur)?

? ? ? ? end?

? ? ? ? ? afterimage_dur = aftimg_dur?

? ? ? ?if (afterimage_dur < 0 ) then?

? ? ? ? ? ? ?afterimage_dur = 0?

? ? ? ? ?end?

? ? ? ? ? ? pos_x, pos_y = Bezier(n,x,y,c_t)?

? ? ? ? ? ? n_t = c_t + f_t?

? ? ? ? ? ? n_x, n_y = Bezier(n,x,y,n_t)?

? ? ? ? ? ?dist = math.sqrt(math.abs(n_x-pos_x)^2+math.abs(n_y-pos_y)^2)?

? ? ? ? ? ? a_t =f_t*(max_space/dist)?

? ? ? ?if (a_t > f_t) then?

? ? ? ? ? ? a_t = f_t?

? ? ? ? ?end?

? ? ? ? ? ?n_t = c_t + a_t?

? ? ? ?if (n_t < 1) then?

? ? ? ? ? ? ?maxj = j + 1?

? ? ? ? ?end?

? ? ?retime("presyl",t1+dur*(c_t^accel),t1+dur*(n_t^accel)+afterimage_dur)?

? ? ? ? ? ?t = c_t?

? ? ? ? ? ?c_t = n_t?

? ? ? ? ?return string.format("\\move(%f,%f,%f,%f,%f,%f)",pos_x,pos_y,pos_x+x_blur,pos_y+y_blur,0,dur-dur*t+afterimage_dur)?

?end;?

? ? ? ? ? ? x = {} y = {}

Bezier_Move函數(shù)的參數(shù)說明:

Bezier_Move(s_time,e_time,aftimg_dur,x_blur,y_blur,accel,max_space,...)?


max_space生成的兩個相鄰粒子間的最大距離 距離越大則粒子越少,即max_space越大粒子的濃度就越稀


...表示可以自定義有幾個控制點(diǎn),也就是理論上來說,你能畫出n次的貝塞爾曲線,不僅僅是三次的


s_time決定第一個粒子的開始時間、結(jié)束時間(其它粒子也會相應(yīng)地變化)


e_time決定最后一個粒子的開始時間、結(jié)束時間(其它粒子也會相應(yīng)地變化)


s_time與e_time都不限正負(fù),但是,必須保證e_time-s_time>0

使用該函數(shù)必須的輔助函數(shù):

Comment: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,code,function set_temp(ref,val) temp[ref] = val; return val; end temp = {}

Comment: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,code,function factk(n) k = 1 if (n > 1) then for i = 2, n, 1 do k = k * i end end return k end

Comment: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,code,function bernstein(i,n,t) return (factk(n) / (factk(i)*factk(n-i))) * (t^i) * ((1-t)^(n-i)) end

Comment: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,code,function Bezier(n,x,y,t) p_x = 0 p_y = 0 for i = 1, n, 1 do p_y = p_y + y[i] * set_temp("bern",bernstein(i-1,n-1,t)) p_x = p_x + x[i] * temp.bern ?end return p_x, p_y end

這些直接復(fù)制行

更詳細(xì)的說明參考視頻AV74818506




【Aegisub】Bezier_Move之N次貝塞爾粒子曲線的評論 (共 條)

分享到微博請遵守國家法律
彭州市| 巴彦淖尔市| 信宜市| 正阳县| 威信县| 长顺县| 龙州县| 民权县| 沂水县| 东明县| 宣城市| 平定县| 屏东市| 当雄县| 英山县| 平潭县| 新干县| 沂水县| 榕江县| 大冶市| 子长县| 乐陵市| 收藏| 东乡族自治县| 增城市| 金湖县| 石首市| 喜德县| 南汇区| 赣榆县| 南开区| 泸西县| 五大连池市| 蛟河市| 安康市| 四平市| 洪洞县| 兖州市| 厦门市| 六安市| 彩票|