ロゴ メインコンテンツへ
RSSフィード
「デジタルコンテンツ制作」に関連する記事一覧

MEL 指数関数的に上昇するアニメーションを自動生成する

2016/06/11 20:28
(この記事の文字数: 111)
MEL 

大したものではないですが、細切れにした大量のオブジェクトを指数関数的に上昇させるアニメーションを作るために、指数関数の Y 座標アニメーションのエクスプレッションを生成する MEL スクリプトを作りましたので載せておきます。


global proc CreateExpresionForRiseAnimation(
    string $targets[],
    float $exponential_start_x,
    float $speed, float $speed_rand_range,
    float $time_offset, float $time_offset_rand_range)
{
    string $expName = "RiseAnim";
    string $exp = "float $start_frame="+$exponential_start_x+";\n";
    for ($target in $targets)
    {
        float $actual_speed = $speed + rand(-$speed_rand_range / 2.0, $speed_rand_range / 2.0);
        float $actual_time_offset = $time_offset + rand(0.0, $time_offset_rand_range);
        $exp += "{\n    float $speed = "+$actual_speed+";\n    float $frame_delay = "+$actual_time_offset+";\n    float $frame = frame + $start_frame - $frame_delay;\n    if ($frame < $start_frame)\n    {\n        $frame = $start_frame;\n    }\n    "+$target+".translateY = exp($frame * $speed) - exp($start_frame * $speed);\n}";
    }
    expression -s $exp -n $expName;
}

使用例


string $targets[]=`ls -sl -type transform`;
CreateExpresionForRiseAnimation(
    $targets,
    -30.0,
    1.0 / 30.0, 1.0 / 30.0,
    0.0, 60.0);


  このエントリーをはてなブックマークに追加  

<<「デジタルコンテンツ制作」の記事一覧に戻る

<<「デジタルコンテンツ制作」の次の記事

コメント(0 件)



コンテンツロード: 0.0081 sec
Copyright(C)2006-2024 puarts All Rights Reserved