Core Animation faulty behaviour?
Core Animation faulty behaviour?
- Subject: Core Animation faulty behaviour?
- From: Boris Prohaska <email@hidden>
- Date: Tue, 26 May 2009 15:56:00 +0200
Hi guys... i'm new to Core Animation. What i want is a simple dissolve
between two images. In the Code below you can see what i'm doing.
//self = a NSButton subclass
recordButton = [CALayer layer];
[self setWantsLayer:YES];
[self.layer addSublayer:recordButton];
//init the Dissolve filter
CIFilter* filter = [CIFilter filterWithName:@"CIDissolveTransition"];
[filter setDefaults];
//load my 2 images
[filter setValue:[CIImage imageWithContentsOfURL:[NSURL
fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"button_record_low" ofType:@"png"]]]
forKey:kCIInputImageKey];
[filter setValue:[CIImage imageWithContentsOfURL:[NSURL
fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"button_record_high" ofType:@"png"]]]
forKey:kCIInputTargetImageKey];
[filter setName:@"pulse"];
//set the filters to the button
[recordButton setFilters:[NSArray arrayWithObject:filter]];
//setup an animation
CABasicAnimation* pulseAnimation = [CABasicAnimation animation];
//manipulate the inputtime
pulseAnimation.keyPath = @"filters.pulse.inputTime";
//we go the whole way...
pulseAnimation.fromValue = [NSNumber numberWithFloat:0.];
pulseAnimation.toValue = [NSNumber numberWithFloat:1.];
//..for one second
pulseAnimation.duration = 1.;
//..indefinitly
pulseAnimation.repeatCount = 1e100f;
//we want, that it revereses..
pulseAnimation.autoreverses = YES;
//set the timingfunction we want..
pulseAnimation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
//start the animation.
[recordButton addAnimation:pulseAnimation forKey:@"pulseAnimation"];
What i expect is, that the dissolve will go from "button_record_low"
to "button_record_high". What i get is that it goes from "nothing" to
"button_record_high". What am i doing wrong?
Thanks in advance
Boris
_______________________________________________
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