using UnityEngine;
using UnityEngine.Serialization;

public class UiPElements : MonoBehaviour
{
    public float speed;
    public float height;
    public float rotation;
    public float sinePos = 0f;
    private Vector3 _initPos;
    private Vector3 _initRot;
    
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        _initPos = transform.position;
        _initRot = transform.rotation.eulerAngles;
    }

    // Update is called once per frame
    void Update()
    {
        Mathf.Sin(sinePos);
        sinePos += speed * Time.deltaTime;
        
        transform.position = new Vector3(_initPos.x, _initPos.y+ Mathf.Sin(sinePos)/height, _initPos.z);
        transform.rotation = Quaternion.Euler(new Vector3(_initRot.x, _initRot.y + Mathf.Sin(sinePos)*rotation, _initRot.z));
    }
}
