Skip to content
This repository was archived by the owner on Jun 25, 2026. It is now read-only.

Commit 7b6b010

Browse files
committed
Feature: Add src
1 parent f7534a1 commit 7b6b010

4 files changed

Lines changed: 324 additions & 1 deletion

File tree

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.lua text eol=crlf linguist-language=Lua working-tree-encoding=cp932
2+
*.obj text eol=crlf linguist-language=Lua working-tree-encoding=cp932
3+
*.anm text eol=crlf linguist-language=Lua working-tree-encoding=cp932
4+
*.scn text eol=crlf linguist-language=Lua working-tree-encoding=cp932
5+
*.cam text eol=crlf linguist-language=Lua working-tree-encoding=cp932
6+
*.tra text eol=crlf linguist-language=Lua working-tree-encoding=cp932
7+
*.anm2 text eol=crlf linguist-language=Lua working-tree-encoding=UTF-8

.github/workflows/releaser.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: releaser
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
releaser:
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
15+
steps:
16+
- name: Chekout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Create zip file
22+
run: |
23+
cp *.md script
24+
cp LICENSE script
25+
zip -r -q -@ AutoLyricAnimation_K_${{ github.ref_name }}.zip ./script
26+
27+
- name: Create release note
28+
run: |
29+
count=0
30+
IFS=$'\n'
31+
while read line; do
32+
if [ ${count} = 0 ] && [[ ${line} =~ "Change Log" ]]; then
33+
count=1
34+
elif [ ${count} = 1 ] && [[ ${line} =~ "*v" ]]; then
35+
count=2
36+
elif [ ${count} = 2 ] && [[ ${line} =~ "*v" ]]; then
37+
break
38+
elif [ ${count} = 2 ]; then
39+
echo ${line} >> ReleaseNote.txt
40+
fi
41+
done < README.md
42+
43+
- name: Create release
44+
uses: softprops/action-gh-release@v2
45+
with:
46+
name: AutoLyricAnimation_K_${{ github.ref_name }}
47+
files: '*.zip'
48+
body_path: ReleaseNote.txt

