Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Better way to simulate a count

Status
Not open for further replies.

herrin

Programmer
Nov 27, 2001
12
US
Hi there,

Can anyone think of a more clever way to create the extremely simple simulation of spinning numbers?


It doesn't need to really count, just a string of several numbers, each randomly spinning from 1-9, like a quick spin on a slot machine or something. This one takes more processor than i'm comfortable with.

Thanks for looking!
 

Why not simply reduce the speed at which you are spinning the numbers?

Instead of using 10 msecs for the timeout parameter, use something like 50 or 100 instead. The difference would probably not be too noticable, but would reduce the CPU load.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Spin counter displays in JavaScript are do-able in the "extreme pain in the ass" sense of the word. If you're not concerned about modeling what's *really* happening inside the program put up an animated gif that looks like a working counter. Simple, reliable, will fool most viewers.

BTW, for display purposes it doesn't do any good to update the screen faster than the hardware. My old monitor displays 30 frames a second, ~33ms per frame. Updating every 10ms is overkill here.
 
fastct.gif


Adam

Whatever I feel like I wanna do, gosh!
 
BillyRay: That did reduce the processor, it's still clunky. I think i'm just gonna bail on the idea. Thanks for the suggestion.

Ray & Adam... Yeah, I tried an animated gif first, but it needs to be transparent which blows the whole deal. Thanks for the ideas.
 
Why? Animated gifs can be transparent, can't they?

Adam

Whatever I feel like I wanna do, gosh!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top