> > Thanks, Jonathan. Using Matt Gemmel's idea of making an attached window, I > wrote a class that makes a fat arrow with a blue gradient that looks like the > one you get when you click a menu item after searching in Help. > > Now, I'd like it to be animated, like Apple's fat blue Help arrow, moving > slowly in a little circle. In Matt's code, he moves the attached window by > re-creating it. I could do this brute force, offsetting the frame with > x=cos(wt) and y=sin(wt). > > In the Core Animation Programming Guide > Animatable Properties, it says that > 'position' can be animated, and this has the effect of animating the frame. > I've never used Core Animation. Is Core Animation the tool for this job or > should I use my brute force?
I shake an authentication window on failure using the following CA code. NSWindowController subclass // shake it [[self window] setAnimations:[NSDictionary dictionaryWithObject:[self shakeAnimation:[[self window] frame]] forKey:@"frameOrigin"]]; [[[self window] animator] setFrameOrigin:[[self window] frame].origin]; /* shake animation http://www.cimgf.com/2008/02/27/core-animation-tutorial-window-shake-effect/ */ - (CAKeyframeAnimation *)shakeAnimation:(NSRect)frame { CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimation animation]; CGMutablePathRef shakePath = CGPathCreateMutable(); CGPathMoveToPoint(shakePath, NULL, NSMinX(frame), NSMinY(frame)); int idx; for (idx = 0; idx < numberOfShakes; ++idx) { CGPathAddLineToPoint(shakePath, NULL, NSMinX(frame) - frame.size.width * vigourOfShake, NSMinY(frame)); CGPathAddLineToPoint(shakePath, NULL, NSMinX(frame) + frame.size.width * vigourOfShake, NSMinY(frame)); } CGPathCloseSubpath(shakePath); shakeAnimation.path = shakePath; shakeAnimation.duration = durationOfShake; return shakeAnimation; } Regards Jonathan > > Thanks, > > Jerry Krinock > > > _______________________________________________ > > 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/jonathan%40mugginsoft.com > > This email sent to jonat...@mugginsoft.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