// Creates an animation curve of the specified type and resolution, and adds it to the specified asset protected virtual void CreateAnimationCurve(ScriptableObject asset, Tween.TweenCurve curveType, int curveResolution, bool anti) { // generates an animation curve AnimationCurve animationCurve = new AnimationCurve(); for (int i = 0; i < curveResolution; i++) { _keyframe.time = i / (curveResolution - 1f); if (anti) { _keyframe.value = Tween.TweenConstructor(_keyframe.time, 0f, 1f, 1f, 0f, curveType); } else { _keyframe.value = Tween.TweenConstructor(_keyframe.time, 0f, 1f, 0f, 1f, curveType); } animationCurve.AddKey(_keyframe); } // smoothes the curve's tangents for (int j = 0; j < curveResolution; j++) { animationCurve.SmoothTangents(j, 0f); } // we add the curve to the scriptable object _parameters = new object[] { animationCurve, curveType.ToString() }; _addMethodInfo.Invoke(asset, _parameters); }
public TweenType(Tween.TweenCurve newCurve) { TweenCurve = newCurve; TweenDefinitionType = TweenDefinitionTypes.MMTween; }