How to retain the state of a scene in Hype


#1

Hi everyone,
I have a project, where I need to retain state of a scene with multiple timelines.
When user lands on the screen, they do activities - play animations - and if they navigate from the scene - the animations should retain the last state,
Any help much appropriated,
Thanks!


#2

You need to save the State when leaving a scene and restore it when loading it. There is no general state you can access so you need to collect all the data by hand (timeline positions, displays) and then redeploy them (setting displays and timelines).

There was a request yesterday that falls into this category

Also check out the symbols syncing discussed here

In general you can access the localStorage or sessionStorage (look these terms up) and you can put stuff into the window context but always need to run two functions on a scene load and unload (save/restore). I also sometime store stuff into hypeDocument as this variable gets pass around into every hype function and is local to the Hype instance.


#3

Thank you so much!