Advertisement
fivearchers

Simple Curve Scale script

Oct 22nd, 2013
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CurveScale : MonoBehaviour {
  5.  
  6. public AnimationCurve scaleCurve;
  7. public Vector3 movement;
  8. public float scaleRate;
  9. public float curvePos;
  10. public bool loop=true;
  11. Vector3 localstart;
  12.  
  13. void Start () {
  14. localstart=transform.localScale;
  15. }
  16.  
  17.  
  18. void Update () {
  19. if (curvePos!=1||!loop){
  20. curvePos+=scaleRate*Time.deltaTime;
  21. if (curvePos>1f){curvePos=curvePos-1f;}
  22. transform.localScale=localstart+movement*scaleCurve.Evaluate(curvePos);
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement