How to create a custom countdown / timer with Storyline and some JavaScript.

custom countdown

⏰ Want to create a custom countdown / timer / Date timer with Storyline (📢 and activate any trigger at the end)?

😃 That’s good, because that’s what I suggest you do with a little JavaScript code.

🎨 What’s great is that you can integrate it directly into your slides and that it is fully customizable to respect your most beautiful graphic charters ^^

💬 Tell me what you thought of it and if you want (still ^^) other little codes like this in the comments!

👍 Don’t hesitate to “like” if you liked it and 🔗 share the video if it can be useful to someone.

🤗 Thank you and very good day to all

BELOW IS THE CODE YOU CAN COPY/PASTE:

 

Source: https://community.articulate.com/discussions/building-better-courses/how-to-create-a-countdown-tutorial

Important Note: This code comes from web research and the source above. You are responsible for its use and it is therefore important that you have it validated by a professional if you have the slightest doubt and/or if you are using it in a particular environment.

function zeros(i) {
    if (i < 10) {
        i = "0" + i;
    }
    return i;
}

var fin="Done";
var player = GetPlayer();
var count = player.GetVar("Timer_Duree");
var minutes, seconds, timer, totalTime;
var counter = setInterval(timer, 1000);

function timer() {
    count = count - 1;
    minutes = zeros(Math.floor(count / 60));
    seconds = zeros(count % 60);
    if (count == 0){
        player.SetVar("Timer_Fin",fin);
}
    if (count < 0) {
        clearInterval(counter);
        return;
    }
    totalTime = minutes + ':' + seconds;
    player.SetVar("Timer_Affichage",totalTime);
}
Top online courses in Teaching & Academics

Related Posts

Leave a Reply