From 6d0c9a214dc0fda264e8588fa02aaa19b0b2cc5f Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 21 Apr 2021 21:52:56 +0800 Subject: +init --- Assets/ProFlares/DemoScripts/TranslateCurve.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Assets/ProFlares/DemoScripts/TranslateCurve.cs (limited to 'Assets/ProFlares/DemoScripts/TranslateCurve.cs') diff --git a/Assets/ProFlares/DemoScripts/TranslateCurve.cs b/Assets/ProFlares/DemoScripts/TranslateCurve.cs new file mode 100644 index 0000000..32619ae --- /dev/null +++ b/Assets/ProFlares/DemoScripts/TranslateCurve.cs @@ -0,0 +1,26 @@ +/// ProFlares - v1.08 - Copyright 2014-2015 All rights reserved - ProFlares.com + + +using UnityEngine; +using System.Collections; + +namespace ProFlares { + public class TranslateCurve : MonoBehaviour { + Transform thisTransform; + Vector3 pos; + public float speed = 0.3f; + public WrapMode wrapMode; + public Vector3 axis = Vector3.one; + + public AnimationCurve Curve = new AnimationCurve(new Keyframe(0, 0.1f), new Keyframe(0.5f, 1.0f), new Keyframe(1.0f, 0.1f)); + void Start () { + thisTransform = transform; + pos = thisTransform.localPosition; + Curve.postWrapMode = wrapMode; + } + + void Update () { + thisTransform.transform.localPosition = pos+(axis*Curve.Evaluate(Time.time*speed)); + } + } +} -- cgit v1.1-26-g67d0