Re: View animator, how to do explicit animations / animation groups?
Re: View animator, how to do explicit animations / animation groups?
- Subject: Re: View animator, how to do explicit animations / animation groups?
- From: Matt Long <email@hidden>
- Date: Wed, 3 Sep 2008 09:06:44 -0600
Are you trying to remove views or animations? Animations are removed
from a layer by default which can be overridden in the
removedOnCompletion property (in CAAnimation) in an explicit animation.
If you're trying to remove views, however, your code is wrong. You
need to find the view you want to remove and remove it from its
superview by calling -(void)removeFromSuperview.
Removing an animation does nothing to the view itself as far as I
know. Also, why do you need to remove the view if it's not visible any
longer? You can do that, but just make sure to retain it after calling
removeFromSuperview if you want to add it again later.
-Matt
On Sep 3, 2008, at 4:41 AM, Thomas Engelmeier wrote:
Hi,
I feel I'm probably missing a few basic concepts of view animations.
Currently I have a bunch of subviews arranged in something like a
custom collection view. I want to animated a movement to a different
position and when that's done, remove invisible ones.
The straightforward way of animating works, it is pretty similar to
the AnimatingViews sample:
for( NSView *aView in views )
{
[[aView animator] setAnimations:nil];
NSPoint origin = [aView frame].origin;
origin.y += offset;
[[aView animator] setFrameOrigin:origin];
}
Now I try to get the removing part - it looks like explicit
animations with animation delegate allow removing the views once
the animation completes.
However, the following and obvious variants have no visible result:
for( NSView *aView in views )
{
[[aView animator] setAnimations:nil];
CABasicAnimation *animation = [aView
animationForKey:@"frameOrigin"]; // returns for all vies the same
animation!?!
NSPoint origin = [aView frame].origin;
origin.y += offset;
animation.toValue = [NSValue valueWithPoint:origin]; // setting
fromValue makes no difference
[[aView animator] setAnimations:[NSArray
arrayWithObject:animation]]; // no effect on the view
}
What am I missing?
_______________________________________________
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