public Perlin() { this.Seed = new Random().Next(); this.Octaves = 2; this.Amplitude = 2; this.Persistance = 1; this.Frequency = 1; this.Lacunarity = 2; this.Interpolation = InterpolateType.COSINE; }
public static double Interpolate(double pointA, double pointB, double t, InterpolateType type) { switch (type) { //TODO: Incorporate Cubic Interpolation case InterpolateType.COSINE: return CosineInterpolate(pointA, pointB, t); case InterpolateType.LINEAR: return LinearInterpolate(pointA, pointB, t); default: return LinearInterpolate(pointA, pointB, t); } }
private static IEnumerator ChangeRoundingResolutionOnCorner(QuickPolygon shape, int cornerID, float endValue, InterpolateType interpolateType, float duration) { if (shape.Shape.roundings.Length > cornerID) { float startValue = shape.GetRoundingResolution(cornerID); float timeElapsed = 0; while (timeElapsed < duration) { float newvalue = GetInterpolate(interpolateType, startValue, endValue, timeElapsed, duration); shape.SetRoundingResolution(cornerID, newvalue, true); yield return(new WaitForEndOfFrame()); timeElapsed += Time.deltaTime; } shape.SetRoundingResolution(cornerID, endValue, true); } else { Debug.LogError(MSG.Errors.WRONG_ROUNDING_CORNER); } }
private static IEnumerator ChangeUniformRoundingResolution(QuickPolygon shape, float endValue, InterpolateType interpolateType, float duration) { float startValue = shape.GetUniformRoundingResolution(); float timeElapsed = 0; while (timeElapsed < duration) { float newvalue = GetInterpolate(interpolateType, startValue, endValue, timeElapsed, duration); shape.SetUniformRoundingResolution(newvalue, true); yield return(new WaitForEndOfFrame()); timeElapsed += Time.deltaTime; } shape.SetUniformRoundingResolution(endValue, true); }
public static void PlayChangeUniformScaleAnimation(QuickPolygon shape, float endValue, InterpolateType interpolateType, float duration) { activeAnimation = shape.StartCoroutine(ChangeUniformScale(shape, endValue, interpolateType, duration)); }
private static IEnumerator ChangeScale(QuickPolygon shape, float endWidth, float endHeight, InterpolateType interpolateType, float duration) { float startW = shape.GetWidth(); float startH = shape.GetHeight(); float timeElapsed = 0; while (timeElapsed < duration) { float newW = GetInterpolate(interpolateType, startW, endWidth, timeElapsed, duration); float newH = GetInterpolate(interpolateType, startH, endHeight, timeElapsed, duration); shape.SetScale(newW, newH, true); yield return(new WaitForEndOfFrame()); timeElapsed += Time.deltaTime; } shape.SetScale(endWidth, endHeight, true); }
private static IEnumerator ChangeDiamondMiddleHeight(QuickPolygon shape, float endValue, InterpolateType interpolateType, float duration) { float startValue = shape.GetDiamondMiddleHeight(); float timeElapsed = 0; while (timeElapsed < duration) { float newvalue = GetInterpolate(interpolateType, startValue, endValue, timeElapsed, duration); shape.SetDiamondMiddleHeight(newvalue, true); yield return(new WaitForEndOfFrame()); timeElapsed += Time.deltaTime; } shape.SetDiamondMiddleHeight(endValue, true); }
public static void PlayChangeScaleAnimation(QuickPolygon shape, float endWidth, float endHeight, InterpolateType interpolateType, float duration) { activeAnimation = shape.StartCoroutine(ChangeScale(shape, endWidth, endHeight, interpolateType, duration)); }
public static Vector2 Vector2(InterpolateType interpolateType, Vector2 from, Vector2 to, float weight) { return(new Vector2( Slerpy.Interpolate.LinearWithType(interpolateType, from.x, to.x, weight), Slerpy.Interpolate.LinearWithType(interpolateType, from.y, to.y, weight))); }