Skip to content

Instantly share code, notes, and snippets.

@themorgantown
Last active August 29, 2015 14:04
Show Gist options
  • Save themorgantown/a71fd9ca2f81e4f5e073 to your computer and use it in GitHub Desktop.
Save themorgantown/a71fd9ca2f81e4f5e073 to your computer and use it in GitHub Desktop.
Detect if a scene has been seen in Tumult Hype, and adjust the UI accordingly.
// the buttons in your document should have the unique element id in this format:
// buttonaB. This button would be the button corresponding to scene A, and would be placed shown on Scene B.
// example document: http://tumult.com/support/examples/28995-detectivisitedScene.zip
window.visitedscenes.push(hypeDocument.currentSceneName());
// If Scene A is in the list of scenes visited,
if (window.visitedscenes.indexOf("A") > -1) {
// Change the color of buttona + scenename to be red.
hypeDocument.getElementById('buttona' + hypeDocument.currentSceneName()).style.backgroundColor="red";
}
// If Scene A is in the list of scenes visited,
if (window.visitedscenes.indexOf("B") > -1) {
// Change the color of buttonb + scenename to be red.
hypeDocument.getElementById('buttonb' + hypeDocument.currentSceneName()).style.backgroundColor="red";
}
//console.log(visitedscenes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment