• 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
CoreAnimation - Resizing sublayers along with superlayer animation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreAnimation - Resizing sublayers along with superlayer animation


  • Subject: CoreAnimation - Resizing sublayers along with superlayer animation
  • From: Ignacio Enriquez <email@hidden>
  • Date: Fri, 20 Aug 2010 17:24:52 +0900

Hi,

I have a subclass of CALayer (below self) and it has a sublayer (textLayer).
I want self to be shrank and enlarges, so I created animations like
the following:

CABasicAnimation *fadeInAnimation;
fadeInAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
fadeInAnimation.repeatCount = 1;
fadeInAnimation.autoreverses = NO;
fadeInAnimation.fromValue = [NSNumber numberWithFloat:1.0];
fadeInAnimation.toValue = [NSNumber numberWithFloat:0.0];

CABasicAnimation *shrinkAnimation;
shrinkAnimation = [CABasicAnimation animationWithKeyPath:@"bounds.size"];
shrinkAnimation.repeatCount = 1;
shrinkAnimation.autoreverses = NO;
shrinkAnimation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseIn];
shrinkAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(0, 0)];

aniGroupOFF = [[CAAnimationGroup animation] retain];
aniGroupOFF.delegate = self;
aniGroupOFF.duration = ANI_DURATION;
aniGroupOFF.animations = [NSArray arrayWithObjects:shrinkAnimation,
fadeInAnimation, nil];

then I commit the animation

[self addAnimation:aniGroupOFF forKey:@"shrinkAndFadeOff"];

self is animated as expected but sublayer textLayer is not resized, it
just changes its position according to the new bounds of self

I would like to have the same effect when animation view, they resize
automatically their subviews and/or sublayers

Thanks in advance.

BTW: I tried also:
[self setNeedsDisplayOnBoundsChange:YES];
and overriding
-(void)layoutSublayers{[textLayer setFrame:accordingFrame];}
but didn't work ;(


Ignacio
_______________________________________________

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

  • Follow-Ups:
    • Re: CoreAnimation - Resizing sublayers along with superlayer animation
      • From: Ahsan Shafiq <email@hidden>
    • Re: CoreAnimation - Resizing sublayers along with superlayer animation
      • From: Eric Wing <email@hidden>
  • Prev by Date: decodeObjectForKey without definition
  • Next by Date: [iPhone] How to change Default.png Image Dynamically
  • Previous by thread: Re: decodeObjectForKey without definition
  • Next by thread: Re: CoreAnimation - Resizing sublayers along with superlayer animation
  • Index(es):
    • Date
    • Thread