rabidus-test/Assets/CurvedUI/Demo Scenes/Demo Scenes Content/CUI_PerlinNoisePosition.cs

29 lines
753 B
C#
Raw Normal View History

2023-08-15 17:38:54 +03:00
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_PerlinNoisePosition : MonoBehaviour
{
public float samplingSpeed = 1;
public Vector2 Range;
RectTransform rectie;
// Use this for initialization
void Start()
{
rectie = transform as RectTransform;
}
// Update is called once per frame
void Update()
{
rectie.anchoredPosition = new Vector2(Mathf.PerlinNoise(Time.time * samplingSpeed, Time.time * samplingSpeed).Remap(0, 1, -Range.x, Range.x),
Mathf.PerlinNoise(Time.time * samplingSpeed * 1.333f, Time.time * samplingSpeed * 0.888f).Remap(0, 1, -Range.y, Range.y));
}
}
}