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

Animate html5 canvas - how to pause frame for 10 seconds and then automatically continue animation

Community Beginner ,
Oct 06, 2019 Oct 06, 2019

I can't seem to figure out how to pause the animation for 10 seconds at a given frame and after 10 seconds the animation continues. I can get it to stop using:

 

this.stop();

 

but how do I add a time of 10 seconds to start again?

 

Thanks.

1.9K
Translate
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

correct answers 1 Correct answer

Community Expert , Oct 06, 2019 Oct 06, 2019

Hi.

 

Use the setTimeout method.

 

Like this:

var target = this; // the target Movie Clip instance you want to pause

target.stop();

window.setTimeout(function()
{
    target.play();
}, 1000 * 10); // time in milliseconds. Each second is equal to 1000 milliseconds

 

 

Regards,

JC

Translate
Community Expert ,
Oct 06, 2019 Oct 06, 2019

Hi.

 

Use the setTimeout method.

 

Like this:

var target = this; // the target Movie Clip instance you want to pause

target.stop();

window.setTimeout(function()
{
    target.play();
}, 1000 * 10); // time in milliseconds. Each second is equal to 1000 milliseconds

 

 

Regards,

JC

Translate
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 Beginner ,
Oct 06, 2019 Oct 06, 2019

Perfect. Thank you.

Translate
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 ,
Oct 07, 2019 Oct 07, 2019
LATEST
You're welcome!
Translate
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