Sign in to follow this  
bruserker

Odometer animation using Pixi.js

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.