• 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: Core Animation. issue with scaling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Animation. issue with scaling


  • Subject: Re: Core Animation. issue with scaling
  • From: Ahsan Shafiq <email@hidden>
  • Date: Sat, 21 Aug 2010 00:30:32 +0600

bump*

On Thu, Aug 19, 2010 at 10:47 AM, Ahsan Shafiq <email@hidden>wrote:

> Hi
> I have read that in explicit animation, say translation, to really change
> the model layer position we have to change it's position too. So here is my
> code:
>
> CABasicAnimation *animation =
>                  [CABasicAnimation animationWithKeyPath:@"position"];
>                  CGPoint pt = CGPointMake(firstWheelLayer.position.x + 100,
> firstWheelLayer.position.y + 100);
>                  [animation setFromValue:[NSNumber
> valueWithCGPoint:firstWheelLayer.position]];
>                  [animation setToValue:[NSNumber valueWithCGPoint:pt]];
>                  [animation setDuration:5.0];
>                  [firstWheelLayer setPosition:pt];
>                  [firstWheelLayer addAnimation:animation forKey:@"flag"];
>
>
> "firstWheelLayer" is a layer with some sublayers. The above code is run as
> result of touch on sublayers of "firstWheelLayer". The above code works
> fine, even all sublayers translate also and if I click a sublayer after
> animation , the "firstWheelLayer" further translate 100 in x and 100 in y.
> I want to achieve same functionality with scaling i.e. if I scale
> "firstWheelLayer" all sublayers should also scale up/down. So here is my
> code:
>
> CABasicAnimation *animation =
>                  [CABasicAnimation animationWithKeyPath:@"bounds"];
>                 CGRect orgVal = CGRectMake(0, 0,
> firstWheelLayer.bounds.size.width, firstWheelLayer.bounds.size.height);
>                 CGRect newVal = CGRectMake(0, 0,
> firstWheelLayer.bounds.size.width+100, firstWheelLayer.bounds.size.height);
>
>                  [animation setFromValue:[NSValue valueWithCGRect:orgVal]];
>                  [animation setToValue:[NSValue valueWithCGRect:newVal]];
>                  [animation setDuration:5.0];
>                  [firstWheelLayer setBounds:newVal];
>                  [firstWheelLayer addAnimation:animation forKey:@"flag"];
>
> The problem here is that the sublayers do not scale horizontaly like the
> "firstWheelLayer" should I set their bounds here too?
>
>
>
_______________________________________________

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: 
 >Core Animation. issue with scaling (From: Ahsan Shafiq <email@hidden>)

  • Prev by Date: Re: Statically link libmysqlclient.a to my Foundation tool
  • Next by Date: Re: Statically link libmysqlclient.a to my Foundation tool
  • Previous by thread: Core Animation. issue with scaling
  • Next by thread: Re: Core Animation. issue with scaling
  • Index(es):
    • Date
    • Thread