# MMotion.Shake

Create a shake around a starting value. Configure frequency, damping, random seed and noise mode.

Namespace: MeatMotion

Assembly: MeatMotion

```csharp
public static class Shake
```

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

## Use a fixed shake seed

Add `using MeatMotion;`. Fix the seed and mode when comparing two shakes at the same time.

```csharp
float a = 0f, b = 0f;
using var world = new MotionWorld();
var first = MMotion.Shake.Create(2f, 0.5f, 1f)
    .WithShakeMode(ShakeMode.PerlinNoise).WithRandomSeed(7)
    .WithScheduler(world).Bind(v => a = v);
var second = MMotion.Shake.Create(2f, 0.5f, 1f)
    .WithShakeMode(ShakeMode.PerlinNoise).WithRandomSeed(7)
    .WithScheduler(world).Bind(v => b = v);
first.Time = second.Time = 0.35;
```

## Create

Create a shake around a starting value. Configure frequency, damping, random seed and noise mode.

```csharp
public static MotionBuilder<float, ShakeOptions, FloatShakeMotionAdapter> Create(float startValue, float strength, float duration)
```

Parameters and return value

- `startValue` (`float`) Starting value.
- `strength` (`float`) Oscillation strength relative to the starting value.
- `duration` (`float`) Duration in seconds.
- Returns: `MotionBuilder<float, ShakeOptions, FloatShakeMotionAdapter>`

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

```csharp
public static MotionBuilder<Vector2, ShakeOptions, Vector2ShakeMotionAdapter> Create(Vector2 startValue, Vector2 strength, float duration)
```

Parameters and return value

- `startValue` (`Vector2`) Starting value.
- `strength` (`Vector2`) Oscillation strength relative to the starting value.
- `duration` (`float`) Duration in seconds.
- Returns: `MotionBuilder<Vector2, ShakeOptions, Vector2ShakeMotionAdapter>`

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

```csharp
public static MotionBuilder<Vector3, ShakeOptions, Vector3ShakeMotionAdapter> Create(Vector3 startValue, Vector3 strength, float duration)
```

Parameters and return value

- `startValue` (`Vector3`) Starting value.
- `strength` (`Vector3`) Oscillation strength relative to the starting value.
- `duration` (`float`) Duration in seconds.
- Returns: `MotionBuilder<Vector3, ShakeOptions, Vector3ShakeMotionAdapter>`

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