Arduino math using millis() not working?

Hello all, I have been having some issues with some code of mine.

I have a function which requires the millis() function in order to calculate the elapsed time since a beginning time in milliseconds, but i have been having some issues. In the code, I try to calculate the elapsed time by subtracting the start time from millis(), but the function outputs this (the red line is the vlaues outputted):

with the inputs:
transitionIn(20, 0, 2500, 1000, star)

I have tried everything and yet I still cannot get this function to work! can someone please help me?

Here is the broken function:

point movePoint (int16_t x, int16_t y, uint32_t be, uint16_t len, point p1, point p2) {
  p1.offset(x, y);
  p2.offset(x, y);
  
  if (millis() < be) {
    return p1;
  } else if (millis() > be + len) {
    return p2;
  }
  
  uint32_t elp = millis() - be;                       // problematic line
  
  float per = float(elp) / float(len);
  
  //float adj = (sin(PI * (per - 0.5)) / 2.0) + 0.5;      uncomment to calculate curve

  float adj = lerp(
    curve[clip(per * 20, 19)],
    curve[clip(per * 20 + 1, 19)],
    float(per * 20.0) - float(floor(per * 20.0))
    );

  //Serial.println(String(per * 100) + '\t' + String(adj * 100));

  Serial.println(String(len) + '\t' + String(elp));

  //Serial.println(String(adj * 100));
  
  return lerp(p1, p2, adj);
}

Almost impossible to digest your snippet. Too many references to items outside the posted block of code. If the problem is with uint32_t elp = millis() - be; at least let us see how be is derived before being passed into the function.

The variable "be" is the start time of an animation. The function basically gets inputted a vector shape and animates the object on an OLED display. The graph in the first post is caused when "be = 5000"

epicface2304:
calculate the elapsed time since a beginning time in milliseconds

I try to calculate the elapsed time by subtracting the start time from millis()

uint32_t elp = millis() - be;// problematic line

So where is begining time, and/or start time stored?

First though was you were using be for one of those times, but then your code says..

if (millis() < be)

Which is unlikely you expect current millis to be less than a previous mills...

I've fixed the issue by switching to a percent-based system. Thank you for helping me out!