Class TweenSystem
A lightweight tweening system for component data.
Inheritance
Namespace: Unity.Tiny.Tweens
Syntax
public class TweenSystem : ComponentSystem
Remarks
Tweening makes it possible to easily change single values inside components over time without using a full animation system.
Methods
AddTween<T>(Entity, TypeManager.FieldInfo, T, T, Single, TweenFunc, LoopMode, Boolean, Single)
Creates an Entity to tween a value over time.
Declaration
public Entity AddTween<T>(Entity target, TypeManager.FieldInfo info, T startValue, T endValue, float duration, TweenFunc func = TweenFunc.Smoothstep, LoopMode loop = LoopMode.Once, bool destroyWhenDone = true, float timeOffset = 0F)
Parameters
Type | Name | Description |
---|---|---|
Entity | target | Entity where the component to be tweened is attached. |
TypeManager.FieldInfo | info | |
T | startValue | Starting point for the tween. |
T | endValue | Ending point for the tween. |
System.Single | duration | Time in seconds. |
TweenFunc | func | Tween function to use. |
LoopMode | loop | True to repeat the tween. |
System.Boolean | destroyWhenDone | True to cleanup after the tween. |
System.Single | timeOffset | Set to start from a non-zero time. |
Returns
Type | Description |
---|---|
Entity |
Type Parameters
Name | Description |
---|---|
T | Type of the variable to tween. |
OnUpdate()
Declaration
protected override void OnUpdate()
RemoveAllEndedTweens()
Helper function that removes all tween entities that have stopped playing. You can use it to clean up after a level or transition sequence.
Declaration
public void RemoveAllEndedTweens()
RemoveAllTweens(Entity)
Helper function that removes all tween entities that reference target entity.
Declaration
public void RemoveAllTweens(Entity e)
Parameters
Type | Name | Description |
---|---|---|
Entity | e |
RemoveAllTweensInWorld()
Helper function that removes all tween entities in the world. You can use it to clean up after a level.
Declaration
public void RemoveAllTweensInWorld()