NSAnimation won’t let me animate NSColor changes. How do I do this?
NSAnimation won’t let me animate NSColor changes. How do I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
blendedColorWithFraction:ofColor:. In your animation method (whichever method is handling the animation’s current value [if you don’t have one, simply make one]):Edit:
What you can do is create a subclass of
NSAnimation. Your subclass just needs to override thesetCurrentProgress:method to determine how far along the animation you are. You can configure the rest of the animation exactly the same way. The protocol may be overkill in this scenario but it gives your subclassed animation a dedicated way to give theNSColorback to the class instance that created the animation.In your other code: