• 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
Flip and Enlarge CALayer at the same time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Flip and Enlarge CALayer at the same time


  • Subject: Flip and Enlarge CALayer at the same time
  • From: Gustavo Pizano <email@hidden>
  • Date: Tue, 22 Jun 2010 15:36:23 +0200

Hello, Im trying to recreate a flip-n-scale of a CALayer, pretty much the same as in iPhoto when you click the info of a event, it will flipt and enlarge a layer, but the back side of the layer its another view.
So this is what I have so far base on the GameGeek board game example from apple.

- (void) setFaceUp: (BOOL)up
{
    if( up != _faceUp ) {
        // The Card has separate sub-layers for its front and back. At any time, one of them
        // is hidden, by having a 180 degree rotation about the Y axis.
        // To flip the card, both front and back layers are flipped over.
        CATransform3D xform;
        xform = up ?kFaceUpTransform :kFaceDownTransform;
        CABasicAnimation * flipAnim  = [CABasicAnimation animationWithKeyPath:@"transform"];

		flipAnim.toValue = [NSValue valueWithCATransform3D:xform];
		flipAnim.duration = 0.5f;
		flipAnim.cumulative = NO;
		flipAnim.removedOnCompletion = NO;
		flipAnim.autoreverses = NO;
		flipAnim.fillMode = kCAFillModeForwards;
		//_front.transform = xform;
        [_front addAnimation:flipAnim forKey:@"flipAnimFront"];
        xform = up ?kFaceDownTransform :kFaceUpTransform;
		flipAnim.toValue = [NSValue valueWithCATransform3D:xform];
		//_back.transform = xform;
		[_back addAnimation:flipAnim forKey:@"flipAnimBack"];
        _faceUp = up;
    }
}

when I click my info button the layer its flipped correctly and at the end I end up p whit the front CALayer being shown.
I was trying then to add the "scaling" animation by adding a CAKeyAnimation with the values and times, then add the flipAnimation and the keyAnimation into a group and add it to the layer...but  unfortunately id doesn't work.  I see it flipped and once flips one face of the layer then it display nothing.

My guesses..:

I have this structure:  CALayer with 2 CALayers ivars, (_front and _back), so right now its working the flipping from _front to back,  so I guess this is not working because Im not setting the frame animation to the parent layer,  which at the end its the one  it should resize.

Im sorry Im kinda confused here, so any help will be gladly appreciate it.

thx

Gustavo



_______________________________________________

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: Flip and Enlarge CALayer at the same time
      • From: Gustavo Pizano <email@hidden>
  • Prev by Date: Incomplete rendering returned from glReadPixels
  • Next by Date: Re: Flip and Enlarge CALayer at the same time
  • Previous by thread: Re: Incomplete rendering returned from glReadPixels
  • Next by thread: Re: Flip and Enlarge CALayer at the same time
  • Index(es):
    • Date
    • Thread