Commit a505c6e2 authored by Felix Paul Kühne's avatar Felix Paul Kühne

CAAnimation: add a softer wiggle mode needed for long items

(cherry picked from commit 56cabbe4)
parent c77d02d2
......@@ -174,7 +174,7 @@
UITableViewCell *focusedCell = [self.previouslyPlayedStreamsTableView cellForRowAtIndexPath:self.currentlyFocusedIndexPath];
if (editing) {
[focusedCell.layer addAnimation:[CAAnimation vlc_wiggleAnimation]
[focusedCell.layer addAnimation:[CAAnimation vlc_wiggleAnimationwithSoftMode:YES]
forKey:VLCWiggleAnimationKey];
} else {
[focusedCell.layer removeAnimationForKey:VLCWiggleAnimationKey];
......
......@@ -238,7 +238,7 @@
UICollectionViewCell *focusedCell = [self.cachedMediaCollectionView cellForItemAtIndexPath:self.currentlyFocusedIndexPath];
if (editing) {
[focusedCell.layer addAnimation:[CAAnimation vlc_wiggleAnimation]
[focusedCell.layer addAnimation:[CAAnimation vlc_wiggleAnimationwithSoftMode:NO]
forKey:VLCWiggleAnimationKey];
} else {
[focusedCell.layer removeAnimationForKey:VLCWiggleAnimationKey];
......
......@@ -14,5 +14,5 @@
static NSString *const VLCWiggleAnimationKey = @"VLCWiggleAnimation";
@interface CAAnimation (VLCWiggle)
+ (instancetype)vlc_wiggleAnimation;
+ (instancetype)vlc_wiggleAnimationwithSoftMode:(BOOL)softmode;
@end
......@@ -12,7 +12,7 @@
#import "CAAnimation+VLCWiggle.h"
@implementation CAAnimation (VLCWiggle)
+ (instancetype)vlc_wiggleAnimation
+ (instancetype)vlc_wiggleAnimationwithSoftMode:(BOOL)softmode
{
CAKeyframeAnimation *position = [CAKeyframeAnimation animation];
position.keyPath = @"position";
......@@ -32,12 +32,21 @@
CAKeyframeAnimation *rotation = [CAKeyframeAnimation animation];
rotation.keyPath = @"transform.rotation";
rotation.values = @[
@0,
@0.03,
@0,
[NSNumber numberWithFloat:-0.02]
];
if (softmode) {
rotation.values = @[
@0,
@0.005,
@0,
[NSNumber numberWithFloat:-0.004]
];
} else {
rotation.values = @[
@0,
@0.03,
@0,
[NSNumber numberWithFloat:-0.02]
];
}
rotation.timingFunctions = @[
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment