Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7979257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:43:48+00:00 2026-06-04T09:43:48+00:00

array moves contains just a couple of move I wanna draw on canvas. basically

  • 0

array moves contains just a couple of move I wanna draw on canvas. basically a deltaTime to sleep and a draw command.

This simply doesn’t work 🙁

for (var i=0; i< parsed.moves.length; i++)
{
    var e = parsed.moves[i];
    setTimeout(function(){drawCmd(context,e)}, e.deltaTime*1000);

    //deltaTime are values btn 0-1, the sleep time i need to set btw commands 

 }  


function drawCmd(canvasctx, e)
{   

switch(e.type)
{
   //case ...
}
 }

it did nothing at all, not even calling drawCmd function

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:43:50+00:00Added an answer on June 4, 2026 at 9:43 am

    You code only delays all the drawCmd by e.deltaTime*1000 and executes them all at once afterwards, all at i = 10

    If you meant to “draw and wait, draw and wait”, try this:

    (function loop(i){
        var e = parsed.moves[i];      //e at current "i"
    
        if(i< parsed.moves.length){   //if not equal to length
            setTimeout(function(){
                drawCmd(context,e);   //draw in e.deltaTime*1000 milliseconds
                loop(++i);            //loop again
            }, e.deltaTime*1000);
        }
    
    }(0));                            //start with i=0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to move even numbers in an array to the front and
After doing some experimentation with move semantics with an array type I created, I
I am creating an array from several text boxes. I am needing to move
I have a function below that is supposed to check if the array contains
I have an array that contains the points for drawing multiple hills. When I
I'm doing this project for university, which is basically a movie database and for
I have this app of mine that contains a section that will allow the
I have a numpy array which contains no data values. I mask those no
I have a file called layout.php which contains <?php $arrLayout = array( section1 =>
Use QUICKSORT, sort the integer array contains even number in ascending order and uneven

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.