jonathan
(Jonathan Deutsch)
April 1, 2015, 1:13am
1
If you wanted to synchronize timelines across layouts, you could use this code on layout load:
var timelineNames = ["Main Timeline"];
for(var i = 0; i < timelineNames.length; i++) {
var timelineName = timelineNames[i];
var timelineKey = "timeline_" + hypeDocument.currentSceneName() + "_" + timelineName;
var timelineInfo = window[timelineKey];
if(timelineInfo != null) {
hypeDocument.goToTimeInTimelineNamed(timelineInfo["time"], timelineName);
if(timelineInfo["state"] == true) {
hypeDocument.continueTimelineNamed(timelineName, timelineInfo["direction"]);
} else {
hypeDocument.pauseTimelineNamed(timelineName);
}
}
}
And then this code on layout unload:
var timelineNames = ["Main Timeline"];
for(var i = 0; i < timelineNames.length; i++) {
var timelineName = timelineNames[i];
var timelineKey = "timeline_" + hypeDocument.currentSceneName() + "_" + timelineName;
var timelineInfo = {};
timelineInfo["time"] = hypeDocument.currentTimeInTimelineNamed(timelineName);
timelineInfo["direction"] = hypeDocument.currentDirectionForTimelineNamed(timelineName);
timelineInfo["state"] = hypeDocument.isPlayingTimelineNamed(timelineName);
window[timelineKey] = timelineInfo;
}
You’d need to have it on each of your layouts to work.
6 Likes
You sir, are the man. That worked perfectly. Thanks!
1 Like
Fuv
(Aleksander)
April 23, 2016, 9:48pm
3
I can synchronize audio? How?
DBear
April 23, 2016, 11:21pm
4
A simple way:
In your Head HTML add a global variable for your audio source: (this saves adding it to all layouts in a scene load function)
<script>
window.audio = new Audio ("${resourcesFolderName}/NAME_OF_YOUR_AUDIO_FILE";
</script>
Then on Layout Unload you can update the currentTime property by using this function:
window.currentTime = audio.currentTime;
Note You have to Play and Stop the audio using Javacsript functions with this (not by dragging the resource in or using “Play Sound” and “Stop Sound”)
You can do this by creating functions with the following and calling them on mouse click
for play:
audio.play();
stop:
audio.pause();
3 Likes
I was trying to use permanent symbols instead of coding and that was causing the app to crash all the time, but your method worked perfectly! Thank you so much, Jonathan!
1 Like
MaxZieb
(Loves Hype)
June 10, 2016, 6:43am
6
Also have a look at the Sound Extensions to manage more then one sound across scenes (loadSound etc.)
Hello Everybody,
given some back and forth on a good way to extend Hype and allow modularity we (@MarkHunte , @MaxZieb ) are starting this little project as a board thread. One could move things to GitHub or so but that adds another layer of abstraction and this thread is about inclusion. Anyways one will have to see if this thread picks up any traction anyways.
Purpose of the Project
A modular way to extend Hype with functions that follow some simple rules.
Rules of participation
Try to keep…
DaveMez
(davemez)
April 12, 2020, 12:41am
7
ok long time ago thread but just encountered…would be cool for a ‘persistent’ checkbox in the timelines inspector in addition to ‘relative’. Maybe a feature request? I find myself customizing & changing layouts after building a ‘master’ and looking for tools like persistent symbols to keep things connected, would be great for timelines too…not sure if even possible in the quantum world of …{-.-}
1 Like
jonathan
(Jonathan Deutsch)
April 13, 2020, 7:07pm
8
Thanks for the request!
In a lot of cases it is easier to use a Persistent Symbol as your Master, which will keep the timeline running across different scenes/layouts.
DaveMez
(davemez)
April 14, 2020, 5:17am
9
psssshhhh. I shoulda tried that, thanks!
1 Like