小鳥さんトーク

「小鳥さんトーク」の編集履歴(バックアップ)一覧に戻る

小鳥さんトーク - (2008/02/26 (火) 20:19:57) のソース

*小鳥さんトーク部分ベータ版
いずれは関数本体に統合。

#codehighlight(avs){{{
ImageDir = "image\"
BgmDir   = "bgm\"

# ***** 1ページ目

msg1_1 = "プロデューサーさん、毎日お疲れさまです!"
msg1_2 = "先日、アイドル達がチョコ作りに挑戦したりして、"
msg1_3 = "事務所中に甘~い香りが広がっていました。"
msg1_4 = "試食のしすぎで体重計に乗るのが怖いかも。。。┠"

f1_1 = 20
f1_2 = GetEndFrame(f1_1, msg1_1)
f1_3 = GetEndFrame(f1_2, msg1_2)
f1_4 = GetEndFrame(f1_3, msg1_3)
f1_5 = GetEndFrame(f1_4, msg1_4)

last_f1 = f1_5 + 100


# ***** 2ページ目

msg2_1 = "さて、イベント盛りだくさんの2月ですが、"
msg2_2 = "千早ちゃんの誕生日、そしていよいよ新作"
msg2_3 = "『Live For You!』の発売が近づいてきましたね!"
msg2_4 = "ファン代表の皆さんにお会いできる日が楽しみです┫"

f2_1 = last_f1
f2_2 = GetEndFrame(f2_1, msg2_1)
f2_3 = GetEndFrame(f2_2, msg2_2)
f2_4 = GetEndFrame(f2_3, msg2_3)
f2_5 = GetEndFrame(f2_4, msg2_4)

last_f2 = f2_5 + 100


# ***** 小鳥さんトークフレーム
clip = ImageSource(ImageDir + "kotori_talk_2.png", end=last_f2, fps=29.97, pixel_type="RGB32")
bgm  = WavSource(BgmDir + "town.wav")

clip = clip.AudioDub(bgm)

# ***** 1ページ目

clip = clip.ApplyRange(f1_1, last_f1, "Talk", msg1_1, 10, GetPosY(1), f1_1, f1_2)
clip = clip.ApplyRange(f1_1, last_f1, "Talk", msg1_2, 10, GetPosY(2), f1_2, f1_3)
clip = clip.ApplyRange(f1_1, last_f1, "Talk", msg1_3, 10, GetPosY(3), f1_3, f1_4)
clip = clip.ApplyRange(f1_1, last_f1, "Talk", msg1_4, 10, GetPosY(4), f1_4, f1_5)

# ***** 2ページ目

clip = clip.ApplyRange(f2_1, last_f2, "Talk", msg2_1, 10, GetPosY(1), f2_1, f2_2)
clip = clip.ApplyRange(f2_1, last_f2, "Talk", msg2_2, 10, GetPosY(2), f2_2, f2_3)
clip = clip.ApplyRange(f2_1, last_f2, "Talk", msg2_3, 10, GetPosY(3), f2_3, f2_4)
clip = clip.ApplyRange(f2_1, last_f2, "Talk", msg2_4, 10, GetPosY(4), f2_4, f2_5)

clip = clip.FadeIO(10)

return clip


# ----- フレーム数計算
function GetEndFrame(int f, string msg)
{
    return Int(f + StrLen(msg) * 1.2)
}

# ----- Y座標計算
function GetPosY(int row)
{
    return Int((row - 1) * 20 + 295)
}

# ----- トーク
function Talk(clip clip, string msg, int x, int y, int sta_f, int end_f)
{
    len = StrLen(msg)
    return clip.Animate(sta_f, end_f, "PutText", msg,x,y,0, msg,x,y,len)
}

# ----- テキスト表示
function PutText(clip clip, string msg, int x, int y, int len)
{
    s = LeftStr(msg, len)

#    clip = (len < StrLen(msg)) ? clip.SubTitleEx(LeftStr(msg, len + 1), x, y, font="あずきフォントP", size=19, textcolor=$00999999, halocolor=$FF000000) : clip
    return clip.SubTitleEx(s, x, y, font="あずきフォントP", size=19, textcolor=$00555555, halocolor=$FF000000)
}

}}}