0 votes
asked by (150 points)
I tried to create a preloading page to show a simple animation during page loading... But it looks like the "window.onload" function is not supported by Twine.

Has anyone managed to create a preloading page and would have some examples of help?

1 Answer

0 votes
answered by (131k points)
selected by
 
Best answer
The issue is that the window.load event (what the window.onload function is relying on) occurs before Harlowe's Javascript engine has dynamically created the resulting page, this is also true for the other story formats as well as most single-page web-applications. This is why you can't use the window.load.event to do what you want.

As far as I know Harlowe doen't have any built-in events you can attach an event handler to that would allow you to interact with during the build process of the initial page.

Is there a reason you don't just show your animation on the first Passage and then use a timer event to move the Reader to the next Passage?
commented by (150 points)
No, I would just like to create a "load page" while the pictures and sounds of the current passage are loading. Do not show the page that loads and compiles in front but the page loaded and complete. A simple "loading..." indicator.

I suppose from your answer that it is not possible with Harlowe..
commented by (131k points)

I suppose from your answer that it is not possible with Harlowe..

 No, you can suppose from my answer that I can't think of an easy way to archive the result you wish without either:

1. Overloading/extending some portion of the story format's Javascript engine.

2. Converting the loading of the said image & audio files into a Javascript based background process. (**)

3. Some combination of both 1 & 2.

(**) That's assuming you're not already using Javascript to asynchronously load your image & audio resources.

NOTE: The SugarCube story format has a 'loading' indicator like the one you want, but that story format was designed to include that feature as part of it's engine initialisation/loading process.

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...