CubismFadeMath.cs 814 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Copyright(c) Live2D Inc. All rights reserved.
  3. *
  4. * Use of this source code is governed by the Live2D Open Software license
  5. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
  6. */
  7. using System;
  8. namespace Live2D.Cubism.Framework.MotionFade
  9. {
  10. public static class CubismFadeMath
  11. {
  12. /// <summary>
  13. /// Calculate the easing processed signaure.
  14. /// </summary>
  15. /// <param name="value">Value to be subjected to easing.</param>
  16. /// <returns>Eased sign value.</returns>
  17. public static float GetEasingSine(float value)
  18. {
  19. if (value < 0.0f) return 0.0f;
  20. if (value > 1.0f) return 1.0f;
  21. return (float)(0.5f - 0.5f * Math.Cos(value * (float)Math.PI));
  22. }
  23. }
  24. }