I was playing with my NSView and CATextLayer.
I placed this code:

-(void)mouseDown:(NSEvent *)theEvent
{
        
        NSPoint p = [theEvent locationInWindow];
        
        CATextLayer *textLayer=[CATextLayer layer];
        textLayer.string=[arr objectAtIndex: (random() % [arr count])];
        textLayer.font=@"Georgia";
        textLayer.fontSize = 72.0;

        int hue = random() % 100;
        float hueAfter=hue;
textLayer.foregroundColor=[NSColor colorWithCalibratedHue:hueAfter/ 100 saturation:1 brightness:0.9 alpha:1];
                                                                                
                                        
[textLayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMinX
                                                relativeTo:@"superlayer"
                                                attribute:kCAConstraintMinX
                                                offset:p.x-15]];
[textLayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMinY
                                                relativeTo:@"superlayer"
                                                attribute:kCAConstraintMinY
                                                offset:p.y-35]];
        
        [rootLayer addSublayer:textLayer];
}

what ive noticed is when I click,the text appear with a fadein.
Any reason of this behaviour?

_______________________________________________

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