Reputation: 1074
I'm trying to find a way to animate 3D rotating of UIView. I want it looks like animation of push notification if you select "Banner" style. I'm trying to use something like
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform"];
CATransform3D t = CATransform3DIdentity;
t = CATransform3DTranslate(t, 0, -self.bounds.size.height/2, 0);
t = CATransform3DRotate(t, M_PI_2, 1, 0, 0);
t = CATransform3DTranslate(t, 0, -self.bounds.size.height/2, 0);
[anim setFromValue:[NSValue valueWithCATransform3D:CATransform3DIdentity]];
[anim setToValue:[NSValue valueWithCATransform3D:t]];
anim.removedOnCompletion = NO;
[anim setDuration:0.25];
anim.fillMode = kCAFillModeForwards;
anim.delegate = self;
[self.layer addAnimation:anim forKey:@"Rotation"];
But this looks flat and not so realistic 3D as an banners of push notifications. How can I make this animation more realistic?
Upvotes: 0
Views: 1306
Reputation: 56
You may want to take a deep look at how CMNavBarNotificationView is implemented.
Plus, there are different types of CALayer, and you might want to pick a desired one from +(Class)layerClass
of your animated view. It seems me that you're sticking with plain CALayer.
Upvotes: 2