MMotion.Shake
初期値の周りを揺らすTweenを作ります。周波数・減衰・乱数シード・ノイズの種類を設定できます。
public static class ShakeVibrationMotion.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)引数と戻り値
startValuefloat補間の開始値。strengthfloat基準値からの振動の強さ。終点を表す値とは扱いが異なります。durationfloat開始から終了までの秒数。- 戻り値
MotionBuilder<float, ShakeOptions, FloatShakeMotionAdapter>
public static MotionBuilder<Vector2, ShakeOptions, Vector2ShakeMotionAdapter> Create(Vector2 startValue, Vector2 strength, float duration)引数と戻り値
startValueVector2補間の開始値。strengthVector2基準値からの振動の強さ。終点を表す値とは扱いが異なります。durationfloat開始から終了までの秒数。- 戻り値
MotionBuilder<Vector2, ShakeOptions, Vector2ShakeMotionAdapter>
public static MotionBuilder<Vector3, ShakeOptions, Vector3ShakeMotionAdapter> Create(Vector3 startValue, Vector3 strength, float duration)引数と戻り値
startValueVector3補間の開始値。strengthVector3基準値からの振動の強さ。終点を表す値とは扱いが異なります。durationfloat開始から終了までの秒数。- 戻り値
MotionBuilder<Vector3, ShakeOptions, Vector3ShakeMotionAdapter>
MeatMotion