Highlighted

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

Community Beginner ,
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.

Adobe Community Professional
Correct answer by JoãoCésar | Adobe Community Professional

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

Views

144

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

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

Community Beginner ,
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.

Adobe Community Professional
Correct answer by JoãoCésar | Adobe Community Professional

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

Views

145

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

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

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
Reply
Loading...
Oct 06, 2019 0
Community Beginner ,
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
Reply
Loading...
Oct 06, 2019 1
Adobe Community Professional ,
Oct 07, 2019

Copy link to clipboard

Copied

You're welcome!
__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

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
Reply
Loading...
Oct 07, 2019 0