GSAP timeline to speedup / slowdown any animations on it

Jan 30, 2022

As i mentioned before in some posts GSAP has a timeline that controls all animation. And probably Storyline uses that timeline for its animation too. As i didnot find a way to control Storyline's timeline i made a sample showing how perfectly and easily GSAP's timelines control the speed of animations.

https://360.articulate.com/review/content/bc85877a-e885-42c1-b216-bb771ca0e007/review

Im gonna add some more elements to it soon to test whether audio and video speed are controllable this way too.

~Math

34 Replies
Math Notermans

I know... the things i upload mostly exist of 1 page setups...so no resume anywhere.
For a real course i have a setup where i have these on MasterSlides with variables checking if its loaded. If so... it skips it. I seldom use resume in the samples showing here. Users that download and reuse my tips and tricks indeed need to be aware of that indeed.

Jürgen Schoenemeyer

I have read your email and your question was

BTW I have another question, but it is for another function, do you know how a user can change the size of the closing caption by running a Java, I found some solution, but this one only works for one time.

I used:

Big size

if (!window.alteredCaptions) {
var sheet = document.createElement('style');
sheet.innerHTML = ".caption{font-size:180% !important;}";
document.body.appendChild(sheet);
window.alteredCaptions = true;
}

Small size

if (!window.alteredCaptions) {
var sheet = document.createElement('style');
sheet.innerHTML = ".caption{font-size:140% !important;}";
document.body.appendChild(sheet);
window.alteredCaptions = true;
}

Any advice for this?

this could be interesting for others

here is an example, to switch the CC size in the course

https://360.articulate.com/review/content/64b7f0b8-1cdc-4918-80bf-12eaf86edd11/review

prepare script -> on timeline starts - on every page* which uses CC (because of resume course)

if( !window.alteredCaptions ){
  style = document.createElement('style');
  
  style.textContent = `
    .CC-small .caption {
      font-size: 140% !important;
    }

    .CC-big .caption {
      font-size: 180% !important;
    }
  `
  document.body.appendChild(style);
  window.alteredCaptions = true;
}

the button script (for 180%)

 // reset
document.body.classList.remove('CC-small', 'CC-big');

// set
document.body.classList.add('CC-big');

the button script (for 140%)

 // reset
document.body.classList.remove('CC-small', 'CC-big');

// set
document.body.classList.add('CC-small');

the button script for reset size

 // reset
document.body.classList.remove('CC-small', 'CC-big');

to set "CC on"

if you wan't to store the state of the CC size - use a variable

* or once in story.html/index_lms.html or at the end of user.js

Mayra Alheli Rios

Hi Jurguen,

I been having problems with my background music, when I speed down my audio, also the music slowdown, can you help me to identify what I'm doing wrong.

One more question, is there any way to add in the code that respects the speed of audio en video playback from one slide to another, because every time I advance to the next slide the user would have to click on speed +/-, right now it just works with audio, but if I have both this doesn't work :(

Please!!!!

Jürgen Schoenemeyer

first problem - the button script in the slidemaster

wrong:

var allAudios = document.getElementsByTagName("audio");
for (var i = 0; i < allAudios.length; i++) {
  allAudios[i].playbackRate = 0.70;
}
...

correct:

var allAudios = document.getElementsByTagName("audio");
for (var i = 0; i < allAudios.length; i++) {
   var mp3URL = allAudios[i].src;
   var tmpArr = mp3URL.split("/");
   mp3Name = tmpArr[tmpArr.length-1];
  if(mp3Name != "FondoSusten.mp3"){
      allAudios[i].playbackRate = 0.70;
   }
}
...

second problem: audio is working correct after slider change - your script is correct

BUT: you have to update the navigation button also (on timeline start on every slide)