五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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次貝塞爾粒子曲線的評論 (共 條)

分享到微博請遵守國家法律
正阳县| 六盘水市| 古丈县| 汨罗市| 同仁县| 获嘉县| 镇赉县| 磴口县| 即墨市| 民和| 筠连县| 新乡市| 金湖县| 平罗县| 延川县| 黄陵县| 错那县| 溧阳市| 刚察县| 镇巴县| 徐水县| 永兴县| 云龙县| 喜德县| 灵山县| 康马县| 新宁县| 岢岚县| 平遥县| 自治县| 开原市| 行唐县| 连山| 当雄县| 疏勒县| 澳门| 夹江县| 天等县| 嘉义市| 隆安县| 菏泽市|