Home

Awesome

GoKitLite

GoKitLite is a crazy fast tweening library for Unity. It is optimized for mobile with near zero allocations at runtime. GoKitLite can tween position, localPosition, scale, rotation, localRotation, material color and any properties (float, Vector2, Vector3 or Color). It will tween "to" a value or "from" one to the current value. GoKitLite can also call your own custom Action so that you can tween anything that you want that isn't supported or isnt a property.

GoKitLite usage is dead simple. Below are some examples:

// tween the position of an object to 10, 10, 10 over 1 second
GoKitLite.instance.positionTo( someTransform, 1s, new Vector3( 10, 10, 10 ) );

// tween the rotation of an object to 0, 90, 0 over 0.5 seconds with a custom ease type
GoKitLite.instance.rotationTo( someTransform, 0.5f, new Vector3( 0, 90f, 0 ) )
	.setEaseFunction( GoKitLiteEasing.Back.EaseOut );

// tween the color of a material to red over 1 second with a 3 second delay before starting
GoKitLite.instance.colorTo( someTransform, 1, Color.red, 3 );

Up above we mentioned that you can use a custom Action to handle a tween as well. Here is an example:

// tween the position of an object to 10, 10, 10 over 1 second
GoKitLite.instance.customAction( someTransform, 1s, ( trans, t ) => {
    // do something really cool here like tweening a string or changing multiple objects/properties at once
});

GoKitLite also has a tween chaining system to setup a series of tweens that will all run one after the other. Here is an example alternating position and rotation tweens with a completion handler that will fire when the entire chain is complete:

GoKitLite.instance.positionTo( cube, 0.4f, new Vector3( -8, -3, 0 ) )
	.setEaseFunction( GoKitLiteEasing.Quadratic.EaseInOut )
	.next( GoKitLite.TweenType.Rotation, 0.4f, new Vector3( 90f, 0, 0 ) )
	.next( GoKitLite.TweenType.Position, 0.4f, new Vector3( 1, 2, -5 ) )
	.next( GoKitLite.TweenType.Rotation, 0.4f, new Vector3( 0, 90, 90 ) )
	.next( GoKitLite.TweenType.Position, 0.4f, new Vector3( 0, 0, 0 ) )
	.next( GoKitLite.TweenType.Rotation, 0.4f, new Vector3( 360, 360, 0 ) )
	.setCompletionHandler( trans => { Debug.Log( "Position and Rotation Queue Done" ); } );

Building on the tween chaining system there is also a tween flow system. TweenFlows let you setup a timeline of tweens each with a specific start time. Unlike TweenQueues, tweens in a TweenFlow can be running simultaneously. Here is an example of a position tween that has 4 rotation tweens applied while it is still in transit to it's final position. Note that the start method must be called as a coroutine:

var flow = new GoKitLite.TweenFlow().add( 0, () => { return GoKitLite.instance.positionTo( cube, 5f, new Vector3( 10, 10, 10 ) ); } )
	.add( 1f, () => { return GoKitLite.instance.rotationTo( cube, 0.5f, new Vector3( 90, 0, 0 ) ); } )
	.add( 2f, () => { return GoKitLite.instance.rotationTo( cube, 0.5f, new Vector3( 0, 90, 0 ) ); } )
	.add( 3f, () => { return GoKitLite.instance.rotationTo( cube, 0.5f, new Vector3( 0, 0, 90 ) ); } )
	.add( 4f, () => { return GoKitLite.instance.rotationTo( cube, 0.5f, new Vector3( 180, 180, 180 ) ); } )
	.setCompletionHandler( () => { Debug.Log( "All done with the position/rotation flow" ); } );
StartCoroutine( flow.start() );

GoKitActions

GoKitActions is an optional class that contains additional actions that can be used with GoKitLite's customAction() method:

GoKitLite.instance.customAction( cube, 2, GoKitLiteActions.ShakePosition( cube, 0.6f ), 0, GoKitLiteEasing.Linear.EaseNone );

What about GoKit?

GoKit has a slightly different focus than GoKitLite. It is highly customizeable and can tween anything at all. GoKit has all kinds of nifty features like chains, flows and full tween control in real time that arent ever going to be in GoKitLite. GoKitLite is made for folks who want a really easy API and just want to tween stuff now without much thought.

License

Attribution-NonCommercial-ShareAlike 3.0 Unported with simple explanation with the attribution clause waived. You are free to use GoKitLite in any and all games that you make. You cannot sell GoKitLite directly or as part of a larger game asset.