ellsdly / Golf

VR projekt
1 stars 2 forks source link

Koolikell #23

Open ellsdly opened 5 years ago

ellsdly commented 5 years ago

Tavaline koolikell, näitab praegust aega vms.

ellsdly commented 5 years ago

AFRAME.registerPrimitive('a-clock', { defaultComponents: { clock: {} } }); AFRAME.registerComponent('clock', { init: function() { console.log('Hello, World!'); this.el.innerHTML = `

  `;
let temp = 0.5 / 60;

function startTime() {
  var today = new Date();
  var h = today.getHours();
  if (h > 12) {
    h = h - 12;
  }
  var m = today.getMinutes();
  var s = today.getSeconds();
  document.getElementById('seconds').object3D.rotation.z = -THREE.Math.degToRad(6) * s;
  document.getElementById('minutes').object3D.rotation.z = -THREE.Math.degToRad(6) * m;
  document.getElementById('hours').object3D.rotation.z = -THREE.Math.degToRad(30) * h;

  var t = setTimeout(startTime, 1000);
}
startTime();

} });

ellsdly commented 5 years ago

pmst peaks see tootama aga peab vaatama ja muutma jnejne kell vms