CUI_PerlinNoiseRotation.cs 639 B

12345678910111213141516171819202122232425262728
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace CurvedUI
  4. {
  5. public class CUI_PerlinNoiseRotation : MonoBehaviour
  6. {
  7. public float samplingSpeed = 1;
  8. public float maxrotation = 60;
  9. RectTransform rectie;
  10. // Use this for initialization
  11. void Start()
  12. {
  13. rectie = transform as RectTransform;
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. rectie.localEulerAngles = new Vector3(0, 0, Mathf.PerlinNoise(Time.time * samplingSpeed, Time.time * samplingSpeed).Remap(0, 1, -maxrotation, maxrotation));
  19. }
  20. }
  21. }