mrbuchmas Posted March 1, 2024 Posted March 1, 2024 I'm wanting to use GSAP with Pixi Sound to fade audio in and out. The docs say that the plugin works with the main Pixi code base, does that include Pixi Sound? If not, is there another way to still use GSAP with Pixi Sound?
GreenSock Posted March 1, 2024 Posted March 1, 2024 GSAP can animate literally any property of any object that JavaScript can touch. So you should certainly be able to use GSAP to animate anything in PIXI. I'm not very familiar with Pixi, sorry, but just find the property that you need to animate for the volume/sound, and create a tween that targets that. Give it a try and if you get stuck, pop back here with a minimal demo that illustrates the problem and we'll do our best to help with any GSAP-specific questions.
Solution Rodrigo Posted March 1, 2024 Solution Posted March 1, 2024 Hi, Based on a quick look here: https://pixijs.io/sound/examples/ https://pixijs.io/sound/docs/Sound.html#volume You could do something like this: const sound = PIXI.sound.Sound.from('resources/boing.mp3'); sound.volume = 0; sound.play(); gsap.to(sound, { volume: 1 }); I'm not sure if the PIXI Plugin would work with sounds, since it was created to be used with PIXI display objects, but you could try and see how it goes, if it doesn't work you can try the code I proposed above. Hopefully this helps. Happy Tweening! 1
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