Deceleration in AnimationFactory

I wanted smooth deceleration on rotations using the AnimationFactory class. Unfortunately the interpolate function is private, rather than protected, so I had to duplicate the whole class for my project. So may I suggest either:


  1. Make the interpolate(…) function protected rather than private so developers can extend it neatly.


  2. Introduce deceleration for everyone, although this may not suit some users:



    AnimationFactory:438

    Change

    [java]rotations[j] = rot.slerp(((Rotation) keyFrames).rotation, ((Rotation) keyFrames[key]).rotation, val);[/java]

    to

    [java]rotations[j] = rot.slerp(((Rotation) keyFrames).rotation, ((Rotation) keyFrames[key]).rotation, 1-FastMath.pow(1-val,2));[/java]

I was planing to add some “ease in/ease out” type of interpolation and allow the user to set up everything.

Maybe you could go this way?

That would be fantastic, Nehon. I’m very much a newbie to this kind of thing, so I’m sure you’d implement it better than me :wink:

lol, flattery will get you nowhere with me :stuck_out_tongue:

thats what she said

3 Likes
@wezrule said:
thats what she said

ROFL

Hey, I’ve got some time coming up, I’ll implement the easing in / out change. Just checking you haven’t already done it, @nehon ?

2 Likes

I didn’t. Go ahead :wink: