I’ve made some significant changes to the animation library in Lemur. I would like to work with you on integrating the changes I’ve made and would appreciate you describing what the process would be like and the time expectation for getting these changes into the library even if not in a stamped release version. Let me know if you have any package structures, styling conventions, implementation changes you’d like to see.
Here is an example of it running live:
Here is a dropbox containing the changes so far: Dropbox - File Deleted
Although you’ve probably seen them before here is a site that has many easing functions so that we are on the same page: http://easings.net/
I think the only untouched file was Animation.java but most existing files didn’t change much. The highlights of my changes are opening up what used to be the Curves class to a more canonically (in terms of animation jargon) Easing class. You had initial easing functions like sine in out and hermite in easing. I’ve added many of the ones you see on that page and with the way the code is changed many more of them can be added. Most went in without a problem. Here are the easing functions that were added:
PowerEasings (In/Out/InOut) can do any t^power
ExponentialEasings (In/Out/InOut) can do any base^t
SineEasings (In/Out/InOut) Added in and out versions of the inOut that was already there
ElasticEasings (Out) can be customized for how elastic you want the effect to be
Many presets easing functions are in the EasingFunctions class and the 2 you started with are still there. Feel free to let me know changes to the defaults you’d like to make. Users can now easily create their own easing functions to achieve any effect as the EasingFunction class is public.
On the easing website I linked you can see certain easing effects can go beyond 0 to 1 to achieve an interesting result like elasticity. I only implemented one of them for now as a proof of concept in ElasticOutEasing. That required being able to interpolate with 2 variables: time (to determine when to stop like it was already doing) and modulatedTime (which is the result of the easing function allowing the value to go outside of the 0 to 1 time bounds). You can reference these changes in Tween, AbstractTween, SpatialTweens and the like.
Here is how I’m using from the users perspective:
Tween scale = SpatialTweens.scale(this, null, pickupScale, .5);
Tween easing = Tweens.ease(EasingFunctions.SINE_IN_OUT, scale); // New function for default and custom easings
Tween scale = SpatialTweens.scale(this, null, normalScale, .5);
Tween easing = Tweens.ease(new ElasticOutEasing(.5), scale); // Custom easings
Tween rotate = SpatialTweens.rotate(this, null, rotation, Widget.rotationDuration);
Tween easing = Tweens.ease(EasingFunctions.ELASTIC_OUT, rotate);