Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (42 sloc) 1.38 KB
<!DOCTYPE html><html><head><meta charset="utf-8"/>
<title>DNA - molecularvr</title>
<script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
</head><body>
<a-scene id="scene"><a-sky color="#000000"></a-sky></a-scene>
<script>"use strict"
const H = 16.5
const R = 1.5
const DTH = 2 * Math.PI / 32
const DY = H / 120
const OX = 0
const OY = -2
const BR = .1
let th = 0
let xz = [ 0, 0, 0, 0 ]
for (let y = 0; y < H; y += DY) {
for (let i = 0; i < 2; i++) {
const nth = th + i * Math.PI
const x = OX + Math.cos(nth) * R
const z = OY + Math.sin(nth) * R
const obj = document.createElement('a-sphere')
obj.setAttribute('scale', BR + " " + BR + " " + BR)
obj.setAttribute('position', x + " " + y + " " + z)
scene.appendChild(obj)
xz[i * 2] = x
xz[i * 2 + 1] = z
}
th += DTH
const line = document.createElement('a-entity')
line.setAttribute('line', { start: xz[0] + " " + y + " " + xz[1], end: xz[2] + " " + y + " " + xz[3] })
scene.appendChild(line)
}
document.body.onclick = function() {
if (DeviceMotionEvent && DeviceMotionEvent.requestPermission && typeof DeviceMotionEvent.requestPermission === 'function') {
DeviceMotionEvent.requestPermission()
}
if (DeviceOrientationEvent && DeviceOrientationEvent.requestPermission && typeof DeviceOrientationEvent.requestPermission === 'function') {
DeviceOrientationEvent.requestPermission()
}
}
</script>
</body></html>
You can’t perform that action at this time.