README.md

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,112 @@
1-
# AviUtl2_AutoLyricAnimation_K_Script
1+
# AutoLyricAnimation_K
2+
3+
![GitHub License](https://img.shields.io/github/license/korarei/AviUtl2_AutoLyricAnimation_K_Script)
4+
![GitHub Last commit](https://img.shields.io/github/last-commit/korarei/AviUtl2_AutoLyricAnimation_K_Script)
5+
![GitHub Downloads](https://img.shields.io/github/downloads/korarei/AviUtl2_AutoLyricAnimation_K_Script/total)
6+
![GitHub Release](https://img.shields.io/github/v/release/korarei/AviUtl2_AutoLyricAnimation_K_Script)
7+
28
AviUtl2でリリックモーションを行うためのスクリプト
9+
10+
[ダウンロードはこちらから.](https://github.com/korarei/AviUtl2_AutoLyricAnimation_K_Script/releases)
11+
12+
## 動作確認
13+
14+
- [AviUtl ExEdit2 beta1](https://spring-fragrance.mints.ne.jp/aviutl/)
15+
16+
17+
## 導入・削除・更新
18+
19+
初期配置場所は`Transition (切り替え効果)`である.
20+
21+
### 導入
22+
23+
1. 同梱の`*.anm2``C:\\ProgramData\\aviutl2\\Script`フォルダまたはその子フォルダに入れる.
24+
25+
### 削除
26+
27+
1. 導入したものを削除する.
28+
29+
### 更新
30+
31+
1. 導入したものを上書きする.
32+
33+
## 使い方
34+
35+
- Ref Motion
36+
37+
ここのトラックバーの移動を読み取り,リリックモーションを行う.この区間は1文字分であり,テキスト全体の長さではない.
38+
39+
ここで設定できる移動方法であれば,どのような移動方法でもリリックモーションを行える.
40+
41+
設定例: 0.0 -> 1.0 直線移動 (時間制御)
42+
43+
- Max Dist
44+
45+
最大移動量.
46+
47+
- Spread
48+
49+
開始,終了位置のランダムさ.
50+
51+
- Speed
52+
53+
変化速度 (変化量倍率).1倍のとき,1文字は100フレームで動作を完了する.
54+
55+
- Interval
56+
57+
文字の登場間隔.変化速度によって間隔も変化する.
58+
59+
- Move X
60+
61+
X軸方向に移動させる.
62+
63+
- Move Y
64+
65+
Y軸方向に移動させる.
66+
67+
- Omni Dirs
68+
69+
無効のとき右下から登場するが,有効にすることで上下左右からの移動を認める.
70+
71+
- Inv Dirs
72+
73+
移動方向を反転させる.
74+
75+
- Type
76+
77+
移動のタイプを指定する.
78+
79+
- In: 登場
80+
81+
- Out: 退出
82+
83+
- In/Out: 登場と退出.退出時参照モーションは逆再生となる.
84+
85+
- Scale
86+
87+
登場退場時の瞬間の拡大率.絶対値ではなく相対値である.
88+
89+
`Entry`は登場時の瞬間拡大率,`Exit`は退場時の瞬間拡大率を意味する.%で指定.
90+
91+
- Rand Flip
92+
93+
登場退場時に瞬間的に反転させる.反転確率は0.5.
94+
95+
`Entry`は登場時のランダム反転,`Exit`は退場時のランダム反転の有効無効を意味する.
96+
97+
- Seed
98+
99+
乱数発生のシード値を設定する.マイナスでレイヤーを移動させても値が変化しない.
100+
101+
102+
## 謝辞
103+
104+
本スクリプトは,moll様が公開されている[全自動リリックモーション](https://drive.google.com/drive/folders/1DaBcNEEVqcmz6iUaLLFfUlsjwz39yyz3)を参考に作成いたしました.このような場をお借りして恐縮ではございますが,革新的かつ非常に有用なスクリプトを公開いただき,心より御礼申し上げます.
105+
106+
## License
107+
LICENSEファイルに記載.
108+
109+
110+
## Change Log
111+
- **v1.0.0**
112+
- release

script/AutoLyricAnimation_K.anm2

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
--infomation:AutoLyricAnimation_K.anm2 v1.0.0
2+
--label:Transition
3+
4+
--track0:Ref Motion,0,1,0,0.001
5+
--track1:Max Dist,0,2000,500,0.001
6+
--track2:Spread,0,100,50,1
7+
--track3:Speed,0,100,4,0.001
8+
--track@_1:Interval,0,100,8,1
9+
--check@_2:Move X,1
10+
--check@_3:Move Y,1
11+
--check@_4:Omni Dirs,1
12+
--check@_5:Inv Dirs,0
13+
--select@_6:Type,In=0,Out=1,In/Out=2
14+
--track@_7:Entry Scale,0,800,200
15+
--check@_8:Entry Rand Flip,0
16+
--track@_9:Exit Scale,0,800,200
17+
--check@_10:Exit Rand Flip,0
18+
--track@_11:Seed,-500,500,-1,1
19+
20+
local max_distance = obj.track1
21+
local spread_amt = obj.track2
22+
local speed = obj.track3
23+
local interval = _1 _1 = nil
24+
local can_move_x = _2 == 1 _2 = nil
25+
local can_move_y = _3 == 1 _3 = nil
26+
local is_omni_dirs = _4 == 1 _4 = nil
27+
local is_inv = _5 == 1 _5 = nil
28+
local anm_type = _6 _6 = nil
29+
local entry_scale = _7 / 100.0 _7 = nil
30+
local use_entry_rand_flip = _8 == 1 _8 = nil
31+
local exit_scale = _9 / 100.0 _9 = nil
32+
local use_exit_rand_flip = _10 == 1 _10 = nil
33+
local seed = _11 _11 = nil
34+
35+
local prog_delta = 100.0
36+
local rand_cnt = 0
37+
38+
local function is_zero(val)
39+
local epsilon = 1e-4
40+
return math.abs(val) < epsilon
41+
end
42+
43+
local function clamp(val, min, max)
44+
return math.max(min, math.min(max, val))
45+
end
46+
47+
local function rand(st, ed)
48+
local r = obj.rand(st, ed, seed, obj.index + rand_cnt * obj.num)
49+
rand_cnt = rand_cnt + 1
50+
return r
51+
end
52+
53+
local function get_motion(track_type, ratio, is_inv_motion)
54+
local st = obj.getvalue(track_type, 0.0)
55+
local ed = obj.getvalue(track_type, 0.0, -1)
56+
local scale = ed - st
57+
58+
if is_zero(scale) then
59+
return obj.time / obj.totaltime
60+
end
61+
62+
local val
63+
if (not is_inv_motion) then
64+
val = obj.getvalue(track_type, obj.totaltime * ratio) - st
65+
else
66+
val = ed - obj.getvalue(track_type, obj.totaltime * (1-ratio))
67+
end
68+
69+
return val / scale
70+
end
71+
72+
local function calc_prog()
73+
return speed * obj.frame - obj.index * interval
74+
end
75+
76+
local function calc_delta(motion)
77+
return motion * max_distance * rand(0, spread_amt) / 100.0
78+
end
79+
80+
local function in_animation()
81+
local prog = calc_prog()
82+
83+
if (prog < 0) then
84+
obj.alpha = 1e-4
85+
elseif (prog < speed) then
86+
obj.zoom = math.max(obj.zoom * entry_scale, 1e-4)
87+
88+
if use_entry_rand_flip then
89+
local is_flip = rand(0, 1) == 0
90+
if is_flip then
91+
obj.effect("反転", "左右反転", 1)
92+
end
93+
end
94+
end
95+
96+
prog = clamp(prog, 0.0, prog_delta) / prog_delta
97+
98+
local motion = 1 - get_motion(0, prog, false)
99+
return calc_delta(motion)
100+
end
101+
102+
local function out_animation(is_inv_motion)
103+
local anm_len = prog_delta + interval * (obj.num - 1)
104+
local st = speed * obj.totalframe - anm_len - 1
105+
local prog = calc_prog() - st
106+
107+
if (prog > prog_delta) then
108+
obj.alpha = 1e-4
109+
elseif (prog > prog_delta - speed) then
110+
obj.zoom = math.max(obj.zoom * exit_scale, 1e-4)
111+
112+
if use_exit_rand_flip then
113+
local is_flip = rand(0, 1) == 0
114+
if is_flip then
115+
obj.effect("反転", "左右反転", 1)
116+
end
117+
end
118+
end
119+
120+
prog = clamp(prog, 0.0, prog_delta) / prog_delta
121+
122+
local motion = get_motion(0, prog, is_inv_motion)
123+
return calc_delta(motion)
124+
end
125+
126+
local delta = 0.0
127+
if (anm_type == 0) then
128+
delta = in_animation()
129+
elseif (anm_type == 1) then
130+
delta = out_animation()
131+
elseif (anm_type == 2) then
132+
delta = in_animation()
133+
delta = delta + out_animation(true)
134+
end
135+
136+
if (is_omni_dirs) then
137+
local is_inv_dir = rand(0, 1) == 0
138+
if is_inv_dir then
139+
delta = -delta
140+
end
141+
end
142+
143+
if (is_inv) then
144+
delta = -delta
145+
end
146+
147+
if can_move_x and can_move_y then
148+
local is_x = rand(0, 1) == 0
149+
if is_x then
150+
obj.ox = obj.ox + delta
151+
else
152+
obj.oy = obj.oy + delta
153+
end
154+
elseif can_move_x then
155+
obj.ox = obj.ox + delta
156+
elseif can_move_y then
157+
obj.oy = obj.oy + delta
158+
end

0 commit comments

Comments
 (0)