summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Becker <jeff@i2p.rocks>2019-07-07 10:06:10 -0400
committerJeff Becker <jeff@i2p.rocks>2019-07-07 10:06:10 -0400
commit2929f28319574d4e598385b87ac696cc2baeb226 (patch)
tree6b80fadc036bfbdec98ce3a22b68859b5621e387
parent9d5c6ed154fd76dc1c02871175e88d3569c5b4b7 (diff)
add toggle for onclick
-rw-r--r--docroot/main.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/docroot/main.js b/docroot/main.js
index 7c8e804..6c0edd3 100644
--- a/docroot/main.js
+++ b/docroot/main.js
@@ -2,6 +2,7 @@
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );
var renderer;
+var source;
var use_webgl = false;
var use_canvas = false;
try {
@@ -19,6 +20,9 @@ try {
if(renderer)
{
renderer.setSize( window.innerWidth, window.innerHeight );
+ renderer.domElement.onclick = function() {
+ toggle_the_thingy();
+ };
document.body.appendChild( renderer.domElement );
//var cube = new THREE.Mesh( geometry, material );
@@ -35,7 +39,7 @@ loader.load("img/alexjones.jpeg", function(tex) {
cube = new THREE.Mesh( geometry, material );
scene.add(cube);
});
-
+
}
var composer ;
@@ -142,8 +146,6 @@ function reloadFile(e) {
}
}
-var source;
-
function onBuffer (buffer, vid) {
if(source) source.stop();
if(vid)
@@ -456,6 +458,11 @@ function stop_the_thingy() {
if(source) source.stop();
}
+function toggle_the_thingy() {
+ if(source) stop_the_thingy();
+ else play_the_thingy();
+}
+
function animate () {
resizeCanvas();
requestAnimationFrame( animate );