Skip to content

Commit 8a688e1

Browse files
author
Lorenzo Manfredi
committed
Fixing Curl
Fixing minor issues in PSPage class Signed-off-by: Lorenzo Manfredi <[email protected]>
1 parent bb41bc7 commit 8a688e1

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

PaperStackDemo/Vendor/PaperStack/PSKonstants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#define kPSPagePaddingRatio 0.015
1313
#define kPSPageSideRatio 0.04
14+
#define kPSPageTimeCorrection 0.9
1415

1516
#define kPSPageAnimationFriction 0.18
1617
#define kPSPageAnimationThreshold 0.005

PaperStackDemo/Vendor/PaperStack/PSPage.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import <OpenGLES/ES1/gl.h>
1212
#import <OpenGLES/ES1/glext.h>
1313
#import "PSDrawings.h"
14+
#import "PSKonstants.h"
1415

1516
@interface PSPage ()
1617

@@ -214,12 +215,19 @@ - (void)deformForTime:(CGFloat)t
214215

215216
- (void)deform
216217
{
217-
CGFloat time = PSDistance( SP, P ) * 0.9;
218+
CGFloat time = fabs( PSVector(SP, P).x ) * kPSPageTimeCorrection; // iOS 5 Curl style
219+
// CGFloat time = PSDistance( SP, P ) * kPSPageTimeCorrection; // iBooks Curl style
218220
CGFloat angle = roundf( ( ( PSAngle( SP, P ) + 0.00001 ) * ( P.y > SP.y ? 1.0 : -1.0 ) + 0.00001 ) * 1000.0f ) / 1000.0f;
219221
CGFloat side = angle >= 0 ? 1.0 : -1.0;
220222
BOOL upsideFlag = angle < 0;
221223
CGFloat upside = upsideFlag ? 1.0 : -1.0;
224+
225+
if ( ( !hasReverseCurl && P.x < 0.0 ) || ( hasReverseCurl && P.x > 0.0 ) ) {
226+
time = kPSPageTimeCorrection - time;
227+
}
222228

229+
NSLog(@"Time:%f",time);
230+
223231
// interpolate cone base
224232
CGFloat RB = fmax( height/columns, ( time / M_PI ) );
225233

PaperStackDemo/Vendor/PaperStack/PSPageView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ - (id)initWithFrame:(CGRect)frame
5353

5454
// content view
5555
UIView *cView = [[UIView alloc] initWithFrame:self.bounds];
56-
cView.backgroundColor = [UIColor yellowColor];
56+
cView.backgroundColor = [UIColor whiteColor];
5757
[self addSubview:cView];
5858
self.contentView = cView;
5959
[cView release];

0 commit comments

Comments
 (0)