Jump to content

Formula to Calculate Exponential Curves?


Heretic86
 Share

Recommended Posts

Im messing around in HTML5 Canvas which uses Javascript to draw to the Canvas.  The Canvas is being used to display an RPG Character attribute over the number of levels.  Making a Linear Slope (straight line) is easy.  (NOTE: same post on a couple places I dont visit regularly, varied responses are VERY helpful...)

Im curious what the formula is to calculate the value for each level that implements an Exponential Curve?

 

The following image is from the Editor that I am trying to emulate.  This is a Non Exponential Curve, which I already have working.

XPflat.png

 

These are the Exponential Curves that I want to emulate, and I dont know the value of the Slider when its set to either "Fast" or "Slow", and "Middle" is a Non Exponential Curve (so guessing a value of 0 there.

XPfast.png

XPslow.png

What would I need to do to generate a curve that looks like this, where we input the Level 1 and Level 99 values?  Experimented with something like this but its not coming out anywhere like I need it to...

let exp_list = [null];
let pow = parseInt(slider.value);
for (let i = 1; i < 99; i++){
  exp_list[i] = 500 * (n ** pow) + 1; // ???? ab^x
}

Not quite sure what this formula is to plug in here.  Halp?

Link to comment
Share on other sites

This ones going in Javascript, so exponents there are ** operators, others are ^ operators...  Im just having trouble figuring out how to implement a*  (b ** x) + c so I dont really have anything close to working since i cant figure out where to plug in the variables into the data!

 

I understand that there should be a way to do something like a Level Curve as i, where i ** exp = 9999, but not sure where to plug in those figures into the equation?

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...