Tired of writing out the boilerplate-heavy CCEaseInOut/CCSequence/CCCallFunc every time you want to animate something? Here's your solution!
- Easy-to-understand syntax: you can setup an animation in a single function invocation.
- Extensive easing support: supports all the major cocos2d timing functions (Linear, Ease, Bounce, Sine, Elastic, etc.)
- Supports many types: supports float, position, size, rect, and color.
- Almost zero boilerplate: less time debugging and more time writing your mod!
#include <starrydawn72.tween_api/include/tween_api/Tween.hpp>
auto myTween = starry::tween_api::Tween::create(
this, // Target node to attach the action to
0.0f, // From (float, position, size, rect, or color)
1.0f, // To (same as from)
5.0f, // Duration
EasingType::EaseInOut, // Timing function
[](float value) {
// onUpdate code...
},
[]() {
// onComplete code (optional)...
},
2.0f // Optional rate parameter for EaseIn/EaseOut/EaseInOut
);
myTween.start();
// Later:
myTween.stop();Supports method chaining: each setter returns the tween, so you can do things like myTween.setStartDelay(0.5f).start();
Note: this API is required dependancy, not optional.
start():
stop():
pause():
resume():
setStartDelay(float delaySeconds)
restart():
setRepeatCount(int repeatCount)
repeatForever()
stopRepeating()
enableYoyo()
disableYoyo()
getCycleProgress()
getTotalProgress()
isRunning()
getDuration()
A description of each function is available through intellisense or the source code on github.