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

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

ACTIONSCRIPT:
  1. import caurina.transitions.Tweener;
  2. import caurina.transitions.properties.SoundShortcuts;
  3.  
  4. SoundShortcuts.init();
  5.  
  6. var bgm:Sound = new soundBgm();
  7. var channel:SoundChannel = bgm.play(0);
  8.  
  9. Tweener.addTween(channel, {_sound_volume:0, time:1, transition:"linear"});

コメント / トラックバック 2 件

  1. Adrien より:

    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 より:

    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!

コメントをどうぞ