Forum Discussion
GSAP timeline to speedup / slowdown any animations on it
What you did wrong is looping all the audios in the Storyline and changing their playback speed.
A for loop basically acts on all elements it finds. To fix that you need to only act on your embedded audio. How to do that ? Well several solutions...for one you can check the name of the audio...if that is the one you want changed....act.for (var i = 0; i < allAudios.length; i++) {
allAudios[i].playbackRate = 0.25;
}
Like this...it changes th playbackRate of all your audios...for (var i = 0; i < allAudios.length; i++) {
if(mp3Name !="MusicaDiversidad.mp3"){
allAudios[i].playbackRate = 0.25;
}
}
And like this it changes all audios except your background music.
To get this working we still need to know the names of our mp3s. Especially because Storyline generates a custom name for embedded audio.
Like this when checking for allAudios[i].url:.../story_content/external_files/MusicaDiversidad.mp3
.../story_content/5UxkXXG1RPh_44100_48_0.mp3
Also you notice the folder structure for embedded and external audio is different.
So splitting the url in an array and getting the last value of that array gives us the proper names.
Then this works.for (var i = 0; i < allAudios.length; i++) {
var mp3URL = allAudios[i].src;
var tmpArr = mp3URL.split("/");
mp3Name = tmpArr[tmpArr.length-1];
audioNamesArray.push(mp3Name);
console.log(mp3Name+" pushed into ["+audioNamesArray+"]");
if(mp3Name !="MusicaDiversidad.mp3"){
allAudios[i].playbackRate = 0.25;
}
}
Kind regards,
Math
Related Content
- 8 months ago
- 10 months ago