I can't speak to the example you mention specifically, but I had tried to scale font sizes this way as well and never got the smooth transition either. Instead I used something like this:

CATransform3D transform = CATransform3DMakeScale(factor, factor, factor);
[mainLayer setTransform:transform];
[mainLayer setOpacity:0.0];

The layer instead gets *scaled* by the factor you specify. It does seem, however, that the properties of the CATextLayer ought to be animatable. Have you tried animating just a single property such as the text foreground color on its own? Will have to check this one out for myself.

I wrote a blog post a while back that shows specifically how to scale layers so they look like they are coming at you out of the screen (I dubbed it the Dashboard Effect). Not sure your desired effect, but you can see the blog post here: http://www.cimgf.com/2008/03/15/core-animation-tutorial-dashboard-effect/

Best regards,

-Matt



On Aug 27, 2008, at 5:46 PM, Rodolfo Niborski wrote:

Hi everyone,

My question is twofold :
In the Core Animation Menu sample (Core Animation Programming Guide) the inclusion of this line of code :
selectedLayer.string = @"new text";
in the -changeSelectedIndex: method results in an animation being triggered : the old text fades out while the new text fades in. The same happens if the fontSize or the foregroundColor properties are modified. In the case of the fontSize, how can one achieve a continuous transition, with the letters themselves becoming bigger and bigger ?

And things happen to be different in my own code : I'm using a CALayoutManager and here is it's main method :

-(void)layoutSublayersOfLayer:(CALayer*) layer
{
 ...

 [CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat: 1.5] forKey: kCATransactionAnimationDuration]; [CATransaction setValue:[NSNumber numberWithBool: NO] forKey: kCATransactionDisableActions];
 int i = 0;
 for(CATextLayer *letter in layer.sublayers)
 {
   letter.bounds = CGRectMake(0.0, 0.0, side, side);
letter.position = CGPointMake(l - side / 2 - (i % a) * side, h - side / 2 - (i / a) * side);
   i++;
   letter.fontSize = side;
   letter.foregroundColor = [self randomColor];
 }
 [CATransaction commit];

 ...
}

While position gets animated, I don't get any animation on text attributes, not even the aforementioned fade in - fade out animation. Does someone know how to get all the properties animated ?

Thanks a lot,

Rodolfo

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to