phpknight Posted August 1, 2009 Share Posted August 1, 2009 Hi, I am making an interface where I am swapping out images created in real time to simulate the effect of animation. However, because the browser has to load each one from the server, it is going to blink a little or be less smooth than I want it to be. With Ajax, what would be a good way to load the images into the browser first, so when I swap it happens as immediately as possible? I was thinking of loading it into a one pixel spot first and then delaying really quickly before swapping. However, javascript does not have a sleep function. So, I'd appreciate any ideas on how to do this. Quote Link to comment Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 function countThose(sheep) { if (var newSheep < sheep) { newSheep++; } } countThose(999999); // should be enough for about 1 second on modern servers lol... but yeah.. tell the user it's loading and have the used in a lag of a few seconds... script start => user told to wait => script gathers specific # images => first image output to user => another image is retrieved from server by script => second image shown to user => first image discarded by server => another image retrieved from server => third image shown to user => etc etc etc I don't suppose you can't setup multiple connections to get 30 or more frames (if it's 24fps) in advance then once each is in the memory do images++; then when images == 30 show the first frame then keep getting frames in a buffer kind of thing. although it WOULD be kind of a resource hogging script I would have thought. just an idea Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.