# MotionBuilderExtensions

Add struct-state bindings and configure integer rounding, string scrambling, and punch or shake oscillation.

Namespace: MeatMotion

Assembly: MeatMotion

```csharp
public static partial class MotionBuilderExtensions
```

[Runtime/Adapters/Strings/StringMotion.cs · L50](../../../source/Runtime/Adapters/Strings/StringMotion.cs.html#L50)

## WithRichText

Choose whether string interpolation accounts for rich-text tags.

```csharp
public static MotionBuilder<TValue, StringOptions, TAdapter> WithRichText<TValue, TAdapter>( this MotionBuilder<TValue, StringOptions, TAdapter> builder, bool richTextEnabled = true)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, StringOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, StringOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `richTextEnabled = true` (`bool`) Whether interpolation accounts for rich-text markup.
- Returns: `MotionBuilder<TValue, StringOptions, TAdapter>`

[Runtime/Adapters/Strings/StringMotion.cs · L52](../../../source/Runtime/Adapters/Strings/StringMotion.cs.html#L52)

## WithScrambleChars

Set the character set or custom characters used to scramble unrevealed text.

```csharp
public static MotionBuilder<TValue, StringOptions, TAdapter> WithScrambleChars<TValue, TAdapter>( this MotionBuilder<TValue, StringOptions, TAdapter> builder, ScrambleMode scrambleMode)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, StringOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, StringOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `scrambleMode` (`ScrambleMode`) Character set used to fill unrevealed text.
- Returns: `MotionBuilder<TValue, StringOptions, TAdapter>`

[Runtime/Adapters/Strings/StringMotion.cs · L61](../../../source/Runtime/Adapters/Strings/StringMotion.cs.html#L61)

```csharp
public static MotionBuilder<TValue, StringOptions, TAdapter> WithScrambleChars<TValue, TAdapter>( this MotionBuilder<TValue, StringOptions, TAdapter> builder, FixedString64Bytes customScrambleChars)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, StringOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, StringOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `customScrambleChars` (`FixedString64Bytes`) Character set used to fill unrevealed text.
- Returns: `MotionBuilder<TValue, StringOptions, TAdapter>`

[Runtime/Adapters/Strings/StringMotion.cs · L71](../../../source/Runtime/Adapters/Strings/StringMotion.cs.html#L71)

## WithRandomSeed

Set the random seed for scrambling or shake.

```csharp
public static MotionBuilder<TValue, StringOptions, TAdapter> WithRandomSeed<TValue, TAdapter>( this MotionBuilder<TValue, StringOptions, TAdapter> builder, uint seed)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, StringOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, StringOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `seed` (`uint`) Pseudorandom seed.
- Returns: `MotionBuilder<TValue, StringOptions, TAdapter>`

[Runtime/Adapters/Strings/StringMotion.cs · L81](../../../source/Runtime/Adapters/Strings/StringMotion.cs.html#L81)

```csharp
public static MotionBuilder<TValue, ShakeOptions, TAdapter> WithRandomSeed<TValue, TAdapter>( this MotionBuilder<TValue, ShakeOptions, TAdapter> builder, uint seed)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, ShakeOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, ShakeOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `seed` (`uint`) Pseudorandom seed.
- Returns: `MotionBuilder<TValue, ShakeOptions, TAdapter>`

[Runtime/Adapters/Vibration/VibrationMotion.cs · L105](../../../source/Runtime/Adapters/Vibration/VibrationMotion.cs.html#L105)

## WithFrequency

Set the oscillation frequency for punch or shake.

```csharp
public static MotionBuilder<TValue, PunchOptions, TAdapter> WithFrequency<TValue, TAdapter>( this MotionBuilder<TValue, PunchOptions, TAdapter> builder, int frequency)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, PunchOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, PunchOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `frequency` (`int`) Oscillation frequency setting.
- Returns: `MotionBuilder<TValue, PunchOptions, TAdapter>`

[Runtime/Adapters/Vibration/VibrationMotion.cs · L65](../../../source/Runtime/Adapters/Vibration/VibrationMotion.cs.html#L65)

```csharp
public static MotionBuilder<TValue, ShakeOptions, TAdapter> WithFrequency<TValue, TAdapter>( this MotionBuilder<TValue, ShakeOptions, TAdapter> builder, int frequency)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, ShakeOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, ShakeOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `frequency` (`int`) Oscillation frequency setting.
- Returns: `MotionBuilder<TValue, ShakeOptions, TAdapter>`

[Runtime/Adapters/Vibration/VibrationMotion.cs · L85](../../../source/Runtime/Adapters/Vibration/VibrationMotion.cs.html#L85)

## WithDampingRatio

Set how the punch or shake amplitude decays over time.

```csharp
public static MotionBuilder<TValue, PunchOptions, TAdapter> WithDampingRatio<TValue, TAdapter>( this MotionBuilder<TValue, PunchOptions, TAdapter> builder, float dampingRatio)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, PunchOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, PunchOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `dampingRatio` (`float`) Damping applied to oscillation.
- Returns: `MotionBuilder<TValue, PunchOptions, TAdapter>`

[Runtime/Adapters/Vibration/VibrationMotion.cs · L75](../../../source/Runtime/Adapters/Vibration/VibrationMotion.cs.html#L75)

```csharp
public static MotionBuilder<TValue, ShakeOptions, TAdapter> WithDampingRatio<TValue, TAdapter>( this MotionBuilder<TValue, ShakeOptions, TAdapter> builder, float dampingRatio)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, ShakeOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, ShakeOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `dampingRatio` (`float`) Damping applied to oscillation.
- Returns: `MotionBuilder<TValue, ShakeOptions, TAdapter>`

[Runtime/Adapters/Vibration/VibrationMotion.cs · L95](../../../source/Runtime/Adapters/Vibration/VibrationMotion.cs.html#L95)

## WithShakeMode

Choose between random and Perlin shake.

```csharp
public static MotionBuilder<TValue, ShakeOptions, TAdapter> WithShakeMode<TValue, TAdapter>( this MotionBuilder<TValue, ShakeOptions, TAdapter> builder, ShakeMode shakeMode)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, ShakeOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, ShakeOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `shakeMode` (`ShakeMode`) Noise mode used to evaluate the shake.
- Returns: `MotionBuilder<TValue, ShakeOptions, TAdapter>`

[Runtime/Adapters/Vibration/VibrationMotion.cs · L115](../../../source/Runtime/Adapters/Vibration/VibrationMotion.cs.html#L115)

## Bind

Pass struct state to the setter, after the interpolated value.

```csharp
public static MotionHandle Bind<TState>(this FloatMotionBuilder builder, TState state, Action<float, TState> action)
    where TState : struct
```

Parameters and return value

- `builder` (`this FloatMotionBuilder`) Configured builder, passed as the receiver for extension calls.
- `state` (`TState`) State passed to the setter after the interpolated value.
- `action` (`Action<float, TState>`) Callback receiving the sampled value.
- Returns: `MotionHandle`

[Runtime/Builders/MotionBuilderExtensions.cs · L7](../../../source/Runtime/Builders/MotionBuilderExtensions.cs.html#L7)

```csharp
public static MotionHandle Bind<TValue, TOptions, TAdapter, TState>( this MotionBuilder<TValue, TOptions, TAdapter> builder, TState state, Action<TValue, TState> action)
    where TValue : unmanaged
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>
    where TState : struct
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, TOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `state` (`TState`) State passed to the setter after the interpolated value.
- `action` (`Action<TValue, TState>`) Callback receiving the sampled value.
- Returns: `MotionHandle`

[Runtime/Builders/MotionBuilderExtensions.cs · L11](../../../source/Runtime/Builders/MotionBuilderExtensions.cs.html#L11)

## WithRoundingMode

Choose how an interpolated int or long is rounded.

```csharp
public static MotionBuilder<TValue, IntegerOptions, TAdapter> WithRoundingMode<TValue, TAdapter>( this MotionBuilder<TValue, IntegerOptions, TAdapter> builder, RoundingMode roundingMode)
    where TValue : unmanaged
    where TAdapter : unmanaged, IMotionAdapter<TValue, IntegerOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, IntegerOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `roundingMode` (`RoundingMode`) Rounding rule for integer interpolation.
- Returns: `MotionBuilder<TValue, IntegerOptions, TAdapter>`

[Runtime/Builders/MotionBuilderExtensions.cs · L19](../../../source/Runtime/Builders/MotionBuilderExtensions.cs.html#L19)

## Related types

- [IMotionAdapter<TValue, TOptions>](../../../en/api/imotionadapter-2/index.md)

- [MotionBuilder<TValue, TOptions, TAdapter>](../../../en/api/motionbuilder-3/index.md)
