Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

CPAnimation setAnimationCurve: Can Assign Invalid _animationCurve

#176

Cappuccino version 0.6 (and possibly others). CPAnimation.j: 117 - 137:

If an invalid value is passed to setAnimationCurve:, an Illegal Argument exception is (correctly) raised, but not before the invalid value is assigned to the _animationCurve instance variable. This leaves the CPAnimation in an invalid state.

I believe the solution to this would be to move line 119, _animationCurve = anAnimationCurve;, to after the switch statement that begins on line 123, and change that switch statement to read switch (anAnimationCurve).

Reported by Alex J · December 21st, 2008 @ 08:29 PM

State: resolved
Milestone: 0.6.5
Assigned to: Francisco Tolmasky Francisco Tolmasky

Activity

  1. Alex J
    Alex J

    Here's a modified version of setAnimationCurve: that resolves #175 CPAnimation setAnimationCurve: Rejects CPAnimationLinear and #176 CPAnimation setAnimationCurve: Can Assign Invalid _animationCurve:

    
    - (void)setAnimationCurve:(CPAnimationCurve)anAnimationCurve
    {
        var timingFunctionName;
        
        switch (anAnimationCurve)
        {
            case CPAnimationEaseInOut:  timingFunctionName = kCAMediaTimingFunctionEaseInEaseOut;
                                        break;
                                        
            case CPAnimationEaseIn:     timingFunctionName = kCAMediaTimingFunctionEaseIn;
                                        break;
                                        
            case CPAnimationEaseOut:    timingFunctionName = kCAMediaTimingFunctionEaseOut;
                                        break;
                                        
            case CPAnimationLinear:     timingFunctionName = kCAMediaTimingFunctionLinear;
                                        break;
                                        
            default:                    [CPException raise:CPInvalidArgumentException
                                                    reason:"Invalid value provided for animation curve"];
                                        break;
        }
        
        _animationCurve = anAnimationCurve;
        _timingFunction = [CAMediaTimingFunction functionWithName:timingFunctionName];
    }
    

    December 22nd, 2008 @ 07:52 AM

  2. admin (at 280north)
    admin (at 280north)
    • State changed from new to resolved

    (from [08a3b644838f313edbfb919f6fdc864824194451]) Fix for impropert animationCurve being set.

    [#175 CPAnimation setAnimationCurve: Rejects CPAnimationLinear state:resolved]. [#176 CPAnimation setAnimationCurve: Can Assign Invalid _animationCurve state:resolved].

    Reviewed by me. http://github.com/280north/cappu...

    December 22nd, 2008 @ 02:38 PM

  3. Francisco Tolmasky
    Francisco Tolmasky
    • Milestone set to 0.6.5
    • Assigned user set to Francisco Tolmasky

    December 22nd, 2008 @ 02:39 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.