Created
January 11, 2015 05:18
-
-
Save kazuooooo/27072d888984c790d483 to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
| using System.Collections; | |
| public class UpDownAnimation : MonoBehaviour { | |
| public float endtime; | |
| public float topposition; | |
| //x or y or z | |
| public string direction; | |
| // Use this for initialization | |
| void Start () { | |
| AnimationClip clip = new AnimationClip(); | |
| AnimationCurve curve = AnimationCurve.Linear(0f,0f,endtime,0f); | |
| Keyframe key = new Keyframe(endtime/2,topposition); | |
| curve.AddKey(key); | |
| clip.SetCurve("",typeof(Transform),"localPosition."+direction,curve); | |
| clip.wrapMode = WrapMode.Loop; | |
| animation.AddClip(clip,"clip1"); | |
| animation.Play("clip1"); | |
| } | |
| // Update is called once per frame | |
| void Update () { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment