#176 ✓resolved
Alex J

CPAnimation setAnimationCurve: Can Assign Invalid _animationCurve

Reported by Alex J | December 21st, 2008 @ 08:29 PM | in 0.6.5

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).

Comments and changes to this ticket

  • Alex J

    Alex J December 22nd, 2008 @ 07:52 AM

    Here's a modified version of setAnimationCurve: that resolves #175 and #176:

    
    - (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];
    }
    
  • admin (at 280north)

    admin (at 280north) December 22nd, 2008 @ 02:38 PM

    • State changed from “new” to “resolved”

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

    [#175 state:resolved]. [#176 state:resolved].

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

  • Francisco Tolmasky

    Francisco Tolmasky December 22nd, 2008 @ 02:39 PM

    • Milestone set to 0.6.5
    • Assigned user set to “Francisco Tolmasky”

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Cappuccino Web Framework, including AppKit, Foundation, and Objective-J.

Shared Ticket Bins

People watching this ticket

Referenced by

Pages