Class TweenGroup
Group of tweens that share common options.
Inherited Members
Namespace: Sttz.Tweener
Assembly: cs.temp.dll.dll
Syntax
public abstract class TweenGroup : TweenOptionsContainer
Remarks
A group can provide defaults for all tween options as well as the tween target and allows to control just that group of tweens.
All the events of the group will be cleared once it's being recycled, you normally don't have to unregister event handlers you register.
Every tween needs to be part of a group and every group needs to be registered with the engine. When using the methods on Animate, this is automatically taken care of.
Fields
_engine
Declaration
protected ITweenEngine _engine
Field Value
Type | Description |
---|---|
ITweenEngine |
_fixedUpdateTweens
Declaration
protected List<Tween> _fixedUpdateTweens
Field Value
Type | Description |
---|---|
List<Tween> |
_inUse
Declaration
protected bool _inUse
Field Value
Type | Description |
---|---|
System.Boolean |
_lateUpdateTweens
Declaration
protected List<Tween> _lateUpdateTweens
Field Value
Type | Description |
---|---|
List<Tween> |
_newTweens
Declaration
protected List<Tween> _newTweens
Field Value
Type | Description |
---|---|
List<Tween> |
_updateTweens
Declaration
protected List<Tween> _updateTweens
Field Value
Type | Description |
---|---|
List<Tween> |
Properties
DefaultTarget
Default target object of the group (can be overridden by tweens).
Declaration
public abstract object DefaultTarget { get; }
Property Value
Type | Description |
---|---|
System.Object |
DefaultTargetType
Type of the DefaultTarget.
Declaration
public abstract Type DefaultTargetType { get; }
Property Value
Type | Description |
---|---|
System.Type |
Remarks
This is the type of the generic parameter used when creating the group, not the actual type of the default target object.
Methods
AddInternal(Tween)
Declaration
protected void AddInternal(Tween tween)
Parameters
Type | Name | Description |
---|---|---|
Tween | tween |
AllTweens(Object, String, Action<Tween>)
Declaration
protected void AllTweens(object target, string property, Action<Tween> action)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | |
System.String | property | |
System.Action<Tween> | action |
Cancel(Object, String)
Cancel all tweens in the group (setting them to their start value), optionally limiting the tweens to a target object and property.
Declaration
public void Cancel(object target = null, string property = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | Only cancel tweens on the target object (set to null to stop all tweens on all objects). |
System.String | property | Only cancel tweens with the target property (set to null to stop all tweens on the target object). |
Finish(Object, String)
Finish all tweens in the group (setting them to their end value), optionally limiting the tweens to a target object and property.
Declaration
public void Finish(object target = null, string property = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | Only finish tweens on the target object (set to null to stop all tweens on all objects). |
System.String | property | Only finish tweens with the target property (set to null to stop all tweens on the target object). |
Has()
Check if the group contains any tweens (waiting or tweening).
Declaration
public bool Has()
Returns
Type | Description |
---|---|
System.Boolean |
Has(Object, String)
Check if the group contains specific tweens.
Declaration
public bool Has(object target, string property = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | Target object to look for. |
System.String | property | Target property to look for (set to null to look for any property on the target object). |
Returns
Type | Description |
---|---|
System.Boolean |
Regroup(Tween)
Declaration
protected void Regroup(Tween tween)
Parameters
Type | Name | Description |
---|---|---|
Tween | tween |
Reset()
Reset the group so that it can be used again.
Declaration
public virtual void Reset()
ReturnToPool()
Declaration
protected override void ReturnToPool()
Overrides
Stop(Object, String)
Stop all tweens in the group (leaving them at their current value), optionally limiting the tweens to a target object and property.
Declaration
public void Stop(object target = null, string property = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | Only stop tweens on the target object (set to null to stop all tweens on all objects). |
System.String | property | Only stop tweens with the target property (set to null to stop all tweens on the target object). |
Validate(Boolean)
Trigger the validation of all the tweens in the group and optionally force them to be rendered.
Declaration
public bool Validate(bool forceRender = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | forceRender | Forces all tweens in the group to render (set its target property to the initial value) after they have been validated. |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Usually tweens are validated during initialization in the frame after they were created. You can call this method to validate all tweens in the group right after creating them. This will make the stack trace of validation errors more useful as it will point to where the group was validated instead of to the where it was initialized.
Tweens will first render (set their target property) when
they are started, which is usually during the next frame after they
were created or after their start delay. Especially when doing a From
or FromTo tween, you might want the initial value to be set
immediately to avoid visual glitches. Validate the tween and
set the forceRender
parameter to true in this case.
WaitForEndOfGroup()
Create a coroutine that will wait until all tweens in the group have completed (the group becomes empty).
Declaration
public Coroutine WaitForEndOfGroup()
Returns
Type | Description |
---|---|
Coroutine | A coroutine you can yield in one of your own to wait until all tweens in the group have completed. |
Remarks
Adding new tweens to the group, while not all of its tweens have completed, will prolong the time until the coroutine returns.
WaitForEndOfGroupCoroutine()
Declaration
protected IEnumerator WaitForEndOfGroupCoroutine()
Returns
Type | Description |
---|---|
IEnumerator |