Skip to content
Browse files

added note about edge antialiasing, perspective set as configurable p…

…roperty
  • Loading branch information...
1 parent a0114d6 commit 5049970c65abab9bea000362cd01ab47caae1136 @Dillion committed Feb 8, 2012
View
5 README.md
@@ -30,6 +30,8 @@ Supports different types of content:
4. Call `[flipView printText: usingImage: backgroundColor: textColor:]` to draw each frame (minimum of 2)
5. Call `[animationDelegate startAnimation:]` to start the animation. For using buttons or pan gesture, look at the animation controller example
+
+Note: To remove jagged edges during flipping, set __Renders with edge antialiasing__ in the project plist to YES. This may decrease performance.
###Configurable Properties
@@ -39,7 +41,8 @@ Supports different types of content:
- __shadow__: Whether or not to display shadow
- __repeat__: Whether or not to loop through animation frames (only for _auto interaction mode_)
- __sensitivity__: Positive modifier for input to animation response. Higher the sensitivity, greater the response. (only for _controlled interaction mode_)
- - __gravity__: Positive modifier for speed of movement to nearest resting state after input is removed. Higher the gravity, faster the speed. (only for _controlled interaction mode_)
+ - __gravity__: Positive modifier for speed of movement to nearest resting state after input is removed. Higher the gravity, faster the speed. (only for _controlled interaction mode_)
+ - __perspectiveDepth__: Positive value for adjusting the perspective. Lower the value, greater the illusion of depth.
- __nextDuration__: duration of the next flip animation
####FlipView
View
BIN ...proj/project.xcworkspace/xcuserdata/dilliontan.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
View
2 transform/AnimationViewController.m
@@ -94,6 +94,7 @@ - (void)viewDidLoad
animationDelegate = [[AnimationDelegate alloc] initWithSequenceType:kSequenceAuto
directionType:kDirectionForward];
animationDelegate.controller = self;
+ animationDelegate.perspectiveDepth = 200;
self.flipView = [[FlipView alloc] initWithAnimationType:kAnimationFlipVertical
animationDelegate:animationDelegate
@@ -163,6 +164,7 @@ - (void)viewDidLoad
animationDelegate2 = [[AnimationDelegate alloc] initWithSequenceType:kSequenceControlled
directionType:kDirectionForward];
animationDelegate2.controller = self;
+ animationDelegate2.perspectiveDepth = 2000;
self.flipView2 = [[FlipView alloc] initWithAnimationType:kAnimationFlipHorizontal
animationDelegate:animationDelegate2
View
2 transform/framework/AnimationDelegate.h
@@ -82,6 +82,8 @@ typedef enum {
@property (nonatomic) BOOL animationLock;
// shadow layers are created during frame initialization, this setting determines whether or not to animate them
@property (nonatomic) BOOL shadow;
+// positive value for adjusting the perspective. Lower the value, greater the illusion of depth. Generally ranges between 200 to 2000
+@property (nonatomic) int perspectiveDepth;
/* properties for kSequenceAuto */
// repeatDelay is the length of time to the next animation in kSequenceAuto after the cleanup from the last animation completes
View
14 transform/framework/AnimationDelegate.m
@@ -54,6 +54,7 @@ @implementation AnimationDelegate
@synthesize repeat;
@synthesize sensitivity;
@synthesize gravity;
+@synthesize perspectiveDepth;
- (id)initWithSequenceType:(SequenceType)aType
directionType:(DirectionType)aDirection
@@ -73,6 +74,7 @@ - (id)initWithSequenceType:(SequenceType)aType
repeatDelay = 0.2;
sensitivity = 40;
gravity = 2;
+ perspectiveDepth = 500;
shadow = YES;
if (sequenceType == kSequenceAuto) {
@@ -195,8 +197,7 @@ - (void)endStateWithSpeed:(float)aVelocity
CALayer *targetShadowLayer;
CATransform3D aTransform = CATransform3DIdentity;
- float zDistance = 850;
- aTransform.m34 = 1.0 / -zDistance;
+ aTransform.m34 = 1.0 / -perspectiveDepth;
[targetLayer setValue:[NSValue valueWithCATransform3D:CATransform3DRotate(aTransform,rotationAfterDirection/10.0 * value, aX, aY, aZ)] forKeyPath:@"transform"];
for (CALayer *layer in targetLayer.sublayers) {
[layer removeAllAnimations];
@@ -463,8 +464,7 @@ - (void)setTransformValue:(float)aValue delegating:(BOOL)bValue
[CATransaction setDisableActions:YES];
CATransform3D aTransform = CATransform3DIdentity;
- float zDistance = 850;
- aTransform.m34 = 1.0 / -zDistance;
+ aTransform.m34 = 1.0 / -perspectiveDepth;
[targetLayer setValue:[NSValue valueWithCATransform3D:CATransform3DRotate(aTransform, rotationAfterDirection/10.0 * value, aX, aY, aZ)] forKeyPath:@"transform"];
targetShadowLayer.opacity = oldOpacityValue;
if (targetShadowLayer2) targetShadowLayer2.opacity = oldOpacityValue;
@@ -478,8 +478,7 @@ - (void)setTransformValue:(float)aValue delegating:(BOOL)bValue
if (adjustedValue != value) {
CATransform3D aTransform = CATransform3DIdentity;
- float zDistance = 400;
- aTransform.m34 = 1.0 / -zDistance;
+ aTransform.m34 = 1.0 / -perspectiveDepth;
targetLayer.sublayerTransform = aTransform;
if (transitionImageBackup == nil) { //transition has begun, copy the layer content for the reverse layer
@@ -547,8 +546,7 @@ - (void)setTransformProgress:(float)startTransformValue
//NSLog(@"transform value %f, %f", startTransformValue, endTransformValue);
CATransform3D aTransform = CATransform3DIdentity;
- float zDistance = 850;
- aTransform.m34 = 1.0 / -zDistance;
+ aTransform.m34 = 1.0 / -perspectiveDepth;
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform"];
anim.duration = duration;
View
2 transform/transform-Info.plist
@@ -34,5 +34,7 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
+ <key>UIViewEdgeAntialiasing</key>
+ <true/>
</dict>
</plist>

0 comments on commit 5049970

Please sign in to comment.
Something went wrong with that request. Please try again.