• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Timer

New Here ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

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

145

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

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

 

add this to the function that runs your clock.

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.

 

Votes

Translate

Translate

Report

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