Ramp.h

I would like to use the ramp function within a ‘loop’, the intent being to update the ‘target’ and/or ‘duration’ parameters at a later stage.
My knowledge of C+ is very limited, consequently I would be very appreciative of some guidance to get this to function?
Many thanks.

#include <Ramp.h>

int x;                        
unsigned long time_now = 0;   
unsigned long time_start = 0;   
bool target_reached = false;    
int target = 100;              
int duration = 1000;           
rampInt myRamp;

void setup() {
  Serial.begin(9600);
}

void loop() {
  time_start = millis();
  myRamp.go(target, duration);  //Start ramping up to target through our defined duration
  
  x = myRamp.update();           // Get the current position
      
  Serial.println(x);
  if (x == target) {             // if target is reached print out duration and set target_reached flag to true
    time_now = millis();
    Serial.println("Target reached");
    Serial.println(x);
    Serial.print(time_now - time_start);
    Serial.print(" milli seconds");
    target_reached = true;   // Target has now been reached, stop printing out to Serial
    }
}

Arduino map()

Thanks, that looks useful in the future. I would like to solve the problem of using the 'ramp' function though so I can use the 'duration' to set the time of the ramp transition?
Any ideas?