Categories
Animation Haxe Open source / Freeware

Tween engine Go – part 2

My last post was about my new WIP tween library Go.

I have been updating my little experiment and it’s getting better.
Looking into other libraries codes is very educational.

Does it perform as good as the default Haxe tween engine Actuate?
Yeah that would have been great, but nope… around 1300 object, Go will start dropping frame-rate in Flash.

My goal was to create a lightweight, simple, compact, chainable tween library for haxe/openfl.

Could I perform as good as Actuate?
I am not sure, Actuate is very well written and Joshua Granick has been working on it for a long time and tested it extensively.
But I probably could improve on my code and get a better performance in Flash (in which I did the stress-test). The downside is that my code will be full of condition compilation and that would mean the code would become more and more complex.

Why am I sure it will improve, well I cheated and did some flash specific code modifications.
Check the code in github
In my first draft it was just:

var range = _props.get(n);
Reflect.setProperty(_target, n, _easing.ease( time, range.from, (range.to-range.from), _duration ) );

and that performed very bad in Flash (if I remember correctly the framerate already dropped after 100 object)
And I updated it to this and that works better… for Flash

var range = _props.get(n);
#if flash
untyped _target[n] = _easing.ease( time, range.from, (range.to-range.from), _duration ) ;
#else
Reflect.setProperty(_target, n, _easing.ease( time, range.from, (range.to-range.from), _duration ) );
#end

So the question is more do I want to change the code for specific platforms?
For now I am not going to focus on Flash to enhance it’s performance… there is little chance that I will be animating 1000+ objects.

So I will be using it in my own projects and will run into problems that I will fix.
You are welcome to use it as well and report bugs or other improvements.

I’ve update the promotional website: check it here.
You can find the stress-test there, where I compare Go with Actuate.
If you want to add your tweening library, add it here in github.
Download/install instructions can be found here.

Happy tweening.

Categories
Animation Haxe Open source / Freeware

Tween engine Go

I have been playing a lot with Haxe and Openfl in the past, but never for work. That changed this week!

Fun stuff!

A while back I noticed some new tweening engines for Haxe. That got me curious: can I build my own tweening engine?

Yes I can!

I named it Go, like “lets Go”.

(And like they say in a track from The Prodigy – Everybody In The Place, lets go )

You can check it out on github: https://github.com/MatthijsKamstra/go
There you can find more detailed explanation about how it works, so I only will show some basic code here:

Animate a sprite in 1.5 second to x and y position and call function when animation is done

Go.to(sprite, 1.5).x(100).y(200).onComplete(onCompleteHandler, ['hello']);

It was fun to write it, but I haven’t tested in all situations.
I have tested lets.Go on targets flash/cpp/html5/neko.
But I wouldn’t use it in a production situation. It needs more testing.

Let me know what you think!