[solved] Re: Setting AnimationCurve for implicit animations
[solved] Re: Setting AnimationCurve for implicit animations
- Subject: [solved] Re: Setting AnimationCurve for implicit animations
- From: Joachim Deelen <email@hidden>
- Date: Tue, 30 Oct 2007 23:34:06 +0100
Hi Again,
I solved the problem myself:
The "scrollPoint" of CATextLayer does nothing more than modifying the
"bounds" of itself or more exactly the origin: Thereby the "bounds"
Property-KVO gets triggered. So all I had to do, is setting up an
animation for the "bounds" property of CAScrollLayer with the right
CAMediaTimingFunction.
Now the code looks like this:
CAMediaTimingFunction *timing = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionLinear];
CABasicAnimation *animation = [CABasicAnimation
animationWithKeyPath:@"bounds"];
animation.duration = ((NSWidth([textView bounds])-NSWidth([self
bounds]))/2)*0.10f;
animation.timingFunction = timing;
[scrollLayer addAnimation:animation forKey:@"boundsAnimation"];
[textLayer scrollPoint:NSMakePoint((NSWidth([textView bounds])-
NSWidth([self bounds])), 0.0)];
regards
Joachim
Am 30.10.2007 um 22:21 schrieb Joachim Deelen:
Hi List,
does anybody know, if it's possible, to change the AnimationCurve of
an implicit Animation. I know I can create a CAAnimation an set an
CAMediaTimingFunction into it but how do I get the Animation Object
for an implicit animation which is not a property?
An Example for this, is the CAScrollLayer with its Method
"scrollToPoint". This is perfectly animated but always uses Ease
In / Ease out as the animation curve, but I want it to be linear.
I get a smooth scrolling effect with just a few lines of code:
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:
((NSWidth([textView bounds])-NSWidth([self bounds]))/2)*0.10f]
forKey:kCATransactionAnimationDuration];
[textLayer scrollPoint:NSMakePoint((NSWidth([textView bounds])-
NSWidth([self bounds])), 0.0)];
[CATransaction commit];
The "textLayer" of Type CATextLayer, is included within a
CAScrollLayer. As I said before, scrolling is fine but with the
wrong curve. How can I get the animation Object that is responsible
for the Animation of "scrollPoint" to set its "timming" Property?
Any Ideas?
regards
Joachim
_______________________________________________
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
_______________________________________________
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