Skip to content

Instantly share code, notes, and snippets.

@mrhammadasif
Created December 15, 2017 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrhammadasif/7596b428186f5f9679821e10c515e4e7 to your computer and use it in GitHub Desktop.
Save mrhammadasif/7596b428186f5f9679821e10c515e4e7 to your computer and use it in GitHub Desktop.
Function to Animate the object in Unity (in sinewave animation)
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