Jump to content

Ajax image loading issue


phpknight

Recommended Posts

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.

Link to comment
Share on other sites

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 :)

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.