Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class CurveScale : MonoBehaviour {
- public AnimationCurve scaleCurve;
- public Vector3 movement;
- public float scaleRate;
- public float curvePos;
- public bool loop=true;
- Vector3 localstart;
- void Start () {
- localstart=transform.localScale;
- }
- void Update () {
- if (curvePos!=1||!loop){
- curvePos+=scaleRate*Time.deltaTime;
- if (curvePos>1f){curvePos=curvePos-1f;}
- transform.localScale=localstart+movement*scaleCurve.Evaluate(curvePos);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement