diff --git a/src/components/watch.js b/src/components/watch.js
new file mode 100644
index 0000000..c923f06
--- /dev/null
+++ b/src/components/watch.js
@@ -0,0 +1,32 @@
+AFRAME.registerComponent("watch", {
+ init: function() {
+ this.timer = AFRAME.utils.getUrlParameter('timer')
+ if (!this.timer) this.timer = 300 //5min
+ document.querySelector("#watch").setAttribute("text","value:" + this.formatSeconds(this.timer))
+ this.tick = AFRAME.utils.throttleTick(this.tick, 1000, this);
+ // details https://aframe.io/docs/1.0.0/core/utils.html#aframe-utils-throttle-function-minimuminterval-optionalcontext
+ },
+
+ formatSeconds: function(secs) {
+ function pad(n) {
+ return (n < 10 ? "0" + n : n)
+ }
+
+ var m = Math.floor(secs / 60);
+ var s = Math.floor(secs - m * 60);
+
+ return pad(m) + ":" + pad(s);
+ },
+
+ tick: function (t, dt) {
+ var time = Number( this.timer )
+ console.log(this.timer);
+ if(this.timer > 0){
+ this.timer--
+ } else {
+ this.timer = 0
+ document.querySelector("#endMessage").setAttribute("visible","true")
+ }
+ document.querySelector("#watch").setAttribute("text","value:"+ this.formatSeconds(time))
+ },
+});
diff --git a/src/home.html b/src/home.html
index 9f8cb0a..eade8ca 100644
--- a/src/home.html
+++ b/src/home.html
@@ -13,7 +13,29 @@
material="color: #EF2D5E;">
-
+
+
+
+
+
+
+
@@ -21,6 +43,9 @@
-
+
+
+
\ No newline at end of file
diff --git a/src/index.js b/src/index.js
index 987a9fc..a94b9ce 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,6 +8,7 @@ require('aframe-event-set-component');
require('./components/aabb-collider');
require('./components/grab');
+require('./components/watch');
require('./index.css')