Re: Animating a flickering display
Re: Animating a flickering display
- Subject: Re: Animating a flickering display
- From: Jens Alfke <email@hidden>
- Date: Mon, 04 Jul 2011 11:42:51 -0700
On Jul 4, 2011, at 11:31 AM, Dr. Scott Steinman wrote:
> I have concluded that there are two options to do this:
>
> 1. Draw each display into two NSViews, then switch back and forth between between them (via replaceSubview:with:) with an NSTimer to time the switches.
> 2. Use Core Animation to fade in one display and fade in the other.
I would just use a single view that has a boolean state, like _drawBlackText, and use a repeating NSTimer to trigger a method that flips the variable and tells the view to redraw.
> In each case, I don't know how to avoid blocking a button presses whose action would stop the animation.
Normally a timer will only run in NSDefaultRunloopMode, i.e. while the app is idle. But while a control is tracking mouse events, it runs a nested runloop in NSEventTrackingRunloopMode. If you want the timer to fire during the mouse-down, you’ll need to make it run in that mode as well; see the NSRunLoop API for details.
—Jens_______________________________________________
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