Jonathan,
Thanks for the update.
We are creating an animation NOT a movie. Sorry for the confusion. We have experimented with movies before and it’s not a fantastic user experience in Cordova. Everything is a mess
We want to create simple HTML5 animations for help screens and for onboarding.
To summarise what we have done as this might be useful to other people.
-
We have created a simple HTML5 animation using Hype 3.
-
We export the JS and add them to our cordova project.
-
We use your function call CallHype() to load the animation up when we press a help button in our app.
-
The animation appears, two lines of text gently fade in as designed. Looks great.
-
We close the window and it goes away.
-
If we click on the help button again, the window appears and the end point of the animation is shown. There is no fading in of the text.
-
We tried to add in
HYPE.documents["documentName"].showSceneNamed("firstSceneName")
but were gettingHYPE
is undefined. Clearly we haven’t got access to HYPE. -
Searching through the docs and the javascript forums shows this
http://forums.tumult.com/t/hype-is-not-defined-calling-hype-from-external-html/5278/3
which looks interesting. -
We added the callback and bingo, we have a working callback. Doesn’t do anything but early days. We added in a
JSON.stringify(hypeDocument)
and we can see ‘hype stuff’ so we have some sort of confidence that something is working. -
We looked through more sections and doc and found
http://tumult.com/hype/documentation/3.0/#invoking-api-from-outside-oftumult-hype
. So we created a new callback for when the eventHypeTimelineComplete
is complete with a call to actually do something practical, ie.e goto a scene, in our case the first scene, so it loops.
window.HYPE_eventListeners.push({"type":"HypeTimelineComplete", "callback":HypeTimelineComplete});
function HypeTimelineComplete(hypeDocument, element, event) {
// do something with hypeDocument...
// HYPE.documents["documentName"] which is the same thing is also ready now
ConsoleLog("HypeTimelineComplete");
ConsoleLog("hypeDocument " + JSON.stringify(hypeDocument));
ConsoleLog("hypeDocument.sceneNames() = " + hypeDocument.sceneNames());
hypeDocument.showSceneNamed("Untitled Scene")
return true;
}
-
We now have a looping animation. We think we can work out bits to start and stop the animation using ```pauseTimelineNamed`` and similar. We want to make sure animations don’t constantly run in the background in our app as this consumes battery power.
-
This page is also very useful
http://tumult.com/hype/documentation/3.0/#api-functions
I think we have got something we can work with. Lets leave this open for a bit so if anything useful pops up I’ll add it here. We may be the first people to embed Hype 3 in Cordova
Sorry for how long this is, I thought it useful for other people to see what we did and the steps we went through.
Rob