Created
December 15, 2017 07:19
-
-
Save mrhammadasif/7596b428186f5f9679821e10c515e4e7 to your computer and use it in GitHub Desktop.
Function to Animate the object in Unity (in sinewave animation)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SineWaveAnimation : MonoBehaviour { | |
public float baseSize = 1f; | |
void Update() { | |
float animation = baseSize + Mathf.Sin(Time.time * 8f) * baseSize / 7f; | |
transform.localScale = Vector3.one * animation; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment