Hey gang,
I’ve been trying to load different scene based on Time of Day on page-load, and naturally Not Quite Getting It. Any suggestions here?
Here’s my code (using 10 for afternoon for testing purposes):
var myDate = new Date();
if ( myDate.getHours() > 18 )
{
hypeDocument.showSceneNamed('evening');
} else if { ( myDate.getHours() > 10 )
hypeDocument.showSceneNamed('afternoon');
}
}
dayornight.hype.zip (27.2 KB)
Thank you to all in advance…
rene
(René)
2
Typo! You misplaced the bracket, it should be:
var myDate = new Date();
if ( myDate.getHours() > 18 ){
hypeDocument.showSceneNamed('evening');
} else if ( myDate.getHours() > 10 ){
hypeDocument.showSceneNamed('afternoon');
}
1 Like
rene
(René)
3
I should use a ‘start’-scene with the script on scene-load. Check this out: dayornight.hype.zip (31.1 KB)
Oh ffs KILL ME NOW. Un grand merci René! (with the assumption you’re French-speaking)
rene
(René)
5
You’re welcome, it was nothing…
Although my name is French, I’m born and raised in the Netherlands
Aaah, that’s two silly mistakes today. Apologies René!