domhofmann/PRTween

Compiler Warning: "Variable 'a' is uninitialized when used here"

Closed this issue · 1 comments

in PRTweenTimingFunctions.m, lines 97, 106, 115 use a variable which is uninitialised. What's the point of this variable anyway? Assuming it's meant to init to 0, wouldn't the conditional if (!a... always equate to True?

CGFloat PRTweenTimingFunctionElasticOut (CGFloat t, CGFloat b, CGFloat c, CGFloat d) {
    CGFloat p = d*.3;
    CGFloat s, a;
    if (t==0) return b;  if ((t/=d)==1) return b+c;
    if (!a || a < ABS(c)) { a=c; s=p/4; }
    else s = p/(2*M_PI) * asin (c/a);
    return (a*pow(2,-10*t) * sin( (t*d-s)*(2*M_PI)/p ) + c + b);
}

Some of Robert Penner's easing equations support additional configuration. Elastic, for example, allows you to specify just how elastic the tween should be (a for amplitude in this case.) PRTween doesn't support this yet, but it's planned for the future.

See issue #10 for more details.