Share Posted December 13, 2013 Using SoundManager2 library, my sound has already been created. I want to call the play function once my timeline reaches the correct point. Any ideas how I can do this? Thanks in advance. tl.set("#mod5", {visibility:"visible"}, "#mod5") // call soundManager --> soundManager.play('mod5') .staggerFrom("#e5", 0.5, {autoAlpha:0, x:180}) .to("#e6", 0.5, {delay:1}); Link to comment Share on other sites More sharing options...
Share Posted December 13, 2013 Hi Nick and welcome to the Greensock forums. You can use the call() method, which calls for a specific function at a given time, like this: tl.set("#mod5", {visibility:"visible"}, "#mod5") .call(playSound) .staggerFrom("#e5", 0.5, {autoAlpha:0, x:180}) .to("#e6", 0.5, {delay:1}); function playSound() { soundManager.play('mod5'); } Rodrigo. 3 Link to comment Share on other sites More sharing options...
Author Share Posted December 13, 2013 Thanks a bunch for the reply and the warm welcome. Very excited to be using GSAP! 1 Link to comment Share on other sites More sharing options...
Share Posted December 15, 2013 Also, if you're just calling a single function at that time, you could use call like this without having to create an extra playSound function: .call(soundManager.play, ['mod5'], soundManager); // essentially says - call play('mod5') on the soundManager object You need to add soundManager as the 3rd parameter (scope) since soundManager.play doesn't maintain that scope automatically. Javascript can be weird 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now