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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:14:17+00:00 2026-06-15T21:14:17+00:00

This is a question that bugs me for quite a long time. Say, I

  • 0

This is a question that bugs me for quite a long time. Say, I need to introduce a ragdoll character animation to the page. Obviously, each body part of such a character is an image, and the number of these images can get quite large depending on the character complexity and the number of characters. If these characters were static (in fact, DOM animation is still possible, but is potentially a lot slower), I could use CSS background sprites, but when it comes down to using canvas, it seems like you have to resort to loading all the images one-by-one, which will probably have an impact on the page loading time.

Additionally, I’d like to use some framework that allows persistent objects to be created on canvas, like paper.js or fabric.js, and handles the redraw cycle.

While I recognize this as a trivial (yet time-consuming) task to write a parser that would read an XML/JSON description of a character and create the objects based on the coordinates, I wonder if there are any such tools already created and used, that I might not know of.

What I’d like to use is a structure like this:

character : {
  image : 'characters.png',
  body : {
    head : {
      width : 40,
      height : 50,
      xOff : 50,
      yOff : 125
    }
    // Other parts follow
  }
}

Are there any frameworks or game engines that would allow creation of objects from such a structure? What is the best way for loading multiple images into a canvas?

Thanks for any advice.

UPD. Added some detail.

  • 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-15T21:14:18+00:00Added an answer on June 15, 2026 at 9:14 pm

    There is an overloaded version of drawImage for this:

    drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight)
    // where image: valid image
    //          sx: source slice x position
    //          sy: source slice y position
    //          sWidth:  source slice width
    //          sHeight: source slice height
    //       same for dx etc.
    

    So you could simply use the same approach as in CSS backgrounds sprites.

    References:

    • MDN: Canvas tutorial: Slicing
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question bugs me. How event handling systems works? what i understand is that
Hello yeah I'm asking this question a second time, sorry about that but I
This is something that really bugs me, but first the code, then the question:
a simple question that bugs me. Say I have an array defined in main
This may be a stupid question, but it's something that bugs me on a
Found this question that explained a way to communicate between layers. However there is
I have seen this question that talks about getting the last part of a
I found this question that is discussing what I would like to do, but
I found this question that was very useful in learning the basics of the
I have a UIView subclass ( CustomView for purposes of this question) that has

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.