• Timer

# Timer

New Here ,
Mar 01, 2021 Mar 01, 2021

Copied

I am a beginner and want to know if anyone knows how to create a start stop function timer.  I have created an analog clock and would now like the clock to start and stop at 5 minute intervals with the ability to create different start and stop commands for 10 mintues, 15 mintues, 30 mintues, 45 mintues and 60 mintues.

Views

80

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
3 Replies 3
Mar 01, 2021 Mar 01, 2021

Copied

Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Mar 01, 2021 Mar 01, 2021

Copied

I am a beginner and want to know if anyone knows how to create a start stop function timer.  I have created an analog clock and would now like the clock to start and stop at 5 minute intervals with the ability to create different start and stop commands for 10 mintues, 15 mintues, 30 mintues, 45 mintues and 60 mintues.  I am using Adobe Animate or Adobe Photoshop.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
LEGEND ,
Mar 01, 2021 Mar 01, 2021

Copied

LATEST

In order to do that you will need to set a variable for your timer and then use a conditional to stop your clock.

For example:

I suppose you are using an interval to move your hands.

var interval = setInterval(runtheTimer, 1000);   // every second the second hand moves)

(runTheTimer is the name of the function you use to run your clock)

So after 45 seconds you will clear the interval

var timeCounted = 0;  // initialize the variable outside of the function

everySec += 1000;

if(everySec == 45000){
clearInterval(interval)
}

You could also generalize this by making anoter function an passing an argument that will be the amount of seconds you want you clock to stop.

``````var everySec = 0;

function stopTheClock(howLong) {
everySec += 1000;
if (everySec == howLong) {
clearInterval(interval)
}
}``````

them in your runtheClock function you can add the function with the time you want

// for 30 seconds

stopTheClock(30000);

// for 45 seconds

stopTheClock(45000);

etc...

Hope this helps depending on how you run your clock.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources
Learn
Latest Features