MMotion.Shake
Create a shake around a starting value. Configure frequency, damping, random seed and noise mode.
public static class ShakeVibrationMotion.cs · L50Use a fixed shake seed
Add using MeatMotion;. Fix the seed and mode when comparing two shakes at the same time.
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;
Members
Create
Create a shake around a starting value. Configure frequency, damping, random seed and noise mode.
public static MotionBuilder<float, ShakeOptions, FloatShakeMotionAdapter> Create(float startValue, float strength, float duration)Parameters and return value
startValuefloatStarting value.strengthfloatOscillation strength relative to the starting value.durationfloatDuration in seconds.- Returns
MotionBuilder<float, ShakeOptions, FloatShakeMotionAdapter>
public static MotionBuilder<Vector2, ShakeOptions, Vector2ShakeMotionAdapter> Create(Vector2 startValue, Vector2 strength, float duration)Parameters and return value
startValueVector2Starting value.strengthVector2Oscillation strength relative to the starting value.durationfloatDuration in seconds.- Returns
MotionBuilder<Vector2, ShakeOptions, Vector2ShakeMotionAdapter>
public static MotionBuilder<Vector3, ShakeOptions, Vector3ShakeMotionAdapter> Create(Vector3 startValue, Vector3 strength, float duration)Parameters and return value
startValueVector3Starting value.strengthVector3Oscillation strength relative to the starting value.durationfloatDuration in seconds.- Returns
MotionBuilder<Vector3, ShakeOptions, Vector3ShakeMotionAdapter>
MeatMotion