Give your view class a property which represents what you want to animate about the gradient. The property should be of float, double, NSPoint, NSSize, or NSRect type. In the setter of your property, in addition to recording the new value in an instance variable, have the view mark itself as needing display. Be sure to use the property value as appropriate in your -drawRect: method to affect how the gradient draws itself.
Then, override +defaultAnimationForKey:, which NSView gets from the NSAnimatablePropertyContainer protocol, to return an animation for that property. The docs for +defaultAnimationForKey: give an example implementation.
Then, you can do "yourView.animator.yourProperty = newValue" somewhere and the view will animate the change of the property.