• 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
Re: Synching CGContextFlush with a Monitor's Refresh Rate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Synching CGContextFlush with a Monitor's Refresh Rate


  • Subject: Re: Synching CGContextFlush with a Monitor's Refresh Rate
  • From: Chris Hanson <email@hidden>
  • Date: Sun, 24 Sep 2006 18:29:44 -0700

On Sep 24, 2006, at 3:29 PM, Jordan Evans wrote:

// Moves Ticker Tape message over 30 pixels. This is a nice, but jerky
pace with a NSTimer invoking this method every 0.03 sec.

Your NSTimer isn't guaranteed to be fired exactly every 0.03 seconds:

<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ Classes/NSTimer_Class/Reference/Reference.html>
Moreover, timers may not fire exactly when scheduled.

What you need to do is keep track of the last time you drew and the current time as of the timer's firing, and calculate the offset to use for drawing from that information. This should result in smoother animation.


  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Synching CGContextFlush with a Monitor's Refresh Rate (From: "Jordan Evans" <email@hidden>)

  • Prev by Date: Re: Detecting a focus change in a window?
  • Next by Date: Re: SQL Development
  • Previous by thread: Synching CGContextFlush with a Monitor's Refresh Rate
  • Next by thread: Working on the NSTableView
  • Index(es):
    • Date
    • Thread