/    Sign up×
Community /Pin to ProfileBookmark

How calculate change in position for easing without knowing distance to travel?

In all the easing functions (based on Robert Penner), I see that they require the distance to travel to be known beforehand. But what if I didn’t know that? How would I calculate the change to position based on easing my speed to zero if I know my current speed?

In other words, I know my start position, my current speed and the duration. I want to figure out the change in position (for each step and total change).

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Jun 24.2011 — I reckon that total change is 0.5*u*T where u is the speed and T is the total time and that the step is u*t*[1-t/(2*T)] where t is the step time, but I'm not sure.
Copy linkTweet thisAlerts:
@RibeyedJun 24.2011 — Hi,

intersting question ?. Just be for I answer I am in no way an expert in this but I hope this is what your looking for.

Had a look at the easing fuctions and it depends on what type of easing you want.

Types of easing: Linear, Quadratic, Cubic, Quartic, Quintic, Sinusoidal, Exponential

Circular, Elastic, Back, Bounce

some examples of declerating to zero velocity:

// t: current time, b: beginning value, c: change in value, d: duration

// t and d can be in frames or seconds/milliseconds

<i>
</i>// quadratic easing out - decelerating to zero velocity
Math.easeOutQuad = function (t, b, c, d) {
return -c *(t/=d)*(t-2) + b;

// cubic easing out - decelerating to zero velocity
Math.easeOutCubic = function (t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;


// quartic easing out - decelerating to zero velocity
Math.easeOutQuart = function (t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
};




Source of examples: http://www.robertpenner.com/easing/. Followed the ActionScript 1.0 equations, downloaded the zip, opened up the actionscript file in notepad and found the about equations.
×

Success!

Help @6tr6tr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...