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

Re: CoreAnimation - Resizing sublayers along with superlayer animation


  • Subject: Re: CoreAnimation - Resizing sublayers along with superlayer animation
  • From: Ahsan Shafiq <email@hidden>
  • Date: Sat, 21 Aug 2010 05:46:56 -0430

Hi
You can use scale, but if you also want to detect touches on these layers
you have to update the model as well which is nearly impossible to do if you
are doing scalling.
But apart from this scaling will work just fine.

On Fri, Aug 20, 2010 at 3:54 AM, Ignacio Enriquez <email@hidden> wrote:

> 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
>
_______________________________________________

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

References: 
 >CoreAnimation - Resizing sublayers along with superlayer animation (From: Ignacio Enriquez <email@hidden>)

  • Prev by Date: Re: Core Animation. issue with scaling
  • Next by Date: Re: [iPhone] How to change Default.png Image Dynamically
  • Previous by thread: Re: CoreAnimation - Resizing sublayers along with superlayer animation
  • Next by thread: [iPhone] How to change Default.png Image Dynamically
  • Index(es):
    • Date
    • Thread