LMotion.Shake.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using UnityEngine;
  2. using LitMotion.Adapters;
  3. namespace LitMotion
  4. {
  5. public static partial class LMotion
  6. {
  7. /// <summary>
  8. /// API for creating Shake motions.
  9. /// </summary>
  10. public static class Shake
  11. {
  12. /// <summary>
  13. /// Create a builder for building Shake motion.
  14. /// </summary>
  15. /// <param name="startValue">Start value</param>
  16. /// <param name="strength">Vibration strength</param>
  17. /// <param name="duration">Duration</param>
  18. /// <returns>Created motion builder</returns>
  19. public static MotionBuilder<float, ShakeOptions, FloatShakeMotionAdapter> Create(float startValue, float strength, float duration)
  20. {
  21. return Create<float, ShakeOptions, FloatShakeMotionAdapter>(startValue, strength, duration)
  22. .WithOptions(ShakeOptions.Default);
  23. }
  24. /// <summary>
  25. /// Create a builder for building Shake motion.
  26. /// </summary>
  27. /// <param name="startValue">Start value</param>
  28. /// <param name="strength">Vibration strength</param>
  29. /// <param name="duration">Duration</param>
  30. /// <returns>Created motion builder</returns>
  31. public static MotionBuilder<Vector2, ShakeOptions, Vector2ShakeMotionAdapter> Create(Vector2 startValue, Vector2 strength, float duration)
  32. {
  33. return Create<Vector2, ShakeOptions, Vector2ShakeMotionAdapter>(startValue, strength, duration)
  34. .WithOptions(ShakeOptions.Default);
  35. }
  36. /// <summary>
  37. /// Create a builder for building Shake motion.
  38. /// </summary>
  39. /// <param name="startValue">Start value</param>
  40. /// <param name="strength">Vibration strength</param>
  41. /// <param name="duration">Duration</param>
  42. /// <returns>Created motion builder</returns>
  43. public static MotionBuilder<Vector3, ShakeOptions, Vector3ShakeMotionAdapter> Create(Vector3 startValue, Vector3 strength, float duration)
  44. {
  45. return Create<Vector3, ShakeOptions, Vector3ShakeMotionAdapter>(startValue, strength, duration)
  46. .WithOptions(ShakeOptions.Default);
  47. }
  48. }
  49. }
  50. }