Skip to content

Instantly share code, notes, and snippets.

@daniel-schroeder-dev
Created November 18, 2020 00:07
Show Gist options
  • Select an option

  • Save daniel-schroeder-dev/5ba2ff4df236b294d7b2f804d5a86a7e to your computer and use it in GitHub Desktop.

Select an option

Save daniel-schroeder-dev/5ba2ff4df236b294d7b2f804d5a86a7e to your computer and use it in GitHub Desktop.
AFRAME.registerComponent('clock', {
tick: function(time, timeDelta) {
var milliseconds = Math.round(time % 1000);
var seconds = Math.round(time / 1000);
seconds = seconds == 60 ? 0 : seconds;
var minutes = Math.round(seconds / 60);
$('#time-text-ms').attr('value', milliseconds);
$('#time-text-s').attr('value', seconds);
$('#time-text-m').attr('value', minutes);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment