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

423

Likes

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

Adobe Community Professional , 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

Likes

Translate

Translate
Adobe Community Professional ,
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

Likes

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.

Likes

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

Copy link to clipboard

Copied

LATEST
You're welcome!

Likes

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