Jump to content

Odometer animation using Pixi.js


bruserker
 Share

Recommended Posts

Some days ago I've started developing an animated odometer written in HTML and javascript, which I intend to use on a rpg game that I am developing. Right now, I am facing a problem regarding the animation.

The description of the problem as well as the source code can be found here:

http://stackoverflow.com/questions/35615811/odometer-animation-using-pixi-js

Link to comment
Share on other sites

    var actualHP = document.getElementById('actualhp').value;
    var newHP =  document.getElementById('newhp').value;

    actualPP = document.getElementById('actualpp').value;
    newPP =  document.getElementById('newpp').value;

    var difHP = newHP - actualHP;
    var difPP = newPP - actualPP;
    var difHPPixel = difHP * 48;
    var difPPPixel = difPP * 48;

These values are the same every update. I dont understand what do you want to do with that, your problem is not connected to PIXI or animation, its pure algorithmic problem.

Link to comment
Share on other sites

I dont know, you just have to understand how to write a game loop , I studied it looong time ago in Turbo Pascal 5.0 :)

1) You have to mark which variables are actually current state of your counter.

2) Write a code that will update it based on DELTA TIME between current frame and previous. Use "Date.now()" to know about milliseconds.

3) Write a code that translates your state into PIXI components.

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.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...