johnatm / itween

Automatically exported from code.google.com/p/itween
1 stars 2 forks source link

Punch function doesn't need s #94

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Here is your equation

    private float punch(float amplitude, float value)
    {
        float s = 9;
        if (value == 0)
        {
            return 0;
        }
        if (value == 1)
        {
            return 0;
        }
        float period = 1 * 0.3f;
        s = 1 * 0.3f / (2 * Mathf.PI) * Mathf.Asin(0);
        return (amplitude * Mathf.Pow(2, -10 * value) * Mathf.Sin((value * 1 - s) * (2 * Mathf.PI) / period));
    }

A Debug.log(s) shows that s is always 0 because Mathf.Asin(0) is 0.

Therefore you could completely remove s out of the equation.

Original issue reported on code.google.com by davidcla...@gmail.com on 13 Nov 2011 at 7:41