2008.06.24
category
comments

Tweenerで音量をトゥイーンさせる

自分用のメモ。サウンドの音量をトゥイーンさせるには、SoundShortcutsクラスをインポートしてinit()で初期化してから使う。Tweenerの対象オブジェクトはSoundChannel型の変数にする。音量を変化させたいときは_sound_volumeプロパティ、音量をパンさせたい時は_sound_panプロパティをそれぞれ弄くる。

ACTIONSCRIPT:
import caurina.transitions.Tweener;
import caurina.transitions.properties.SoundShortcuts;

SoundShortcuts.init();

var bgm:Sound = new soundBgm();
var channel:SoundChannel = bgm.play(0);

Tweener.addTween(channel, {_sound_volume:0, time:1, transition:"linear"});

2 Comments

  1. Adrien Says

    Hello Simo,
    Just to share with you my sound fade method with TweenLite :

    import org.gs.TweenLite;

    var bgm:Sound = new soundBgm();
    var channel:SoundChannel = bgm.play(0);
    channel.volume = 0;
    TweenLite.to(channel, 2, {volume:1});

    TweenLite explain/download -> http://blog.greensock.com/tweenliteas3/

    See you next’
    PS: Have you tested rightToRight and leftToLeft SoundTransform properties? Really interesting for pan FX.

  2. simo Says

    Hello Adrien!
    Thank you for sharing TweenLite. I have never used TweenLite, but the usage is almost the same. It is happy to make the sound done in tween!

Post a comment




Comment

Trackbacks

この記事のコメント・トラックバックRSS