Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I get rid of jerkiness in WinForms scrolling animation?
    primarykey
    data
    text
    <p>I'm writing a simple control in C# that works like a picture box, except the image is constantly scrolling upwards (and re-appearing from the bottom). The animation effect is driven by a timer (System.Threading.Timer) which copies from the cached image (in two parts) to a hidden buffer, which is then drawn to the control's surface in its Paint event.</p> <p>The problem is that this scrolling animation effect is slightly jerky when run at a high frame rate of 20+ frames per second (at lower frame rates the effect is too small to be perceived). I suspect that this jerkiness is because the animation is not synchronized in any way with my monitor's refresh rate, which means that each frame stays on the screen for a variable length of time instead of for exactly 25 milliseconds.</p> <p>Is there any way I can get this animation to scroll smoothly?</p> <p>You can download a sample application <a href="http://www.musigenesis.com/TestApp.exe" rel="nofollow noreferrer">here</a> (run it and click "start"), and the source code is <a href="http://www.musigenesis.com/TestApp.zip" rel="nofollow noreferrer">here</a>. It doesn't look horribly jerky, but if you look at it closely you can see the hiccups.</p> <p><strong>WARNING</strong>: this animation produces a pretty weird optical illusion effect which might make you a little sick. If you watch it for awhile and then turn it off, it will look as if your screen is stretching itself vertically.</p> <p><strong>UPDATE</strong>: as an experiment, I tried creating an AVI file with my scrolling bitmaps. The result was less jerky than my WinForms animation, but still unacceptable (and it still made me sick to my stomach to watch it for too long). I think I'm running into a fundamental problem of not being synced with the refresh rate, so I may have to stick to making people sick with my looks and personality.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload