• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Semi-transparent offscreen CALayer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Semi-transparent offscreen CALayer


  • Subject: Semi-transparent offscreen CALayer
  • From: Shaun Larkin <email@hidden>
  • Date: Thu, 28 Aug 2008 07:16:03 -0700 (PDT)

I'm trying to animate a semi-transparent CALayer (opacity 0.8) by sliding it in from offscreen but it only seems to exist is it's opaque:YES is set, essentially negating any transparent effects. I've look through the documentation but haven't found a solution. I had assumed that when the calayer appears in context it would would be rendered.

here is the code ::


// the transparent calayer is a subclass called Menu.m

-(void)drawInContext:(CGContextRef)ctx {
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextClearRect(ctx, rect);
    CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
    CGFloat col[4] = {0,0,0,0.5};
    CGColorRef colr = CGColorCreate(space, col);
    CGColorSpaceRelease(space);
    CGContextSetFillColorWithColor(ctx, colr);
    CGColorRelease(colr);
    CGContextFillRect(ctx, [self frame]);
}


//in the layer hosting view , this on work if the menu's opaque property is set to YES


        CABasicAnimation * b = [CABasicAnimation animationWithKeyPath:@"position.y"];
        b.duration = 0.4f;
        b.fromValue = [NSNumber numberWithFloat:menu.frame.origin.y];
        b.toValue = [NSNumber numberWithFloat:360.0];
        b.timingFunction  = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
        b.removedOnCompletion = NO;
        b.fillMode = kCAFillModeForwards;
        [menu addAnimation:b forKey:@"slideIn"];


thanks in advance!


_________________________________

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



      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
_______________________________________________

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

  • Prev by Date: Re: mark added object in NSArrayController as "dirty"?
  • Next by Date: Re: CFBundleIconFile: heiß or hot?
  • Previous by thread: Seeking UI designer
  • Next by thread: Re: Semi-transparent offscreen CALayer
  • Index(es):
    • Date
    • Thread