Thread: animation
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David Adamson[_4_] David Adamson[_4_] is offline
external usenet poster
 
Posts: 61
Default animation

Libby try adding this

What this will do is force a delay before the loop. It's something I have
used in the past to show a colour change in a map. The original idea came
from a far smarter individual than I but can't remember there name.

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)



for i = 0 to 9 step 0.5
labelblink.height = i
doevents



'calls the sleep function and delays macro by 1/2 second

Sleep 500 'adjust this for the dealy. Max 1000 for one second

next



"Libby" wrote in message
...
I have created a hangman type game where you guess letters which make up a
word.

This has some basic animation in the form of a bear whose eyes follow the
mouse and who blinks randomly.
The blinking is done by increasing the height of a label and reducing it
again using a loop
eg
dim i as double
for i = 0 to 9 step 0.5
labelblink.height = i
doevents

Is there anyway of making the speed of this independent of the processor
speed, as currently it is painfully slow on some PC's and far too fast on
others?

Many thanks
Libby