• 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: How to (slowly) rotate a view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to (slowly) rotate a view


  • Subject: Re: How to (slowly) rotate a view
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Mon, 06 Aug 2012 01:43:12 +0700

On 6 Aug 2012, at 01:01, Kyle Sluder wrote:

> On Aug 5, 2012, at 10:34 AM, "Gerriet M. Denkmann" <email@hidden> wrote:
>
>> I tried instead:
>>   //    opacity is 0.5
>>   [ CATransaction begin];
>>   [ CATransaction setAnimationDuration: 9 ];
>>   layer.opacity = 1;
>>   [ CATransaction commit];
>>
>>   [ CATransaction begin];
>>   [ CATransaction setAnimationDuration: 9 ];
>>   layer.opacity = 0.5;
>>   [ CATransaction commit];
>> but I only see the resulting opacity of 0.5.
>>
>> The view controller is a child of another view controller. The view is subview of another view.
>
> Any reason you're animating the layer properties instead of the view properties? UIView exposes transform and opacity, and has its own animation methods.
No reason at all.

But I tried self.view.alpha instead of layer.opacity and did not see anything changing either.


Now this code seems to be working:

	CALayer *layer = self.view.layer;
	if ( animated )
	{
		CABasicAnimation *thAnimation = [ CABasicAnimation animationWithKeyPath: @"transform" ];
		thAnimation.duration = 0.3;

		CATransform3D oldTrans = layer.transform;
		thAnimation.fromValue = [ NSValue valueWithCATransform3D: oldTrans ];

		CATransform3D newTrans = CATransform3DMakeAffineTransform (m);
		thAnimation.toValue = [ NSValue valueWithCATransform3D: newTrans ];

		[ layer addAnimation: thAnimation forKey: @"rotateSlowly" ];
	};

	[ layer setAffineTransform: m ];


Gerriet.


_______________________________________________

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: 
 >How to (slowly) rotate a view (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: How to (slowly) rotate a view (From: Kyle Sluder <email@hidden>)
 >Re: How to (slowly) rotate a view (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: How to (slowly) rotate a view (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: How to (slowly) rotate a view
  • Next by Date: Re: How to (slowly) rotate a view
  • Previous by thread: Re: How to (slowly) rotate a view
  • Next by thread: RE: How to (slowly) rotate a view
  • Index(es):
    • Date
    • Thread