Created
June 30, 2014 02:34
-
-
Save bleeckerj/e37d1f511361a4857e19 to your computer and use it in GitHub Desktop.
Gist for CATransform3D for iCarousel to give a "deck of cards" style transformation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform | |
{ | |
if (offset > 0) | |
{ | |
//move back | |
transform = CATransform3DTranslate(transform, 0, 0, -50 * offset); | |
} | |
else | |
{ | |
//flip around | |
transform = CATransform3DTranslate(transform, 250 * sin(MIN(1, -offset) * M_PI), 0, 100 * offset); | |
} | |
return transform; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment