Skip to content

Repository files navigation

Starry's Tween API

Tired of writing out the boilerplate-heavy CCEaseInOut/CCSequence/CCCallFunc every time you want to animate something? Here's your solution!

Features

  • 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!

Usage example

#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.

Methods

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.

About

An API mod to facilitate animations for geode devs.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages