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

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

Community Beginner ,
Oct 06, 2019 Oct 06, 2019

Copy link to clipboard

Copied

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.

Views

1.6K

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

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

Votes

Translate

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

Perfect. Thank you.

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
Community Expert ,
Oct 07, 2019 Oct 07, 2019

Copy link to clipboard

Copied

LATEST
You're welcome!

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