Skip to content

Instantly share code, notes, and snippets.

@istallia
Last active September 20, 2021 12:24
Show Gist options
  • Save istallia/f2b7bae73b598a529bbe5afe5fac344b to your computer and use it in GitHub Desktop.
Save istallia/f2b7bae73b598a529bbe5afe5fac344b to your computer and use it in GitHub Desktop.
図形の種類"背景"に適用してフェードイン・アウトを簡単に作るスクリプト
--track0:時間(s),0,10,0.5,0.01
--track1:重み,0.01,6.00,2.00,0.01
--check0:イン→アウト,0
--dialog:フェードイン/chk,fade_in=1;フェードアウト/chk,fade_out=1;
local effect_time = obj.track0
local power = 1.0 / obj.track1
local is_in_out = obj.check0 == 1
local t = obj.time
local tt = obj.totaltime
local alpha = 1.0
if t < effect_time and fade_in == 1 then
alpha = math.pow(t/effect_time, power)
elseif tt - effect_time < t and fade_out == 1 then
t = t - tt + effect_time
alpha = (1.0 - math.pow(t/effect_time, power))
end
if is_in_out then
alpha = 1.0 - alpha
end
obj.alpha = obj.alpha * alpha
@istallia
Copy link
Author

雑ですが設定項目の説明です
好きに使ってください

項目 説明
時間(s) フェードイン・アウトにかかる時間
重み フェードの透明度の変化の重み
イン→アウト チェックを入れると開始時にイン、終了時にアウト
フェードイン チェックを入れるとフェードイン
フェードアウト チェックを入れるとフェードアウト

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment