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 3805084
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:37:16+00:00 2026-05-19T14:37:16+00:00

I have a flash animation I am trying to convert to HTML5. Now I

  • 0

I have a flash animation I am trying to convert to HTML5. Now I have taken out all the images. For example in the hand animation, I have taken images of all hand images. I have made the canvas with the base drawing but I don’t know how to replace those images frame by frame.

function draw(){
    var canvas = document.getElementById('canvas');
    if(canvas.getContext){
        // canvas animation code here:
        var ctx = canvas.getContext('2d');

        var lhs = new Image();

        lhs.src = "images/left_hnd_1.png";

        lhs.onload = function(){
            ctx.drawImage(lhs, 293, 137);
        }

    } else {
        // canvas unsupported code here:
        document.getElementById('girl').style.display = "block";
    }
}

Now I have three more frame for this image. left_hnd_2.png, left_hnd_3.png & left_hnd_4.png. I would’ve used one image but the difference in frames is way too much for it to be done with one image. How can I animate this with the time differences I want.

Any ideas would be greatly appreciated. Thanks!

  • 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-05-19T14:37:16+00:00Added an answer on May 19, 2026 at 2:37 pm

    Try this:

    var imgNumber = 1;
    var lastImgNumber = 4;
    
    var ctx = canvas.getContext('2d');
    var img = new Image;
    img.onload = function(){
      ctx.clearRect( 0, 0, ctx.canvas.width, ctx.canvas.height );
      ctx.drawImage( img, 0, 0 );
    };
    var timer = setInterval( function(){
      if (imgNumber>lastImgNumber){
        clearInterval( timer );
      }else{
        img.src = "images/left_hnd_"+( imgNumber++ )+".png";
      }
    }, 1000/15 ); //Draw at 15 frames per second
    

    An alternative, if you only have 4 images, would be to create a single huge image with all four in a ‘texture atlas’, and then use setTimeout or setInterval to call drawImage() with different parameters to draw different subsets of the image to the canvas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have flash animation (swf) in my HTML Page. Now, I like to have
I have flash animation on my web site, in all other browsers except IE
I have a flash animation with the size of 1280x1024 and I want to
Is something like this possible: I have a flash animation of a glowing orb.
I have a page with a Flash animation being used for the logo. When
How would it be possible to have a HTML page play a flash animation
i have a very simple animation in flash CS4. My image travels from point
Let me preface by saying I have no Flash/AS knowledge really at all. My
Is it possible to have flash animation work uninterrupted on my site (in some
i have an flash based animation.but since iphone doesnt support flash.which format can i

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.