# MMotion.Shake

初期値の周りを揺らすTweenを作ります。周波数・減衰・乱数シード・ノイズの種類を設定できます。

Namespace: MeatMotion

Assembly: MeatMotion

```csharp
public static class Shake
```

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

## 乱数シードを固定して揺らす

`using MeatMotion;` を追加します。手動でシークや比較を行うときはシードとモードをそろえます。

```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

初期値の周りを揺らすTweenを作ります。周波数・減衰・乱数シード・ノイズの種類を設定できます。

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

引数と戻り値

- `startValue` (`float`) 補間の開始値。
- `strength` (`float`) 基準値からの振動の強さ。終点を表す値とは扱いが異なります。
- `duration` (`float`) 開始から終了までの秒数。
- 戻り値: `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)
```

引数と戻り値

- `startValue` (`Vector2`) 補間の開始値。
- `strength` (`Vector2`) 基準値からの振動の強さ。終点を表す値とは扱いが異なります。
- `duration` (`float`) 開始から終了までの秒数。
- 戻り値: `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)
```

引数と戻り値

- `startValue` (`Vector3`) 補間の開始値。
- `strength` (`Vector3`) 基準値からの振動の強さ。終点を表す値とは扱いが異なります。
- `duration` (`float`) 開始から終了までの秒数。
- 戻り値: `MotionBuilder<Vector3, ShakeOptions, Vector3ShakeMotionAdapter>`

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