Show / Hide Table of Contents

Class Tween

Individual tween.

Inheritance
System.Object
TweenOptionsContainer
Tween
Tween<TTarget, TValue>
Inherited Members
TweenOptionsContainer.Options
TweenOptionsContainer.RetainCount
TweenOptionsContainer._retainCount
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Sttz.Tweener
Assembly: cs.temp.dll.dll
Syntax
public abstract class Tween : TweenOptionsContainer
Remarks

There are several ways to create tweens. Use the methods on Animate to create single tweens that use the global default options. Use On<TTarget>(TTarget, TweenTemplate) or Group(TweenTemplate) to create a group and then add tweens to the group using the methods on TweenGroup. This allows to set options on the group, which will then apply to all tweens in that group.

You can also create tweens using the static methods on Tween. Note that those tweens are not automatically registered with Animate, you'll have to add them to a group using Add(Tween). This allows to set individual tween options for tweens in a group.

All the events of the tween will be cleared once it's being recycled, you normally don't have to unregister event handlers you register.

Fields

_completedBy

Declaration
protected TweenCompletedBy _completedBy
Field Value
Type Description
TweenCompletedBy

_creationTime

Declaration
protected float _creationTime
Field Value
Type Description
System.Single

_creationTimeReal

Declaration
protected float _creationTimeReal
Field Value
Type Description
System.Single

_creationTimeUnscaled

Declaration
protected float _creationTimeUnscaled
Field Value
Type Description
System.Single

_engine

Declaration
protected ITweenEngine _engine
Field Value
Type Description
ITweenEngine

_error

Declaration
protected string _error
Field Value
Type Description
System.String

_oneOverDuration

Declaration
protected float _oneOverDuration
Field Value
Type Description
System.Single

_options

Declaration
protected string _options
Field Value
Type Description
System.String

_property

Declaration
protected string _property
Field Value
Type Description
System.String

_startTime

Declaration
protected float _startTime
Field Value
Type Description
System.Single

_state

Declaration
protected TweenState _state
Field Value
Type Description
TweenState

_targetIsUnityObject

Declaration
protected bool _targetIsUnityObject
Field Value
Type Description
System.Boolean

_targetIsUnityRef

Declaration
protected bool _targetIsUnityRef
Field Value
Type Description
System.Boolean

_targetUnityObject

Declaration
protected UnityEngine.Object _targetUnityObject
Field Value
Type Description
UnityEngine.Object

_targetUnityReference

Declaration
protected UnityEngine.TrackedReference _targetUnityReference
Field Value
Type Description
UnityEngine.TrackedReference

_timing

Declaration
protected TweenTiming _timing
Field Value
Type Description
TweenTiming

_triggerUpdate

Declaration
protected bool _triggerUpdate
Field Value
Type Description
System.Boolean

_tweenMethod

Declaration
protected TweenMethod _tweenMethod
Field Value
Type Description
TweenMethod

_validated

Declaration
protected bool _validated
Field Value
Type Description
System.Boolean

_valuesPrepared

Declaration
protected bool _valuesPrepared
Field Value
Type Description
System.Boolean

Properties

ArithmeticPlugin

The arithmetic plugin being used.

Declaration
public abstract ITweenPlugin ArithmeticPlugin { get; }
Property Value
Type Description
ITweenPlugin

CompletedBy

Explains how the tween was completed.

Declaration
public TweenCompletedBy CompletedBy { get; }
Property Value
Type Description
TweenCompletedBy
Remarks

This field is set as soon as the tween's state becomes Complete and CompleteEvent fires.

See Also
CompletedBy

CreationTime

