21 lines
472 B
C#
21 lines
472 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SinRotator : MonoBehaviour
|
|
{
|
|
public float speed;
|
|
float amplitude = 0.2f;
|
|
|
|
private void Start()
|
|
{
|
|
amplitude = transform.localScale.x;
|
|
}
|
|
void Update()
|
|
{
|
|
float x = 0.5f + 0.5f * Mathf.Sin(Time.time * speed);
|
|
x *= amplitude;
|
|
transform.localScale = new Vector3(x, transform.localScale.y, transform.localScale.z);
|
|
}
|
|
}
|