• 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: What is the default time for a CALayer transform?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the default time for a CALayer transform?


  • Subject: Re: What is the default time for a CALayer transform?
  • From: Gustavo Pizano <email@hidden>
  • Date: Tue, 16 Dec 2008 15:27:47 +0100

Hello Dimitri.

CAAnimation* rotateAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
rotateAnimation.fromValue = [NSValue valueWithCATransform3D:nLayer.transform];
rotateAnimation.toValue = [NSValue valueWithCATransform3D:transform];

its gives me an error, Error request for member "fromValue" in something not a structure or union.
shouldn't it be CABasicAnimation which has the fromValue and toValue properties.?



On 16.12.2008, at 15:13, Dimitri Bouniol wrote:

-(void)mouseDown:(NSEvent *)event
{
	[event retain];
	[mouseDownEvent  release];
	mouseDownEvent = event;
	NSPoint p2 = [event locationInWindow];
	NSPoint p3 = [self convertPoint:p2 fromView:nil];
	CGPoint p = NSPointToCGPoint(p3);
	CALayer * nLayer = [_gameboardLayer hitTest:p];

	if (nLayer.name != nil) {
		NSLog(@"%@",[nLayer name]);

CATransform3D transform = nLayer.transform;
transform = CATransform3DRotate(transform, M_PI_2, 0, 0, 1.0); // rotate additional 90 degrees


CAAnimation* rotateAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
rotateAnimation.fromValue = [NSValue valueWithCATransform3D:nLayer.transform];
rotateAnimation.toValue = [NSValue valueWithCATransform3D:transform];
rotateAnimation.duration = 0.4;
[rotateAnimation setValue:nLayer forKey:@"rotatedLayer"];
[rotateAnimation setDelegate:self];


[CATransaction begin];
[CATransaction setValue:(id)bCFBooleanTrue forKey:kCATransactionDisableActions];
nLayer.transform = transform; // set the layers "actual" value without the user noticing
[CATransaction commit];


[nLayer addAnimation:rotateAnimation forKey:@"RotationAnimation"]; // set this so it replaces the previous rotation if you click before 0.4 sec

}

}


Hope that works :3 (apologies if I forgot a semicolon or something, i wrote it directly in mail)

On Dec 16, 2008, at 5:54 AM, Gustavo Pizano wrote:

_______________________________________________

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: What is the default time for a CALayer transform?
      • From: Klaus Backert <email@hidden>
References: 
 >What is the default time for a CALayer transform? (From: Gustavo Pizano <email@hidden>)
 >Re: What is the default time for a CALayer transform? (From: Dimitri Bouniol <email@hidden>)
 >Re: What is the default time for a CALayer transform? (From: Gustavo Pizano <email@hidden>)
 >Re: What is the default time for a CALayer transform? (From: Dimitri Bouniol <email@hidden>)

  • Prev by Date: Re: More - Safari Download Security Alerts
  • Next by Date: How to make NSURLConnection send delegate messages during runModalForWindow
  • Previous by thread: Re: What is the default time for a CALayer transform?
  • Next by thread: Re: What is the default time for a CALayer transform?
  • Index(es):
    • Date
    • Thread