public static float Interpolate(float from, float to, float delta, eInterpolation type) { float result = from; switch (type) { case eInterpolation.INTERPOLATE_TYPE_LINEAR: result = LinearInterpolate(from, to, delta); break; case eInterpolation.INTERPOLATE_TYPE_SIGMOID: result = SigmoidInterpolate(from, to, delta); break; case eInterpolation.INTERPOLATE_TYPE_4SIN: result = Sin4Interpolate(from, to, delta); break; case eInterpolation.INTERPOLATE_TYPE_SIN_ACEL: result = SinAcelerateInterpolate(from, to, delta); break; case eInterpolation.INTERPOLATE_TYPE_SIN_DECEL: result = SinDecelerateInterpolate(from, to, delta); break; case eInterpolation.INTERPOLATE_TYPE_SPRING_063: result = Spring063Interpolate(from, to, delta); break; } return(result); }
public static Vector2 Interpolate(Vector2 from, Vector2 to, float delta, eInterpolation type) { Vector2 result; result.x = Interpolate(from.x, to.x, delta, type); result.y = Interpolate(from.y, to.y, delta, type); return(result); }
public static Color32 Interpolate(Color32 from, Color32 to, float delta, eInterpolation type) { Vector4 from_ = new Vector4((float)from.r, (float)from.g, (float)from.b, (float)from.a); Vector4 to_ = new Vector4((float)to.r, (float)to.g, (float)to.b, (float)to.a); Vector4 result_ = Interpolate(from_, to_, delta, type); Color32 result = new Color32((byte)result_.x, (byte)result_.y, (byte)result_.z, (byte)result_.w); return(result); }
public static Vector3 Interpolate(Vector3 from, Vector3 to, float delta, eInterpolation type) { Vector3 result; result.x = Interpolate(from.x, to.x, delta, type); result.y = Interpolate(from.y, to.y, delta, type); result.z = Interpolate(from.z, to.z, delta, type); return(result); }
public static double Interpolate(eInterpolation type, double start, double end, double t) { switch (type) { case eInterpolation.InQuad: return(InterpolateInQuad(start, end, t)); case eInterpolation.OutQuad: return(InterpolateOutQuad(start, end, t)); case eInterpolation.InOutQuad: return(InterpolateInOutQuad(start, end, t)); case eInterpolation.InOutCubic: return(InterpolateInOutCubic(start, end, t)); case eInterpolation.InCubic: return(InterpolateInCubic(start, end, t)); case eInterpolation.OutCubic: return(InterpolateOutCubic(start, end, t)); case eInterpolation.InSine: return(InterpolateInSine(start, end, t)); case eInterpolation.OutSine: return(InterpolateOutSine(start, end, t)); case eInterpolation.InOutSine: return(InterpolateInOutSine(start, end, t)); case eInterpolation.InOutSineInv: return(InterpolateInOutSineInv(start, end, t)); case eInterpolation.InElastic: return(InterpolateInElastic(start, end, t)); case eInterpolation.OutElastic: return(InterpolateOutElastic(start, end, t)); case eInterpolation.InOutElastic: return(InterpolateInOutElastic(start, end, t)); case eInterpolation.InBounce: return(InterpolateInBounce(start, end, t)); case eInterpolation.OutBounce: return(InterpolateOutBounce(start, end, t)); case eInterpolation.InOutBounce: return(InterpolateInOutBounce(start, end, t)); default: case eInterpolation.Linear: return(InterpolateLinear(start, end, t)); } }
public static Color Interpolate(Color from, Color to, float delta, eInterpolation type) { Vector4 result; result.x = Interpolate(from.r, to.r, delta, type); result.y = Interpolate(from.g, to.g, delta, type); result.z = Interpolate(from.b, to.b, delta, type); result.w = Interpolate(from.a, to.a, delta, type); return(result); }
public void SetAnimation(Animation animation, eInterpolation easeType = eInterpolation.InOutSine, float blendTime = 0.0f) { _currentAnimationBlendTime = blendTime; _currentEaseType = easeType; animation._animationT = 0.0f; if (blendTime > 0.0f) { animation._weight = 0.0f; _animations.Add(animation); } else { animation._weight = 1.0f; _animations = new List <Animation>() { animation }; } }
public static Vector3 Interpolate(eInterpolation type, Vector3 from, Vector3 to, float t) { float lerp = Interpolation.Interpolate(type, 0.0f, 1.0f, t); return(Vector3.Lerp(from, to, lerp)); }
public static Quaternion Interpolate(eInterpolation type, Quaternion from, Quaternion to, float t) { float lerp = Interpolation.Interpolate(type, 0.0f, 1.0f, t); return(Quaternion.Slerp(from, to, lerp)); }
public static float Interpolate(eInterpolation type, float start, float end, float t) { return(Interpolation.Interpolate(type, start, end, t)); }
public static double Interpolate(eInterpolation type, double start, double end, double t) { return(Interpolation.Interpolate(type, start, end, t)); }
public static Vector3 Damp(Vector3 a, Vector3 b, float lambda, float deltaTime, eInterpolation type = eInterpolation.Linear) { float lerp = Damp(0.0f, 1.0f, lambda, deltaTime, type); return(Vector3.Lerp(a, b, lerp)); }
public static Quaternion Damp(Quaternion a, Quaternion b, float lambda, float deltaTime, eInterpolation type = eInterpolation.Linear) { float lerp = Damp(0.0f, 1.0f, lambda, deltaTime, type); return(Quaternion.Slerp(a, b, lerp)); }
public bool RenderObjectProperties(GUIContent label) { bool dataChanged = false; _gameObject = SerializationEditorGUILayout.ObjectField(_gameObject, "Game Object", ref dataChanged); _transformFlags = SerializationEditorGUILayout.ObjectField(_transformFlags, "Transform Flags", ref dataChanged); _moveType = SerializationEditorGUILayout.ObjectField(_moveType, "Move Type", ref dataChanged); _easeType = SerializationEditorGUILayout.ObjectField(_easeType, "Ease Type", ref dataChanged); EditorGUI.BeginChangeCheck(); _duration = EditorGUILayout.FloatField("Duration", _duration); dataChanged |= EditorGUI.EndChangeCheck(); bool targetChanged = false; _targetType = SerializationEditorGUILayout.ObjectField(_targetType, "Target Type", ref targetChanged); if (targetChanged) { dataChanged = true; _targetTransform = new GameObjectRef(); _targetPosition = Vector3.zero; _targetRotation = Quaternion.identity; _targetScale = Vector3.one; } switch (_targetType) { case eTargetType.Transform: { _targetTransform = SerializationEditorGUILayout.ObjectField(_targetTransform, new GUIContent("Target Type"), ref dataChanged); } break; case eTargetType.LocalDelta: case eTargetType.LocalTarget: case eTargetType.WorldDelta: case eTargetType.WorldTarget: { if ((_transformFlags & eTransformFlag.Translate) != 0) { EditorGUI.BeginChangeCheck(); _targetPosition = EditorGUILayout.Vector3Field("Translation", _targetPosition); dataChanged |= EditorGUI.EndChangeCheck(); } if ((_transformFlags & eTransformFlag.Rotate) != 0) { EditorGUI.BeginChangeCheck(); _targetRotation.eulerAngles = EditorGUILayout.Vector3Field("Rotation", _targetRotation.eulerAngles); dataChanged |= EditorGUI.EndChangeCheck(); } if ((_transformFlags & eTransformFlag.Scale) != 0) { EditorGUI.BeginChangeCheck(); _targetScale = EditorGUILayout.Vector3Field("Scale", _targetScale); dataChanged |= EditorGUI.EndChangeCheck(); } } break; } return(dataChanged); }
public static FloatRange Interpolate(eInterpolation type, FloatRange from, FloatRange to, float t) { float lerp = Interpolation.Interpolate(type, 0.0f, 1.0f, t); return(Lerp(from, to, lerp)); }
public static Color Interpolate(eInterpolation type, Color from, Color to, float t) { float lerp = Interpolation.Interpolate(type, 0.0f, 1.0f, t); return(Color.Lerp(from, to, lerp)); }
public static IEnumerator Interpolate(double value, Action <double> valueSetter, eInterpolation type, double to, float time) { if (time > 0.0f) { double t = 0.0d; double start = value; double invTime = 1.0d / time; while (t < 1.0d) { t += Time.deltaTime * invTime; if (t > 1.0d) { value = to; } else { value = Interpolate(type, start, to, t); } valueSetter(value); yield return(null); } } else { valueSetter(to); } yield break; }
public static IEnumerator Interpolate(float value, Action <float> valueSetter, eInterpolation type, float to, float time) { if (time > 0.0f) { float t = 0.0f; float start = value; float invTime = 1.0f / time; while (t < 1.0f) { t += Time.deltaTime * invTime; if (t > 1.0f) { value = to; } else { value = Interpolate(type, start, to, t); } valueSetter(value); yield return(null); } } else { valueSetter(to); } yield break; }
public static Rect Interpolate(eInterpolation type, Rect from, Rect to, float t) { float lerp = Interpolation.Interpolate(type, 0.0f, 1.0f, t); return(Lerp(from, to, lerp)); }
public static float Damp(float a, float b, float lambda, float deltaTime, eInterpolation type = eInterpolation.Linear) { return(Interpolation.Interpolate(type, a, b, 1.0f - Mathf.Exp(-lambda * deltaTime))); }
public static double Damp(double a, double b, double lambda, double deltaTime, eInterpolation type = eInterpolation.Linear) { return(Interpolation.Interpolate(type, a, b, 1.0d - Math.Exp(-lambda * deltaTime))); }
public virtual AnimatedCameraState InterpolateTo(AnimatedCamera camera, AnimatedCameraState to, eInterpolation ease, float t) { AnimatedCameraState state = new AnimatedCameraState(); state._position = MathUtils.Interpolate(ease, _position, to._position, t); state._rotation = MathUtils.Interpolate(ease, _rotation, to._rotation, t); state._fieldOfView = MathUtils.Interpolate(ease, _fieldOfView, to._fieldOfView, t); state._cameraRect = MathUtils.Interpolate(ease, _cameraRect, to._cameraRect, t); return(state); }