Hi guys, I'm trying to get some easing working. Currently I'm using this which doesn't

Hi guys,

I’m trying to get some easing working. Currently I’m using this which doesn’t give me any easing:

pos = map(k, 0, ledRange, startPos, endPos);

How might I add some easing to k using ease8InOutCubic()?

Hummm. Seems like it needs a map run through the ease function and then mapped back to position. Here’s the test I was messing with:

Or I might have completely missed a much easier solution! The easing doesn’t really show up a small travel distance. If I set NUM_LEDS to 8 I can’t see the easing. With 32 pixels I could see some easing happening, but that’s the longest test string I have setup at this moment.

Cheers Marc. In the end I’ve used something to this effect which seems to work:

//////// start variables
int startPos = 0;
int endPos = 60;
int led_range = endPos - startPos;
int tweenDuration = 100;

//////// function
if(k>tweenDuration){
k = 0;
endPos = random(0, 500);
startPos = pos;
}

int eased = easeOutQuint(k, 0, led_range, tweenDuration);

pos = map(eased, 0, tweenDuration, startPos, endPos);

k++;
//////// function

////ease function
// current time, start value, change in value, duration
float easeOutQuint(float t, float b, float c, float d) {
t /= d;
t–;
return c*(ttttt + 1) + b;
};

https://vine.co/v/eHLv1MW0b9l

Hey that looks like it’s working well. Nice job.