0

Is it possible to animate a custom property that doesn't reflect an object in the GUI in Objective-C for Mac OS X?

Specifically, I'm trying to animate the volume property of the CocoaLibSpotify Framework, which is a double, to fade a song out.

I've tried using the CABasicAnimation class to solve the problem but it didn't change the volume property at all.

Here's what I have so far:

CABasicAnimation *fade1 = [CABasicAnimation animationWithKeyPath:@"self.audioController.volume"];
fade1.duration = duration;
[fade1 setFromValue:[NSNumber numberWithDouble:1.0];
[fade1 setToValue:[NSNumber numberWithDouble:0.0];
Leo Bernard
  • 174
  • 1
  • 9
  • See http://stackoverflow.com/questions/14192816/create-a-custom-animatable-property – Matteo Pacini Jan 01 '15 at 16:28
  • Yes you can, and this is a reasonable thing to do. Please watch WWDC 2014 video 221 which has an excellent discussion of this topic. I also have sample code (though it happens that my example _is_ reflected in the GUI). – matt Jan 01 '15 at 16:37

0 Answers0