Class Animate
Animate Tweening Engine.
Inheritance
Inherited Members
Namespace: Sttz.Tweener
Assembly: cs.temp.dll.dll
Syntax
public static class Animate
Remarks
version 3.0.0
Animate is a high-performance generic tweening engine written in C# and optimized to use in the Unity game engine.
Fields
DefaultEngineFactory
Default tween engine factory method.
Declaration
public static readonly Func<ITweenEngine> DefaultEngineFactory
Field Value
Type | Description |
---|---|
System.Func<ITweenEngine> |
Version
Animate version string.
Declaration
public const string Version = "3.0.0"
Field Value
Type | Description |
---|---|
System.String |
VersionNumber
Animate version number.
Declaration
public const int VersionNumber = 3010
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
Engine
The tween engine used.
Declaration
public static ITweenEngine Engine { get; }
Property Value
Type | Description |
---|---|
ITweenEngine |
EngineFactory
The factory method used to create the tween engine.
Declaration
public static Func<ITweenEngine> EngineFactory { get; set; }
Property Value
Type | Description |
---|---|
System.Func<ITweenEngine> |
Remarks
Set this property with your custom factory to use a custom engine.
Options
Shorthand for Options.
Declaration
public static TweenOptions Options { get; }
Property Value
Type | Description |
---|---|
TweenOptions |
Methods
By<TTarget, TValue>(TTarget, Single, String, TValue)
Create a new By tween without a group.
Declaration
public static Tween<TTarget, TValue> By<TTarget, TValue>(TTarget target, float duration, string property, TValue byValue)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
TTarget | target | The tween's target object which contains the property to tween. |
System.Single | duration | The duration of the tween in seconds. |
System.String | property | The name of the property to tween on the target. |
TValue | byValue | The target value you want to tween the property by, starting from its current value. The type of this value has to exactly match the property's type. |
Returns
Type | Description |
---|---|
Tween<TTarget, TValue> |
Type Parameters
Name | Description |
---|---|
TTarget | |
TValue | The value type of the tween. Has to match the target property type's value exactly. |
See Also
Cancel(Object, String)
Cancel all tweens on a target with an optional property. Cancelling a tween will leave set it to its initial value.
Declaration
public static void Cancel(object target, string property = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | The target to cancel the tweens on. |
System.String | property | Optional property name. If null, all tweens on target are cancelled. |
See Also
EnableAccess<TTarget, TValue>(String, TweenStaticAccessorPlugin.GetAccessor<TTarget, TValue>, TweenStaticAccessorPlugin.SetAccessor<TTarget, TValue>)
Teach the static accessor plugin to access a property on a type.
Declaration
public static void EnableAccess<TTarget, TValue>(string propertyName, TweenStaticAccessorPlugin.GetAccessor<TTarget, TValue> getter, TweenStaticAccessorPlugin.SetAccessor<TTarget, TValue> setter)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | |
TweenStaticAccessorPlugin.GetAccessor<TTarget, TValue> | getter | |
TweenStaticAccessorPlugin.SetAccessor<TTarget, TValue> | setter |
Type Parameters
Name | Description |
---|---|
TTarget | |
TValue |
Remarks
Use this to extend Animate's ability to access properties on types without using reflection, by providing two callbacks that get and set the property on the type.
EnableArithmetic<TValue>(TweenStaticArithmeticPlugin.DiffValue<TValue>, TweenStaticArithmeticPlugin.EndValue<TValue>, TweenStaticArithmeticPlugin.ValueAtPosition<TValue>)
Teach the static arithmetic plugin to calculate with a given type.
Declaration
public static void EnableArithmetic<TValue>(TweenStaticArithmeticPlugin.DiffValue<TValue> diff, TweenStaticArithmeticPlugin.EndValue<TValue> end, TweenStaticArithmeticPlugin.ValueAtPosition<TValue> valueAt)
Parameters
Type | Name | Description |
---|---|---|
TweenStaticArithmeticPlugin.DiffValue<TValue> | diff | |
TweenStaticArithmeticPlugin.EndValue<TValue> | end | |
TweenStaticArithmeticPlugin.ValueAtPosition<TValue> | valueAt |
Type Parameters
Name | Description |
---|---|
TValue |
Remarks
Use this to extend Animate's ability to calculate with types, by providing three callbacks that do the necessary calculations with a given type.
Finish(Object, String)
Finish all tweens on a target with an optional property. Finishing a tween will leave set it to its end value.
Declaration
public static void Finish(object target, string property = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | The target to finish the tweens on. |
System.String | property | Optional property name. If null, all tweens on target are finished. |
See Also
From<TTarget, TValue>(TTarget, Single, String, TValue)
Create a new From tween without a group.
Declaration
public static Tween<TTarget, TValue> From<TTarget, TValue>(TTarget target, float duration, string property, TValue fromValue)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
TTarget | target | The tween's target object which contains the property to tween. |
System.Single | duration | The duration of the tween in seconds. |
System.String | property | The name of the property to tween on the target. |
TValue | fromValue | The target value you want to tween the property from, to its current value. The type of this value has to exactly match the property's type. |
Returns
Type | Description |
---|---|
Tween<TTarget, TValue> |
Type Parameters
Name | Description |
---|---|
TTarget | |
TValue | The value type of the tween. Has to match the target property type's value exactly. |
See Also
FromTo<TTarget, TValue>(TTarget, Single, String, TValue, TValue)
Create a new FromTo tween without a group.
Declaration
public static Tween<TTarget, TValue> FromTo<TTarget, TValue>(TTarget target, float duration, string property, TValue fromValue, TValue toValue)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
TTarget | target | The tween's target object which contains the property to tween. |
System.Single | duration | The duration of the tween in seconds. |
System.String | property | The name of the property to tween on the target. |
TValue | fromValue | The value you want to tween the property from. The type of this value has to exactly match the property's type. |
TValue | toValue | The value you want to tween the property to. The type of this value has to exactly match the property's type. |
Returns
Type | Description |
---|---|
Tween<TTarget, TValue> |
Type Parameters
Name | Description |
---|---|
TTarget | |
TValue | The value type of the tween. Has to match the target property type's value exactly. |
See Also
Group(TweenTemplate)
Create a new tween group without a default target.
Declaration
public static TweenGroup<object> Group(TweenTemplate template = null)
Parameters
Type | Name | Description |
---|---|---|
TweenTemplate | template | Optional template providing options for this group. |
Returns
Type | Description |
---|---|
TweenGroup<System.Object> |
Remarks
You'll have to specify a target for each individual tween added to this group.
Groups returned by this method are not recycled so you can reuse the group even after all of its tweens have completed.
See Also
Has(Object, String)
Check if there are any existing tweens on the given target with the optional property.
Declaration
public static bool Has(object target, string property = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | Target object the tweens run on. |
System.String | property | Optional property name. When null, |
Returns
Type | Description |
---|---|
System.Boolean |
|
On<TTarget>(TTarget, TweenTemplate)
Create a new tween group with a default target.
Declaration
public static TweenGroup<TTarget> On<TTarget>(TTarget target, TweenTemplate template = null)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
TTarget | target | Default target used for all tweens created on the group. |
TweenTemplate | template | Optional template providing options for this group. |
Returns
Type | Description |
---|---|
TweenGroup<TTarget> |
Type Parameters
Name | Description |
---|---|
TTarget |
Stop(Object, String)
Stop all tweens on a target with an optional property. Stopping a tween will leave it at its intermediate value.
Declaration
public static void Stop(object target, string property = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | The target to stop the tweens on. |
System.String | property | Optional property name. If null, all tweens on target are stopped. |
See Also
Template()
Create a new options template.
Declaration
public static TweenTemplate Template()
Returns
Type | Description |
---|---|
TweenTemplate |
Remarks
You can specify a template when creating a group. The template's options will override the global defaults but options you set on the group or on individual tweens will still override the template's.
To<TTarget, TValue>(TTarget, Single, String, TValue)
Create a new To tween without a group.
Declaration
public static Tween<TTarget, TValue> To<TTarget, TValue>(TTarget target, float duration, string property, TValue toValue)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
TTarget | target | The tween's target object which contains the property to tween. |
System.Single | duration | The duration of the tween in seconds. |
System.String | property | The name of the property to tween on the target. |
TValue | toValue | The target value you want to tween the property to. The type of this value has to exactly match the property's type. |
Returns
Type | Description |
---|---|
Tween<TTarget, TValue> |
Type Parameters
Name | Description |
---|---|
TTarget | |
TValue | The value type of the tween. Has to match the target property type's value exactly. |