eternaldensity / Sandcastle-Builder

xkcd: 1190: Time: The Game
Other
81 stars 65 forks source link

Pre-load the next NP to prevent a black box. #235

Open Prezombie opened 10 years ago

Prezombie commented 10 years ago

It's an easy fix, keeping the next newpic in memory, the same could be done for the current colpix/noncolpix, and the previous pic for time travellers. Further time travel being delayed a few mNP to properly accellerate to 88mph while preloading would also work.

eternaldensity commented 10 years ago

I'm actually planning on changing time travel so some spin-up time is needed, so that fits well. But what is the simplest way to preload? I haven't had to do that in a long time so I've forgotten...

Prezombie commented 10 years ago

Stackoverflow has a few suggestions if jquery.get(source) doesn't float your barge. http://stackoverflow.com/questions/17440152/preloading-images-in-javascript-without-jquery

eternaldensity commented 10 years ago

I've been gradually using more jquery so I might as well.

eternaldensity commented 10 years ago

image It starts working and then it cancels. It's starting 2mNP before the ONG but... shrug I'll deal with it in the next version

eternaldensity commented 10 years ago

Disabled because #241

Dorus commented 10 years ago

Bumped into this, it's one of few the oldies that's not fixed yet.

LucidCrux commented 10 years ago

I'm not sure this needs messed with. It could be done another way with an invisible div that has the next img. With the jumping around from rifts and time travel though, the issue becomes either bigger or not important. If people still think it necessary, you can still use the invisible div to load an image into and then using jquery assign a load function that does what it needs to.

Dorus commented 10 years ago

I meant I still see a black box now and then, I don't really care what specific implementation will be used to fix that thou.

eternaldensity commented 10 years ago

Yeah it still needs fixing as my one attempt to fix it failed badly.

LucidCrux commented 10 years ago

Just did some quick research. Apparently loading images is all kinds of messed up across browsers right now. So the defacto way to do this is now apparently this: https://github.com/desandro/imagesloaded

Looks plenty easy to use, just adds a chunk of code and call it. Might be a bit more tricky figuring out where to stick it for each case though, having to be used for ONG and any time traveling. Not working on this myself yet, so figured I'd share the info if anyone else wants to have a go.