Show / Hide Table of Contents

Class TweenMaterial

Tween a material property.

Inheritance
System.Object
TweenMaterial
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 TweenMaterial
Remarks

This plugin enables tweening of any custom property on a Material.

Since Unity doesn't expose a property's type at runtime, it's up to the user to make sure the tween type matches the property's type.

When not specifying a property type with CustomLoader(TweenMaterial.PropertyType) or using one of the Material(Tween<Material, Color>, TweenMaterial.PropertyType) extension methods, following types are inferred from the tween type:

  • Color: Color
  • Vector2: TextureOffset
  • Vector4: Vector
  • Float: Float

Note that TextureScale always requires specifying the type.

When the plugin is enabled globally or for a group, it also requires properties to be prefixed with an underscore (.e.g. "_Color", which is also the Unity convention for all material properties).

// Enable globally
Animate.Options.EnablePlugin(TweenMaterial.Load);

// Enable for a specific tween
Animate.To(material, 2f, "_Color", Color.white)
.Material();

// Specifying a property type
Animate.To(material, 2f, "_MainTex", Vector2.one)
.Material(TweenMaterial.PropertyType.TextureScale);

Methods

CustomLoader(TweenMaterial.PropertyType)

Create a custom TweenMaterial plugin loader that forces a specific material property type.

Declaration
public static PluginLoader CustomLoader(TweenMaterial.PropertyType forceType)
Parameters
Type Name Description
TweenMaterial.PropertyType forceType

Type of the material property

Returns
Type Description
PluginLoader

A custom plugin loader that forces the property type

Remarks

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

Loader(Tween, Boolean)

TweenMaterial plugin loader.

Declaration
public static PluginResult Loader(Tween tween, bool required)
Parameters
Type Name Description
Tween tween
System.Boolean required
Returns
Type Description
PluginResult
Remarks

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

Material(Tween<Material, Color>, TweenMaterial.PropertyType)

Require the TweenMaterial plugin for the current tween.

Declaration
public static Tween<Material, Color> Material(this Tween<Material, Color> tween, TweenMaterial.PropertyType type = TweenMaterial.PropertyType.Undefined)
Parameters
Type Name Description
Tween<Material, Color> tween
TweenMaterial.PropertyType type

Type of the material property

Returns
Type Description
Tween<Material, Color>
Remarks

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

Material(Tween<Material, Single>, TweenMaterial.PropertyType)

Require the TweenMaterial plugin for the current tween.

Declaration
public static Tween<Material, float> Material(this Tween<Material, float> tween, TweenMaterial.PropertyType type = TweenMaterial.PropertyType.Undefined)
Parameters
Type Name Description
Tween<Material, System.Single> tween
TweenMaterial.PropertyType type

Type of the material property

Returns
Type Description
Tween<Material, System.Single>
Remarks

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

Material(Tween<Material, Vector2>, TweenMaterial.PropertyType)

Require the TweenMaterial plugin for the current tween.

Declaration
public static Tween<Material, Vector2> Material(this Tween<Material, Vector2> tween, TweenMaterial.PropertyType type = TweenMaterial.PropertyType.Undefined)
Parameters
Type Name Description
Tween<Material, Vector2> tween
TweenMaterial.PropertyType type

Type of the material property

Returns
Type Description
Tween<Material, Vector2>
Remarks

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

Material(Tween<Material, Vector4>, TweenMaterial.PropertyType)

Require the TweenMaterial plugin for the current tween.

Declaration
public static Tween<Material, Vector4> Material(this Tween<Material, Vector4> tween, TweenMaterial.PropertyType type = TweenMaterial.PropertyType.Undefined)
Parameters
Type Name Description
Tween<Material, Vector4> tween
TweenMaterial.PropertyType type

Type of the material property

Returns
Type Description
Tween<Material, Vector4>
Remarks

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

Back to top © 2018 Adrian Stutz