Skip to content

Instantly share code, notes, and snippets.

@istallia
Last active September 7, 2020 11:45
Show Gist options
  • Save istallia/efd8a20ab1e2453fe6e04e3c3f83b5f7 to your computer and use it in GitHub Desktop.
Save istallia/efd8a20ab1e2453fe6e04e3c3f83b5f7 to your computer and use it in GitHub Desktop.
【Recotte Studio(体験版)】ワイプ(四角形)のトランジション
-- === エディタ上で表示する情報を返す ===
function GetInfo()
local info = {
name = "rect-wipe-in",
displayname = {
en = "Rect-wipe-in",
ja = "ワイプ(四角形/内側)"
}
}
return info
end
-- === 諸々の何もしない関数 ===
function InitTransition()
-- do nothing
end
function UpdateProperty()
-- do nothing
end
function Order()
return 0
end
-- === 前の動画の表示 ===
function RenderA(effInfo, tex, param)
Draw(tex, param)
end
-- === 後の動画の表示 ===
function RenderB(effInfo, tex, param)
-- 各種情報の取得
local et = effInfo.t --エフェクト時間(0~1)
local rect = param.bounds --表示範囲
local uv = param.uv --図形自体の情報(xもyも0~1らしい)
-- ワイプの四角形の大きさを計算
local rectWidth = math.max(rect.w, rect.h) * (1 - et)
local uvWidth = math.max(uv.w, uv.h) * (1 - et)
local uvRatio = rect.w / rect.h
-- 頂点情報を用意する(?)
local segRect1 = Rect(rect.x, rect.y, (rect.w-rectWidth)/2, rect.h)
local segRect2 = Rect(rect.x+(rect.w+rectWidth)/2, rect.y, (rect.w-rectWidth)/2, rect.h)
local segRect3 = Rect(rect.x+(rect.w-rectWidth)/2, rect.y, rectWidth, (rect.h-rectWidth)/2)
local segRect4 = Rect(rect.x+(rect.w-rectWidth)/2, rect.y+(rect.h+rectWidth)/2, rectWidth, (rect.h-rectWidth)/2)
local points1 = VEC3.Plate(segRect1)
local points2 = VEC3.Plate(segRect2)
local points3 = VEC3.Plate(segRect3)
local points4 = VEC3.Plate(segRect4)
-- 描画する
param.uv = Rect(uv.x, uv.y, (uv.w-uvWidth)/2, uv.h)
Draw3DPlate(points1, tex, param)
param.uv = Rect(uv.x+(uv.w+uvWidth)/2, uv.y, (uv.w-uvWidth)/2, uv.h)
Draw3DPlate(points2, tex, param)
param.uv = Rect(uv.x+(uv.w-uvWidth)/2, uv.y, uvWidth, (uv.h-uvWidth*uvRatio)/2)
Draw3DPlate(points3, tex, param)
param.uv = Rect(uv.x+(uv.w-uvWidth)/2, uv.y+(uv.h+uvWidth*uvRatio)/2, uvWidth, (uv.h-uvWidth*uvRatio)/2)
Draw3DPlate(points4, tex, param)
end
-- === エディタ上で表示する情報を返す ===
function GetInfo()
local info = {
name = "rect-wipe-in-2",
displayname = {
en = "Rect-wipe-in 2",
ja = "ワイプ(四角形/外側)"
}
}
return info
end
-- === 諸々の何もしない関数 ===
function InitTransition()
-- do nothing
end
function UpdateProperty()
-- do nothing
end
function Order()
return 0
end
-- === 前の動画の表示 ===
function RenderA(effInfo, tex, param)
Draw(tex, param)
end
-- === 後の動画の表示 ===
function RenderB(effInfo, tex, param)
-- 各種情報の取得
local et = effInfo.t --エフェクト時間(0~1)
local rect = param.bounds --表示範囲
local uv = param.uv --図形自体の情報(xもyも0~1らしい)
-- ワイプの四角形の大きさを計算
local maxWidth = math.max(rect.w, rect.h)
local rectWidth = maxWidth * et
local uvMaxWidth = math.max(uv.w, uv.h)
local uvWidth = uvMaxWidth * et
local uvRatio = rect.w / rect.h
-- 頂点情報を用意する(?)
local segRect = Rect(rect.x+(rect.w-rectWidth)/2, rect.y+(rect.h-rectWidth)/2, rectWidth, rectWidth)
local points = VEC3.Plate(segRect)
-- 描画する
param.uv = Rect(uv.x+(uv.w-uvWidth)/2, uv.y+(uv.h-uvWidth*uvRatio)/2, uvWidth, uvWidth*uvRatio)
Draw3DPlate(points, tex, param)
end

Readme

四角形のワイプのトランジションです。
AviUtlのシーンチェンジにあるひし形や円形のワイプを目指して砕け散り、それでも「何の成果も得られませんでしたァー!」するのが嫌だったのでひとまず四角形で作った代物です。

導入

RecotteStudio/effects/transitionsの中にこの2つのLuaファイルをコピーするだけです。
Recotte Studioを起動すると、トランジションの選択肢に「ワイプ(四角形/内側」と「ワイプ(四角形/外側)」が追加されています。

アイコンがないのが気になる方は、雑なものでよければ用意しているので、コメント欄からpngかzipで置いているものをダウンロードして、同様にコピーしてください。

注意

  • 最適化とか何も考えずに書きました。プレビューや書き出しが重いです。
  • ソフトのインストールフォルダに直接配置しているため、(ないと思いますが)レコスタのアップデータが更新時に消してしまうかもしれません。
@istallia
Copy link
Author

istallia commented Sep 7, 2020

雑アイコンはこちら。2つの画像が同じものに見える場合、あなたの目は正常なので安心してほしい。
3000_rect-wipe
3001_rect-wipe-2

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