The time the tween was created (in the tween's time).

Declaration
public float CreationTime { get; }
Property Value
Type Description
System.Single
See Also
TweenTiming

DurationUnscaled

Duration of the tween, in unscaled time.

Declaration
public float DurationUnscaled { get; }
Property Value
Type Description
System.Single
See Also
Duration

Error

When an error occurred (State is set to Error), this property contains an error description.

Declaration
public string Error { get; }
Property Value
Type Description
System.String

GetterPlugin

The getter plugin being used.

Declaration
public abstract ITweenPlugin GetterPlugin { get; }
Property Value
Type Description
ITweenPlugin

Property

Name of the target property on the target object.

Declaration
public string Property { get; }
Property Value
Type Description
System.String

PropertyOptions

Parse the options in the property name in the format ":options:propertyName".

Declaration
public string PropertyOptions { get; }
Property Value
Type Description
System.String

SetterPlugin

The setter plugin being used.

Declaration
public abstract ITweenPlugin SetterPlugin { get; }
Property Value
Type Description
ITweenPlugin

StartTime

The time the tween will be or was started (in the tween's time).

Declaration
public float StartTime { get; }
Property Value
Type Description
System.Single
See Also
TweenTiming

StartTimeUnscaled

Time the tween will be or was started, in unscaled time.

Declaration
public float StartTimeUnscaled { get; }
Property Value
Type Description
System.Single

State

Current state of the tween.

Declaration
public TweenState State { get; }
Property Value
Type Description
TweenState

Target

Target object the tweened property is located on.

Declaration
public abstract object Target { get; set; }
Property Value
Type Description
System.Object
Exceptions
Type Condition
System.InvalidCastException

Thrown when the object's type does not match the tween's target type.

TargetType

Type of the target the value is tweened on.

Declaration
public abstract Type TargetType { get; }
Property Value
Type Description
System.Type

TweenEngine

The tween engine used for this tween.

Declaration
public ITweenEngine TweenEngine { get; set; }
Property Value
Type Description
ITweenEngine

TweenMethod

Method of the tween (To, From, FromTo or By).

Declaration
public TweenMethod TweenMethod { get; }
Property Value
Type Description
TweenMethod

TweenTime

Now in the tween's time.

Declaration
public float TweenTime { get; }
Property Value
Type Description
System.Single
See Also
TweenTiming

ValueType

Type of tweened value of the tween.

Declaration
public abstract Type ValueType { get; }
Property Value
Type Description
System.Type
Remarks

A tween's type has to match the type of the target property. Make sure the value you supply when creating a tween has the same type as the property that's being tweened.

Methods

ApplyValue(Single)

Declaration
protected abstract void ApplyValue(float position)
Parameters
Type Name Description
System.Single position

Cancel()

Cancel the tween (set the property to its start value).

Declaration
public void Cancel()

Complete(TweenCompletedBy, Boolean)

Declaration
protected void Complete(TweenCompletedBy completedBy, bool fromOverwrite = false)
Parameters
Type Name Description
TweenCompletedBy completedBy
System.Boolean fromOverwrite

DoOverwrite()

Declaration
protected void DoOverwrite()

Fail(TweenLogLevel, String, Object[])

Declaration
protected void Fail(TweenLogLevel level, string message, params object[] args)
Parameters
Type Name Description
TweenLogLevel level
System.String message
System.Object[] args

Fail(String, Object[])

Declaration
protected void Fail(string message, params object[] args)
Parameters
Type Name Description
System.String message
System.Object[] args

Finish()

Finish the tween (set the property to its end value).

Declaration
public void Finish()

GetPluginOverride(Boolean, Boolean)

Declaration
protected int GetPluginOverride(bool installedWeak, bool overwriterWeak)
Parameters
Type Name Description
System.Boolean installedWeak
System.Boolean overwriterWeak
Returns
Type Description
System.Int32

Initialize()

Declaration
protected void Initialize()

LoadPlugins()

Load the tween's plugins.

Declaration
protected abstract bool LoadPlugins()
Returns
Type Description
System.Boolean
Remarks

This calls LoadDynamicPlugins<TTarget, TValue>(Tween<TTarget, TValue>) and Sttz.Tweener.TweenOptions.LoadPlugins(Sttz.Tweener.Tween) to load the default plugins. Manual plugins should be loaded using a extension method on Tween.

Overlaps(Tween)

Check if two tween's durations overlap (without start delay).

Declaration
public bool Overlaps(Tween other)
Parameters
Type Name Description
Tween other

Tween to check against this tween

Returns
Type Description
System.Boolean

Wether the tween's durations overlap

PrepareValues()

Declaration
protected abstract void PrepareValues()

Reset()

Reset the tween so that it can be used again.

Declaration
public virtual void Reset()

ReturnToPool()

Declaration
protected override void ReturnToPool()
Overrides
TweenOptionsContainer.ReturnToPool()

Start()

Declaration
protected void Start()

Stop()

Stop the tween (leave the property at its current value).

Declaration
public void Stop()

Validate(Boolean)

Trigger the validation of the tween and optionally force it to be rendered.

Declaration
public bool Validate(bool forceRender = false)
Parameters
Type Name Description
System.Boolean forceRender

Forces the tween to render (set its target property to the initial value) after it has 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 the tween right after creating it. This will make the stack trace of validation errors more useful as it will point to where the tween was created 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.

WaitForEndOfTween()

Create a coroutine that will wait until the tween has completed.

Declaration
public Coroutine WaitForEndOfTween()
Returns
Type Description
Coroutine

A coroutine you can yield in one of your own to wait until the tween has completed.

See Also
WaitForTweenDuration<TContainer>(TContainer)

WaitFOrEndOfTWeenCoroutine()

Declaration
protected IEnumerator WaitFOrEndOfTWeenCoroutine()
Returns
Type Description
IEnumerator
Back to top © 2018 Adrian Stutz