MeatMotion

MMotion.Shake

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

Namespace
MeatMotion
Assembly
MeatMotion

メンバー一覧へ

public static class Shake
VibrationMotion.cs · L50

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

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

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を作ります。周波数・減衰・乱数シード・ノイズの種類を設定できます。

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