No, only fade out (and fade in) effects are needed. I just added frame movement to see if animation works at all. Animation does work, but the fade does not happen - no matter, if the frame is moved simultaneously or not.
2011/5/20 Gustavo Pizano <gustavxcodepic...@gmail.com>: > So you want to move an object then fade it out right? > > > AFAIK NSViewAnimation its for simply animations, triggering other animations > after a previous one has completed may not work with this. > > > What about using CABasicAnimation instead and call the delegate methods when > it stops to trigger the fade out? > > using CAAnimation requires to apply it to the view's layer. > > > > > On May 19, 2011, at 11:24 PM, Chase Latta wrote: > >> What about using a timer. Something like this: >> >> - (IBAction)fadeOut:(id)sender; >> { >> [[NSAnimationContext currentContext] setDuration:5.0]; >> [[self.myView animator] setAlphaValue:0.0]; >> [NSTimer scheduledTimerWithTimeInterval:5.0 target:self >> selector:@selector(toggleMyViewState:) userInfo:nil repeats:NO]; >> } >> >> - (IBAction)fadeIn:(id)sender; >> { >> [self toggleMyViewState:nil]; >> [[NSAnimationContext currentContext] setDuration:5.0]; >> [[self.myView animator] setAlphaValue:1.0]; >> } >> >> - (void)toggleMyViewState:(NSTimer *)timer; >> { >> if ([self.myView isHidden]) { >> [self.myView setAlphaValue:0.0]; >> [self.myView setHidden:NO]; >> } else >> [self.myView setHidden:YES]; >> } >> >> I did a quick test where I have a window with its view set to have a >> core animation layer in IB and a custom view that does nothing but >> draw itself blue and add a button as a subview. >> >> When I tell it to fade out the view and the button fade but the button >> still works. When the animation is finished the button does not work >> and is not visible. When I fade in the button and the view fade into >> view and the button works during the animation process. >> >> Chase >> >> On Thu, May 19, 2011 at 2:03 PM, Nick <eveningn...@gmail.com> wrote: >>> I only added this "NSViewAnimationEndFrameKey" just to make sure that >>> any animation happens at all. Yeah it does happen. But the button >>> just does not fade out - with or without this >>> NSViewAnimationEndFrameKey. It waits for 5.0 seconds (as i specified) >>> and suddenly disappear. It just feels like i ran into one of the >>> "bugs". Or maybe i am doing something wrong.. >>> This method >>> >>> -(IBAction)clickMeButton:(id)sender { >>> NSLog(@"started"); >>> NSViewAnimation *viewAnimation = [[NSViewAnimation alloc] >>> initWithViewAnimations: >>> >>> [NSArray arrayWithObjects: >>> >>> [NSDictionary dictionaryWithObjectsAndKeys: >>> >>> sender,NSViewAnimationTargetKey, >>> >>> NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, >>> >>> nil], >>> >>> nil]]; >>> >>> [viewAnimation setDuration:5.0]; >>> [viewAnimation startAnimation]; >>> NSLog(@"ended"); >>> } >>> >>> behaves as i just described. >>> >>> 2011/5/19 Quincey Morris <quinceymor...@earthlink.net>: >>>> On May 19, 2011, at 13:14, Nick wrote: >>>> >>>>> Weirdly enough, this does not work: >>>>> NSLog(@"started"); >>>>> NSViewAnimation *viewAnimation = [[NSViewAnimation alloc] >>>>> initWithViewAnimations: >>>>> >>>>> [NSArray arrayWithObjects: >>>>> >>>>> [NSDictionary dictionaryWithObjectsAndKeys: >>>>> >>>>> sender,NSViewAnimationTargetKey, >>>>> >>>>> NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, >>>>> >>>>> [NSValue valueWithRect:NSMakeRect(200, 200, 200, 200)], >>>>> >>>>> NSViewAnimationEndFrameKey, >>>>> >>>>> nil], >>>>> >>>>> nil]]; >>>>> >>>>> [viewAnimation setDuration:5.0]; >>>>> [viewAnimation startAnimation]; >>>>> NSLog(@"ended"); >>>>> >>>>> the button moves, but it does not fade out. It just disappears from >>>>> its final location and after a while appears in the middle of the >>>>> parent View. >>>> >>>> You need to experiment with the parameters till you find a combination >>>> that gives the visual effect you expect. >>>> >>>> IIRC, the documentation is a little confusing because it leads you to >>>> believe that specifying a new frame rect is orthogonal to the fade. In >>>> fact, I seem to recall, specifying a frame rect indicates that you want >>>> the view to be visible at that size and position, and thus conflicts with >>>> the fade, producing the kind of inconsistent behavior you're seeing. Try >>>> leaving that key out of the dictionary. >>>> >>>> The problem, again IIRC, is that only the alpha can change smoothly, not >>>> the "isHidden" property, which can only be on or off. The "isHidden" >>>> property isn't being animated, just changed at certain points in the >>>> animation. You've asked for it to be both on and off at the end of the >>>> animation, and one of those wins. >>>> >>>> Remember also that NSViewAnimation is a subclass of NSAnimation, so you >>>> should be able to use a delegate (for example) to do what you want at the >>>> end of the animation. >>>> >>>> >>>> >>> _______________________________________________ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> 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: >>> http://lists.apple.com/mailman/options/cocoa-dev/chaselatta%40gmail.com >>> >>> This email sent to chasela...@gmail.com >>> >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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: >> http://lists.apple.com/mailman/options/cocoa-dev/gustavxcodepicora%40gmail.com >> >> This email sent to gustavxcodepic...@gmail.com > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com