hermite curve / camera move

Hi

I have a sketch to control a camera move with linear acceleration and deceleration. I would like to include a algorithm to calculate a smooth ease in and out like a hermite curve (see picture).

the aim is that you only have to define the total numbers of steps, frames and ease-in/out to for all different moves.

Has anyone experience with hermite curves? here is an example: http://stackoverflow.com/questions/3367308/math-ease-in-ease-out-a-displacement-using-hermite-curve-with-time-constraint

sketch I’m using

#include <DragonStopMotion.h>
#include <Stepper.h>
/*
 * DragonInputs example. Demonstrates DragonStopMotion library.
 * In this specific example, pins 2 and 3 were wired as pushbuttons (active low).
 * Pins 5,6 and 7 were wired to LEDs.
 */
#define STEPS 30
 
byte inbyte = 0;
Stepper myStepper(STEPS, 8, 9, 12, 13);    
int count = 0;

// Create global object to communicate with Dragon Stop Motion
DragonStopMotion dsm = DragonStopMotion();

/*
 * Arduino calls this function once, at the start of your program.
 */
void setup()
{
  // set up serial port to 57600 kbps
  Serial.begin(57600);
  myStepper.setSpeed(30);
  /*
   * Other commands are:
   *   DRAGON_PLAY_CMD - toggles playback
   *   DRAGON_LIVE_CMD - goes to live (also re-engages live view)
   */
  
  
  /*
   * Configure output pins. This is optional, if you want to control
   * another device (or just turn on an LED).
   *
   * The choice of output pins below was purely optional, but it corresponds
   * to how they are used in the loop() function in response to DSM messages.
   */
  pinMode(13, OUTPUT); // SHOOT SIGNAL
  digitalWrite(13, LOW);
}

/**
 * Arduino calls this function repeatedly as the main program loop.
 */
void loop()
{ 
  // read serial messages from DSM
  int cmd = dsm.processSerial();
  
  /**
   * The following examples take messages from DSM
   * and turn a digital I/O pin high for 0.5 seconds.
   * You can take any action (or no action).
   */
  if (cmd == DRAGON_CC_MSG) 
  {
    if (dsm.commandFrame <=49) 
    {myStepper.step(dsm.commandFrame/3*4+4);
  }
    // Ramping up - integer math helps here
    if ((dsm.commandFrame >= 50) && (dsm.commandFrame <=200)) {myStepper.step(68);} // Constant speed
    if ((dsm.commandFrame >= 200) && (dsm.commandFrame <=250)) {myStepper.step((68) - ((dsm.commandFrame - 200)/3*4 + 4));}
  }
   if (cmd == DRAGON_DELETE_MSG) 
  {
    if (dsm.commandFrame <=49) 
    {myStepper.step(-(dsm.commandFrame/3*4+4));
  }
    // Ramping up - integer math helps here
    if ((dsm.commandFrame >= 50) && (dsm.commandFrame <=200)) {myStepper.step(-68);} // Constant speed
    if ((dsm.commandFrame >= 200) && (dsm.commandFrame <=250)) {myStepper.step(-((68) - ((dsm.commandFrame - 200)/3*4 + 4)));}
  }
}

Is anyone familiar with the ‘smoothstep’ function?

///////////////////////////////////////
// Smoothstep Interpolation Example  //
///////////////////////////////////////

// Dan Thompson 2009
//
// Inpired by the code and chat on this site.
// http://sol.gfxile.net/interpolation/index.html
//
// Use this code at your own risk.
//
// This sketch was written with motion controlled timelapse photography
// in mind. I have tried to make it generic enough to understand the smoothstep
// concept so that one might adapt this powerful formula in other areas as well.
//
// For the full tutorial visit http://danthompsonsblog.blogspot.com/
//
// Usage:
// 1. Upload the sketch to the Arduino.
// 2. Click on the Serial monitor to see some visual feed back of the SMOOTHSTEP function.
// 3. Scroll throught the print out to see the SMOOTHSTEP curve.
// 4. Play with the code and addapt it to your needs! ;)

#define SMOOTHSTEP(x) ((x) * (x) * (3 - 2 * (x))) //SMOOTHSTEP expression.

int j = 0;             //Just an Iterator.
int i = 0;             //Just another Iterator.
float A = 0.0;         //Input Min Value
float B = 100.0;       //Input Max Value
float X;               //final smoothstepped value
float v;               //smoothstep expression variable
float N = 100.0;       //number of steps

void setup() {
Serial.begin(9600);  //establish serial connection for debugging
}

void loop()
{
if (j < N)                      // Keep looping until we hit the pre-defined max number of steps
  {
v = j / N;                    // Iteration divided by the number of steps.
    v = SMOOTHSTEP(v);            // Run the smoothstep expression on v.
    X = (B * v) + (A * (1 - v));  // Run the linear interpolation expression using the current smoothstep result.
    for ( i=0; i < X ; i++)       // This loop could the relevant code for each time your motor steps. 
    {
Serial.print("1");          //Prints the number "1" for each step.           
    }
Serial.print("  ");           //Puts a space between each line of steps and their corresponding  float value
    Serial.println(X);            // prints the soothstepped value
    Serial.println("CLICK!!!");   // this could be where you trigger your timelapse shutter 
    j++;                          // Increments j by 1.
  }
}

what are the inputs in the case shown in the post above?
A = frames to ease in
B = frames to ease out
N = number of frames
x, i, j = ?

The inputs are A and B, which are the value to start from and the value to end up at, N, which is the number of steps, and j, which is the current step. The formula will output A when j=0 and B when j=N, and other values in between. x and i are temporary variables that are irrelevant to the formula. And it's doing quadratic easing, so there are no other variables to tune for "steepness" or anything like that.