Tim, How long is each image in your animation going to be visible on the screen? (I presume you're not going to display more than 30 per second...) What I'm thinking is this:
- load a batch of images (say, a few hundred) into an array - start animating those - during some convenient pause in the animation, or some other pause in the user experience (e.g., while the user is reading and thinking about something), load down another batch of images - repeat Depending on the speed of your animations, you might also have plenty of CPU time to download stuff *while* things are animating. I realize this suggestion is a bit naive, but 'til I see your response, I won't know where or how it's naive. :-) ron On Sat, Jan 16, 2010 at 12:32 PM, Timmaah! <[email protected]> wrote: > Hi there, > > I am currently developing a gadget which, among its functions, > involves the loading and displaying of a short (5-15 frames) animation > on certain events. > > On its own that sounds straightforward enough, but here's the twist: > there's more than one animation. In fact, there are in the region > 2,000 different animations - so, for a start, the animation files > cannot be included in the package (as it swells to an unacceptable 20 > Mb). As the animations will only be required semi-regularly, they will > be stored online, and the gadget will pull the relevant one down when > necessary. > > Again, on paper this doesn't sound too tall an order, but I've been > running into brick wall after brick wall trying to get this to happen > smoothly - and am now almost out of ideas. Here's what I've tried so > far: > > 1. Store the animations online as animated gifs. Pull down the > relevant one in an XMLHttpRequest, and load it into an image object. > > Problem: The image is fetched and loaded fine, but the animation > doesn't animate - only the static first frame is shown. On further > reading, it turns out that Google Gadgets do not support animated > gifs. > > > 2. Store the animations as a sequence of single-frame images (PNGs). > Pull down the data for multiple images in a single request, then split > the data up into separate images, load them into an array of image > objects, and use the native animation controls to step through the > frames in sequence. (This was the subject of my earlier thread - > http://groups.google.com/group/google-desktop-developer/browse_thread/thread/264eab0d67ca5a59 > ) > > Problem: The fetch is successful, but Javascript lacks the ability to > properly handle binary data, so the stream cannot be split into > individual images. Despite some creative attempts at a workaround > (such as base64-encoding the whole stream), it appears that, once > split into string variables, the data cannot be loaded into image > objects as images. > > > 3. Store the animations as a sequence of single-frame images (PNGs), > as above. Pull down all the required images in a series of > simultaneous XMLHttpRequests. Load each image into an array of image > objects, and use the animation controls to play them as an animation. > > Problem: More than 2 simultaneous requests is apparently ill-advised, > and if even one fails, the animation cannot play. The whole thing just > feels... sloppy. > > > 4. Build the animations as Flash swf files. Pull down the relevant > file in an XMLHttpRequest, and load it into a embedded object in the > gadget. > > Problem: Works perfectly! - except ... the path to the swf file is > locked in. There seems to be no way to change its properties so it can > load a different file when required. > > > The final option, which I'm now seriously considering, is to just > rebuild the whole gadget as a Flash app, and embed it - much like the > Google slideshow gadget that's included with the Sidebar. I don't > really want to do it this way, as I've spent so much times getting to > grips with the gadgets development framework - but it's starting to > appear as if the environment is just too limited for my purposes. > > Does anyone have any thoughts on the above? Have I completely missed > something quite straightforward? > > Thanks a lot, > > - Tim > > -- > You received this message because you are subscribed to the Google Groups > "Google Desktop Developer Group" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-desktop-developer?hl=en. > > > >
-- You received this message because you are subscribed to the Google Groups "Google Desktop Developer Group" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-desktop-developer?hl=en.
