-
-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Labels
Description
While using RBBSpringAnimation I noticed that movement was quite jerky in the initial phases of the spring animation.
To combat this I increased the "sampling rate" specified in RBBAnimation's values method from 60 to 120. Eg:
- (NSArray *)values {
RBBAnimationBlock block = [self.animationBlock copy];
CFTimeInterval duration = self.duration;
return [RBBBlockBasedArray arrayWithCount:(NSUInteger)(duration * 120) block:^id(NSUInteger idx) {
return block(idx / 120.0f, (CGFloat)duration);
}];
}
The results seem to be smoother animations.
I'm not a math/signal processing whiz but I think this is an example of the Nyquist rate.
Perhaps this could be made a property on RBBSpringAnimation. As in some situations I think 60 would be fine but others a higher value is going to produce smoother results.