Hi, is it possible just to show selected scenes?
F.e. you mark the fields you would like to see in the table of contents. Then hit a play button which shows just the selected scenes.
thx for help, best jan
Hi, is it possible just to show selected scenes?
F.e. you mark the fields you would like to see in the table of contents. Then hit a play button which shows just the selected scenes.
thx for help, best jan
/*!
* Hype Persistent Symbol Navigator Extension
* Copyright (Year) Your Name, (https://yourwebsite.com). MIT-license
*/
/*
* Version-History
* 1.0.0 Initial release
*/
// Ensure the extension isn't redefined
if ("HypePersistentSymbolNavigator" in window === false) {
window['HypePersistentSymbolNavigator'] = (function () {
/**
* Hype Scene Load handler
* This function is called whenever a new scene is loaded.
* It searches for a persistent symbol that matches the current scene's name and checks its main timeline position.
*
* @param {Object} hypeDocument - The Hype document instance.
* @param {HTMLElement} element - The scene container element.
* @param {Event} event - The event object.
*/
function HypeSceneLoad(hypeDocument, element, event) {
// Construct the ID of the persistent symbol based on the current scene's name
var symbolId = hypeDocument.currentSceneName();
// Attempt to find the symbol element within the entire Hype document
var symbolElement = document.getElementById(symbolId);
// Check if the symbol exists
if (symbolElement) {
// Convert the found symbol element to a symbol instance
var symbolInstance = hypeDocument.getSymbolInstanceById(symbolElement.id);
// Check if the symbol instance exists and its main timeline is not at the start (position 0)
if (symbolInstance && symbolInstance.currentTimeInTimelineNamed('Main Timeline') == 0) {
// The main timeline is not at the start, so navigate to the next scene
hypeDocument.showNextScene();
}
}
}
// Register the Hype Scene Load event listener
if ("HYPE_eventListeners" in window === false) {
window.HYPE_eventListeners = Array();
}
window.HYPE_eventListeners.push({"type": "HypeSceneLoad", "callback": HypeSceneLoad});
// Public API for the extension
return {
version: '1.0.0',
};
})();
}
What does this Extension do?:
How does it remember state?
The extension leverages the unique characteristic of persistent symbols in Tumult Hype, where they remain accessible across scenes, even when not visibly present on the current scene. This property allows persistent symbols to serve as a form of "state storage" within your Hype project. By examining the timeline position of these symbols, the extension can determine if a particular action or animation has already been initiated or completed, regardless of the symbol's visibility.
This approach is particularly useful for creating interactive projects where the user's progress or choices need to be remembered across different scenes. For instance, in the case of the checkbox symbol you mentioned, once the "check" animation is triggered (indicating a user interaction), the symbol's timeline position changes from its initial state (position 0). The extension detects this change and uses it to decide the flow of the project, such as skipping scenes that no longer need to be revisited, thereby enhancing the user experience by avoiding redundancy.
Updated Download:
Persistent Symbol Navigator.hype.zip (98,7 KB)
Last update February 16th, 2024
thx a lot max! perfect solution!
Hi Max! Could it be that it's still a bit buggy? Scene three always plays, even if I haven't selected it, no matter which combination.
Hi, yes you are right - scene 3 will always be played
Indeed, the function is designed to transition directly to the subsequent scene, bypassing the current one. This implies that in the absence of a following scene, the function lacks a destination. To address this, I suggest incorporating a final scene that determines the subsequent action, such as looping back to the start or displaying a 'The End' message. I have made the necessary updates to the file accordingly.
fyi
There was this also..
This is dynamic, in that you do not need to hard code in the scene list, the code will do that for you.
(I did intend to include a thumbnail but it got too complex, so I did not complete that part )