Re: Page Curl Transition of Layers
Re: Page Curl Transition of Layers
- Subject: Re: Page Curl Transition of Layers
- From: Matt Long <email@hidden>
- Date: Wed, 17 Sep 2008 10:45:56 -0600
I think you need to clarify what you mean by "swapping of layers into
views". The page curl transition works fine in a CALayer. I just set
the transition for the "opacity" key so that whenever opacity gets
changed, the transition between the previous layer opacity and the new
is done with a page curl.
I also tried it by using defaultActionForKey in a CALayer derived
class and it seems to work fine. Here's my code:
+ (id<CAAction>)defaultActionForKey:(NSString *)key;
{
if( [key compare:@"opacity"] == NSOrderedSame )
{
float w = 480.0;
float h = 360.0;
CIVector *extent = [CIVector vectorWithX: 0 Y: 0 Z: w W: h];
NSURL *url;
url = [NSURL fileURLWithPath: [[NSBundle mainBundle]
pathForResource: @"Shading"
ofType: @"tiff"]];
CIImage *shadingImage = [[CIImage alloc]
initWithContentsOfURL: url];
url = [NSURL fileURLWithPath: [[NSBundle mainBundle]
pathForResource: @"Blank"
ofType: @"jpg"]];
CIImage *blankImage = [[CIImage alloc] initWithContentsOfURL:
url];
CIFilter *pageCurlFilter = [CIFilter filterWithName:
@"CIPageCurlTransition"
keysAndValues:
@"inputExtent", extent,
@"inputShadingImage", shadingImage,
@"inputBacksideImage", blankImage,
@"inputAngle",[NSNumber
numberWithFloat: -0.2*M_PI],
@"inputRadius", [NSNumber
numberWithFloat: 70], nil];
CATransition *theTransition=[CATransition animation];
[theTransition setFilter:pageCurlFilter];
[theTransition setDuration:1.0f];
return theTransition;
}
CATransition *theTransition=[CATransition animation];
[theTransition setType:kCATransitionFade];
return theTransition;
}
-Matt
On Sep 16, 2008, at 5:19 PM, Timothy Larkin wrote:
I am working on animating the swapping of layers into views. By
overriding defaultActionForKey for my layer class, I get correct
transitions for all of the transition filters in the standard set,
except for CIPageCurlTransition. Instead of the page curl, I am
seeing a push transition, where the new layer appears at the left of
the view, and moves right until the old layer is fully covered.
I have assigned images to each of the properties that do not have
defaults. I am seeing no errors in the console.
Has anyone made this work, or determined that it doesn't?
Much obliged.
--
Timothy Larkin
Abstract Tools
Caroline, NY
_______________________________________________
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden