Jump to content

Canvas ACT viewer


outofcuriosity

Recommended Posts


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   2
  • Joined:  12/11/11
  • Last Seen:  

This is of course by no means as interesting as what KeyWorld is doing with HTML5 canvas, but I thought I'd share it anyway. :D

I've made a little demo to view SPR and ACT pair in the web browser. It's mostly a result of me wanting to learn a little Javascript and try to work with canvas. At the moment it looks something like this:

test.png

You can view the current progress online here: http://www.curio.byethost10.com/spritecanvas.php (don't know how reliable to host is, unfortunately I don't have a my own web space these days)

What you should see is an animated Baphomet idling a bit and walking around on the map.

This is a very rough demo, and at the moment I believe it might crash if the SPR and ACT files don't load quickly enough (I don't think I handle the asynchronous execution properly yet). So if it doesn't start, wait till the page is fully loaded and refresh! The demo should run fine Firefox, Opera and Chrome. No idea about Internet Explorer.

If I get around to it I'll try to expand it into an online character viewer or try to incorporate it into an online monster database.

Todo:

- Sprite frame scaling

- Sprite frame rotation

- ACT attachments (to view composite ACT frames; characters sprites with head, items, mounts etc.)

- Composite ACT animations

- Sub sprite RGB colour levels (only alpha is set at the moment!)

- RGBA sub frame transparency (don't know how this is calculated yet as you have neither alpha values nor an indexed background colour)

- Increase efficiency. Currently the SPR frame, and in turn ACT frame, is processed for every iteration, which is obviously a waste

- Animation delay (currently static at 80ms)

- Resolve issues with old SPR and ACT versions

You may, of course, download the scripts and play around with them. They're very messy though, be warned!

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  146
  • Topics Per Day:  0.03
  • Content Count:  1195
  • Reputation:   467
  • Joined:  11/15/11
  • Last Seen:  

Cannot wait for this to finish, especially frame rotation :D Will be super useful!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Good job :D

Just two things:

- It seems that you use a hack to clean the canvas

canvas.width = canvas.width;

. But it cause problem on some browser (tested on webkit): it's the same value, so it doesn't clean the context, use :

<canvas2D>.clearRect(0,0,<width>,<height>);

- To improve perf, you should use canvas2D method (rotate, scale, globalAlpha, drawImage, ...) instead of manipulating all pixels for each frames.

Keep it up :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   2
  • Joined:  12/11/11
  • Last Seen:  

Thanks, I'll definitely look into that! Built-in rotation and scaling will make this a whole lot simpler.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...