Results 1 to 4 of 4

Thread: animation flicker

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Posts
    37
    I've been trying animation in VB. I wanted an image to move across the screen. Well, that was easy. But, I wanted the image to have a transparent background (so it would have the same background as the screen), so, using LView, I gave it a transparent background. But now the image flickers as it moves.

    Any work-arounds? Any other ways of having a cartoon image 'walk' across the screen?

  2. #2
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553

    Talking

    There is only 1 way to accomplish this: BitBlt

    You have to use BitBlt together with the background in a memory DC.

    1) Keep the background in memory

    2) Draw the picture on the screen in a transparent way, therefore you'll need a mask color. Use the Blt constants vbMergePaint and vbAnd when using vbWhite as the mask color.

    3) When moving the picture, do the following:
    * restore the background by getting the dimensions from the memory DC. But DON'T blt the whole picture size, otherwise, you'll get flicker! Just blt the parts from the background that were covered at the previous location. So, always keep track of the previous XY-location.
    * Goto 2)





  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2000
    Posts
    37

    Say what?

    Sounds hard. Hmmmmmmmm. Can't we use animated gifs in VB?

  4. #4
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Yes, there a lot of .OCX available on the net. Don't ask me where or which one, because I don't use them at all. These controls are mostly all right to put something on the screen, but also too slow to move something on the screen, especially when the image has to be transparent.
    I always write my own algorithms to get what I want. Unfortunately I don't get it all the time...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width