MeatMotion

UGUIMotionExtensions

Update uGUI graphics, text, images and canvas groups. Bind a color channel, text value, fill amount or alpha.

Namespace
MeatMotion.Extensions
Assembly
MeatMotion.UI

Jump to members

public static partial class UGUIMotionExtensions

Requires com.unity.ugui

UGUIMotionExtensions.cs · L7

Fade a CanvasGroup

Attach a CanvasGroup to the target GameObject. In a MonoBehaviour, import MeatMotion, MeatMotion.Extensions and UnityEngine. Add MeatMotion.UI if using an assembly definition.

var group = gameObject.GetComponent<CanvasGroup>();
var fade = MMotion.Create(0f, 1f, 0.4f)
    .BindToAlpha(group).AddTo(gameObject);

Members

BindToColor

Schedule a tween that writes the interpolated value to Color on the bound target and return its MotionHandle.

public static MotionHandle BindToColor<TOptions, TAdapter>(this MotionBuilder<Color, TOptions, TAdapter> builder, Graphic graphic)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<Color, TOptions>
Parameters and return value
builder
this MotionBuilder<Color, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle

BindToColorR

Update only the R channel of Color, retaining the other color components.

public static MotionHandle BindToColorR(this FloatMotionBuilder builder, Graphic graphic)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle
public static MotionHandle BindToColorR<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Graphic graphic)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle

BindToColorG

Update only the G channel of Color, retaining the other color components.

public static MotionHandle BindToColorG(this FloatMotionBuilder builder, Graphic graphic)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle
public static MotionHandle BindToColorG<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Graphic graphic)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle

BindToColorB

Update only the B channel of Color, retaining the other color components.

public static MotionHandle BindToColorB(this FloatMotionBuilder builder, Graphic graphic)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle
public static MotionHandle BindToColorB<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Graphic graphic)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle

BindToColorA

Update only the A channel of Color, retaining the other color components.

public static MotionHandle BindToColorA(this FloatMotionBuilder builder, Graphic graphic)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle
public static MotionHandle BindToColorA<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Graphic graphic)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
graphic
Graphic Target Graphic that receives the update.
Returns
MotionHandle

BindToFillAmount

Bind a float to Image.fillAmount.

public static MotionHandle BindToFillAmount(this FloatMotionBuilder builder, Image image)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
image
Image Target Image that receives the update.
Returns
MotionHandle
public static MotionHandle BindToFillAmount<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Image image)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
image
Image Target Image that receives the update.
Returns
MotionHandle

BindToAlpha

Bind a float to CanvasGroup.alpha to fade the group.

public static MotionHandle BindToAlpha(this FloatMotionBuilder builder, CanvasGroup canvasGroup)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
canvasGroup
CanvasGroup Target CanvasGroup that receives the update.
Returns
MotionHandle
public static MotionHandle BindToAlpha<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, CanvasGroup canvasGroup)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
canvasGroup
CanvasGroup Target CanvasGroup that receives the update.
Returns
MotionHandle

BindToFontSize

Schedule a tween that writes the interpolated value to FontSize on the bound target and return its MotionHandle.

public static MotionHandle BindToFontSize<TOptions, TAdapter>(this MotionBuilder<int, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<int, TOptions>
Parameters and return value
builder
this MotionBuilder<int, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle

BindToText

Write interpolated text or a formatted numeric value to the text component.

public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<FixedString32Bytes, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<FixedString32Bytes, TOptions>
Parameters and return value
builder
this MotionBuilder<FixedString32Bytes, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<FixedString64Bytes, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<FixedString64Bytes, TOptions>
Parameters and return value
builder
this MotionBuilder<FixedString64Bytes, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<FixedString128Bytes, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<FixedString128Bytes, TOptions>
Parameters and return value
builder
this MotionBuilder<FixedString128Bytes, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<FixedString512Bytes, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<FixedString512Bytes, TOptions>
Parameters and return value
builder
this MotionBuilder<FixedString512Bytes, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<FixedString4096Bytes, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<FixedString4096Bytes, TOptions>
Parameters and return value
builder
this MotionBuilder<FixedString4096Bytes, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<int, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<int, TOptions>
Parameters and return value
builder
this MotionBuilder<int, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<int, TOptions, TAdapter> builder, Text text, string format)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<int, TOptions>
Parameters and return value
builder
this MotionBuilder<int, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
format
string Format string for converting the sampled value to text.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<long, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<long, TOptions>
Parameters and return value
builder
this MotionBuilder<long, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<long, TOptions, TAdapter> builder, Text text, string format)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<long, TOptions>
Parameters and return value
builder
this MotionBuilder<long, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
format
string Format string for converting the sampled value to text.
Returns
MotionHandle
public static MotionHandle BindToText(this FloatMotionBuilder builder, Text text)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Text text)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
Returns
MotionHandle
public static MotionHandle BindToText(this FloatMotionBuilder builder, Text text, string format)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
format
string Format string for converting the sampled value to text.
Returns
MotionHandle
public static MotionHandle BindToText<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Text text, string format)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
text
Text Target Text that receives the update.
format
string Format string for converting the sampled value to text.
Returns
MotionHandle