
Julien Jorge wrote:
Hello,
I would like to propose the Boost.Tweener library for preliminary submission.
The purpose of the Boost.Tweener library is to provide solutions to interpolate the intermediate values between two given values during a time interval. Various easing functions can be applied to control the computation of the intermediate values. I felt the need of such a library while developing games but I have also seen this need in various animation softwares.
The library provides the following functionalities: - Interpolation is done on the value of a given variable or using an user-provided callback function, - The interpolated values are computed using a predefined easing function or any user-provided function respecting the contract, - Several tweeners can easily be executed simultaneously or in a row, - The type of the interpolated values are user defined.
Please follow this link to download a Zip of the library: http://sourceforge.net/projects/libclaw/files/boost/boost-tweener-rc1.tar.gz...
Can you check that the library works as expected or tell me what should be fixed before submitting for review? There are various example programs in the archive.
I would prefer Boost.Tween to Boost.Tweener. How do you do looping tweens? (Both N and infinite loops) How do you do relative tweens, i.e. instead of tween from -> to, tween by. I guess this might not matter as it seems the tweener only tweens its own internal value. In many cases it would seem nice to update a memory location directly. For instance a member variable of the class that owns the tween. domain_type feels awkard. It's used as both a time_point and duration to borrow boost::chrono terminology. Why does base_tweener have a virtual destructor, virtual do_clone and virtual do_is_finished members? It seems you could easily just use CRTP here. I think tweener_sequence/tweener_group should be a container adapter or at least switched to use a std::vector. I know I wouldn't want to pay for a std::list here in any use case I can imagine. FWIW if you're using a std::list (like in tweener_group.ipp) instead of: const iterator_type tmp(it); ++it; m_tweeners.erase(tmp); you can do: it = m_tweeners.erase(it); I think the order of tween updates for sequences/groups can be important. There should be a guarantee of first-in first-update order and I think the name insert should change to push_back to reflect the ordered nature of the operation. It seems all tweeners are one shot in that you cannot restart them. tween_sequence and tweener_groups do_update is destructive and prevents being able to restart the group. Why are all the callbacks boost::functions? It's already a template can't I just use my own callback type without paying for the type erasure and dispatch of a boost::function if I don't need it? There appears to be no interface to set the current time_point (m_date) directly you can only move it a relative amount. There is also no interface to query it. This is a very useful feature, it allows you for instance to bind your tween to a slider and scrub back and forth through it. Supporting multiple callbacks for on_finished seems unnecessarily expensive an inconsistent (only one update callback supported). init/end seems like a strange name pairing. Maybe from/to, begin/end, initial/final? Although using end here at all seems a bit dubious as it is so often used in the as a semi-open interval [begin,end) whereas here it is a closed interval [init,end]. I personally think a method chaining interface ala HOTween's TweenParms is very nice for configuring tweeners. As someone who has used TweenLite, iTween, HOTween, and AniMate as well as rolled his own (poorly) I'm very happy to have such a library proposed to Boost. Thank you. http://www.greensock.com/tweenlite/ http://www.holoville.com/hotween/ http://itween.pixelplacement.com http://wiki.unity3d.com/index.php?title=AniMate