Show / Hide Table of Contents

Class TweenFollow

Plugin to tween a global position to a moving transform's local position.

Inheritance
System.Object
TweenFollow
Inherited Members
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 static class TweenFollow
Remarks

This plugin can only be used with CustomLoader(Transform) or the Follow<TTarget>(Tween<TTarget, Vector3>, Transform) extension method because it always requires an argument.

To use this plugin, tween "position" on a Transform but use a local position as target value and specify a Transform to follow. The tween will then target the position in the local space of the followed Transform as it moves around.

otherTransform.rotation = Quaternion.identity;
otherTransform.position = new Vector3(10, 0, 10);

// Require TweenFollow for a single tween
Animate.To(transform, 2f, "position", new Vector3(0, 10, 0))
    .Follow(otherTransform);

// transform will end up at (10, 10, 10) at the end of the tween.

Methods

CustomLoader(Transform)

Create a custom TweenFollow plugin loader that uses the given target space.

Declaration
public static PluginLoader CustomLoader(Transform targetSpace)
Parameters
Type Name Description
Transform targetSpace

Target transform to follow

Returns
Type Description
PluginLoader

A custom plugin loader

Remarks

Pass the result of this method to EnablePlugin(PluginLoader, Nullable<Boolean>, Nullable<Boolean>) to enable the plugin for the options scope.

Follow<TTarget>(Tween<TTarget, Vector3>, Transform)

Require the TweenFollow plugin for the current tween.

Declaration
public static Tween<TTarget, Vector3> Follow<TTarget>(this Tween<TTarget, Vector3> tween, Transform targetSpace)
    where TTarget : class
Parameters
Type Name Description
Tween<TTarget, Vector3> tween
Transform targetSpace

Target transform to follow

Returns
Type Description
Tween<TTarget, Vector3>
Type Parameters
Name Description
TTarget
Remarks

Shorthand for using EnablePlugin(PluginLoader, Nullable<Boolean>, Nullable<Boolean>) with type-checking.

Back to top © 2018 Adrian Stutz