0
votes

I have a property float a and I want to interpolate between two values, say float min and float max, over some time interval (float t seconds.)

Core Animation does something very much like this under the covers; can I leverage it for doing non-display work, or is there another library which does this in Cocoa Touch?

I could roll my own using an NSTimer but a) that's hard and b) I thought I'd check to see if there was an existent technique for doing this first.

Thanks

1

1 Answers

2
votes

On the Mac, you've got NSAnimation which makes this pretty easy. NSAnimation isn't on iOS, but really it's a pretty simple class to write yourself. Take a look at NSAnimation's design for some inspiration. Namely, a -(void)setCurrentProgress:(float)progress method that does the work of interpolating and setting the value to be "animated".