Skip to content

Instantly share code, notes, and snippets.

@huffman
Created February 27, 2015 23:46
Show Gist options
  • Save huffman/2001c7c963bf9182cf13 to your computer and use it in GitHub Desktop.
Save huffman/2001c7c963bf9182cf13 to your computer and use it in GitHub Desktop.
letThereBeLight.js
//
// SunLightExample.js
// examples
// Sam Gateau
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var intensity = 1.0;
var day = 0.0;
var hour = 12.0;
var longitude = 115.0;
var latitude = 31.0;
var stageOrientation = Quat.fromPitchYawRollDegrees(0.0, 180.0, 0.0);
Scene.setStageDayTime(hour);
Scene.setStageOrientation(stageOrientation);
Scene.setStageLocation(longitude, latitude, 0.0);
function ticktack() {
hour += 0.05;
if (hour > 24.0) {
hour = 0.0;
day++;
Scene.setStageYearTime(day);
}
Scene.setStageDayTime(hour);
}
Script.setInterval(ticktack, 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment