1 window.addEventListener("load", eventWindowLoaded, false);
6 var introduce = document.getElementById('introduce');
7 var ineh = document.getElementById('eucentricheightcontents');
8 var inform = document.getElementById('form');
9 var insingle = document.getElementById('simplephotecontents');
10 var intomo = document.getElementById('tomography');
11 var inmds = document.getElementById('mds');
13 if (insingle.style.display == "") {
16 console.log("canvasmode=" + canvasmode);
17 }else if(intomo.style.display ==""){
20 console.log("canvasmode=" + canvasmode);
21 }else if(inmds.style.display ==""){
24 console.log("canvasmode=" + canvasmode);
27 console.log("canvasmode=" + canvasmode);
31 function eventWindowLoaded() {
32 //画面がロードされたら、canvasAppを呼び出す
33 /* if (canvasmode == 1) {
35 } else if (canvasmode == 2) {
41 document.getElementById("formmode").style.backgroundColor = '#e0ffff';
42 document.getElementById("formmode2").style.backgroundColor = '#e0ffff';
43 document.getElementById("formmode3").style.backgroundColor = '#e0ffff';
46 function canvasSupport(){
47 return Modernizer.canvas;
50 //var movex = document.forms.movestage.movex.value;
51 //var movey = document.forms.movestage.movey.value;
54 document.onkeydown = funcKey;
69 var movingdistance =1;
73 if (navigator.getGamepads) {
75 var gamepad_list = navigator.getGamepads();
77 console.log(gamepad_list);
79 console.log("function gamepad");
80 window.addEventListener("gamepadconnected", function(e) {
81 console.log("gamepad connected!");
84 if (window.GamepadEvent) {
86 // ------------------------------------------------------------
87 // ゲームパッドを接続すると実行されるイベント
88 // ------------------------------------------------------------
89 window.addEventListener("gamepadconnected", function(e) {
90 console.log("ゲームパッドが接続された");
91 console.log(e.gamepad);
94 // ------------------------------------------------------------
95 // ゲームパッドの接続を解除すると実行されるイベント
96 // ------------------------------------------------------------
97 window.addEventListener("gamepaddisconnected", function(e) {
98 console.log("ゲームパッドの接続が解除された");
99 console.log(e.gamepad);
104 setInterval(function(e){
105 var gamepad = e.gamepad;
106 if (gamepad.axes[0] < -0.5) {
107 movex = parseInt(movex) + parseInt(10);
108 console.log("left!");
111 if (gamepad.axes[0] > 0.5) {
112 movex = parseInt(movex) - parseInt(10);
115 if (gamepad.axes[1] < -0.5) {
116 movey = parseInt(movey) - parseInt(10);
119 if (gamepad.axes[1] > 0.5) {
120 movey = parseInt(movey) + parseInt(10);
127 setInterval(function() {
130 var gamepad_list = navigator.getGamepads();
131 // ゲームパッドリスト内のアイテム総数を取得する
132 var num = gamepad_list.length;
134 for (i = 0; i < num; i++) {
136 var gamepad = gamepad_list[i];
140 str += "index: " + gamepad.index + "\n";
142 str += "timestamp: " + gamepad.timestamp + "\n";
144 str += "id: \"" + gamepad.id + "\"\n";
146 str += "connected: " + gamepad.connected + "\n";
148 str += "mapping: \"" + gamepad.mapping + "\"\n";
151 // ------------------------------------------------------------
152 var buttons = gamepad.buttons;
153 str += "buttons: {\n";
155 var n = buttons.length;
156 for (j = 0; j < n; j++) {
157 // GamepadButton オブジェクトを取得
158 var button = buttons[j];
159 str += " \"" + j + "\": { ";
161 str += "pressed:" + button.pressed + " , ";
163 str += "value:" + button.value + " }\n";
167 // ------------------------------------------------------------
169 var axes = gamepad.axes;
173 for (j = 0; j < n; j++) {
175 if (axes[j] < -0.5) {
176 movex = parseInt(movex) - parseInt(1);
178 console.log(axes[j]);
179 stagecontrol('stage',movex,movey,movez,movea);
180 emcondition('request');
181 if (canvasmode == 1) {
183 } else if (canvasmode == 2) {
185 } else if (canvasmode == 3) {
190 movex = parseInt(movex) + parseInt(1);
191 stagecontrol('stage',movex,movey,movez,movea);
192 emcondition('request');
193 if (canvasmode == 1) {
195 } else if (canvasmode == 2) {
197 } else if (canvasmode == 3){
202 if (axes[j] < -0.5) {
203 movey = parseInt(movey) + parseInt(1);
204 stagecontrol('stage',movex,movey,movez,movea);
205 emcondition('request');
206 if (canvasmode == 1) {
208 } else if (canvasmode == 2) {
210 } else if (canvasmode ==3 ) {
215 movey = parseInt(movey) - parseInt(1);
216 stagecontrol('stage',movex,movey,movez,movea);
217 emcondition('request');
218 if (canvasmode == 1) {
220 } else if (canvasmode == 2) {
222 } else if (canvasmode == 3){
233 window.addEventListener("gamepaddisconnected", function(e) {
234 console.log("gamepad disconnected");
236 window.addEventListener("gamepadconnected", function(e) {
237 console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",
238 e.gamepad.index, e.gamepad.id,
239 e.gamepad.buttons.length, e.gamepad.axes.length);
245 function canvasApp() {
246 var theCanvas = document.getElementById("canvasOne");
247 //canvasとして利用するhtmlのタグの場所を指定
248 var context = theCanvas.getContext("2d");
251 function drawScreen() {
253 context.fillStyle = "fffffaa";
255 context.fillRect(0, 0, 540, 605);
258 //if(document.forms.movestage.movex.value!=moveformx){
259 moveformx = document.forms.movestage.movex.value;
260 movex=parseInt(moveformx);
262 //if(document.forms.movestage.movey.value!=moveformy){
263 moveformy = document.forms.movestage.movey.value;
264 movey=parseInt(moveformy);
266 moveformz = document.forms.moveza.movez.value;
267 movez=parseInt(moveformz);
270 stagecontrol('stage',movex,movey,movez,movea);
271 emcondition('request');
276 var movez = document.forms.s2.movez.value;
282 var img = new Image();
284 img.onload = function() {
285 //イメージがロードするのを待つ必要があるのでonload
286 //context.scale(movez*0.1,movez*0.1);
287 //context.setTransform(movez*0.1,0,0,movez*0.1,0,0);
288 //context.translate(540/2,605/2);
289 context.drawImage(img, movex, movey);
290 //イメージを描写、引数は画像のオブジェクト,左端のx,y
291 document.getElementById("currentx").innerHTML = movex;
292 document.getElementById("currenty").innerHTML = movey;
293 console.log("x=" + movex);
294 console.log("y=" + movey);
295 var movingdistance = $("#movingdistance");
296 console.log(movingdistance[0]);
300 img.src = "./image/CC124crudeダイニン.jpg";
303 context.strokeStyle = "#000000";
305 context.strokeRect(5, 5, 505, 610);
306 //わくの輪郭を書く、引数は左端のx,y,幅,高さ
311 function canvastomo() {
312 var theCanvas = document.getElementById("canvastomo");
313 //canvasとして利用するhtmlのタグの場所を指定
314 var context = theCanvas.getContext("2d");
317 function drawScreen() {
319 context.fillStyle = "fffffaa";
321 context.fillRect(0, 0, 540, 605);
324 //if(document.forms.movestage.movex.value!=moveformx){
325 moveformx = document.forms.movestagetomo.movex.value;
326 movex=parseInt(moveformx);
328 //if(document.forms.movestage.movey.value!=moveformy){
329 moveformy = document.forms.movestagetomo.movey.value;
330 movey=parseInt(moveformy);
332 moveformz = document.forms.moveztomo.movez.value;
333 movez=parseInt(moveformz);
336 moveformas = document.forms.setting.standardnum.value;
337 movea = parseInt(moveformas);
338 stagecontrol('stage', movex, movey, movez, movea);
339 emcondition('request');
340 } else if (tiltmode == 2) {
341 moveformat = document.forms.setting.tiltingnum.value;
342 movea = parseInt(moveformat);
343 stagecontrol('stage', movex, movey, movez, movea*(Math.cos(movea * (Math.PI / 180))));
344 emcondition('request');
346 stagecontrol('stage',movex,movey,movez,movea);
347 emcondition('request');
352 var movez = document.forms.s2.movez.value;
358 var img = new Image();
360 img.onload = function() {
361 //イメージがロードするのを待つ必要があるのでonload
362 //context.scale(movez*0.1,movez*0.1);
363 //context.setTransform(movez*0.1,0,0,movez*0.1,0,0);
364 //context.translate(540/2,605/2);
365 context.drawImage(img, movex, movey);
366 //イメージを描写、引数は画像のオブジェクト,左端のx,y
367 document.getElementById("currenttomox").innerHTML = movex;
368 document.getElementById("currenttomoy").innerHTML = movey;
369 console.log("x=" + movex);
370 console.log("y=" + movey);
374 img.src = "./image/axoF11-2 .jpg";
377 context.strokeStyle = "#000000";
379 context.strokeRect(5, 5, 505, 610);
380 //わくの輪郭を書く、引数は左端のx,y,幅,高さ
385 function controlmodeselect(modename){
386 document.getElementById("key").style.backgroundColor = 'transparent';
387 document.getElementById("key2").style.backgroundColor = 'transparent';
388 document.getElementById("key3").style.backgroundColor = 'transparent';
389 document.getElementById("formmode").style.backgroundColor = 'transparent';
390 document.getElementById("formmode2").style.backgroundColor = 'transparent';
391 document.getElementById("formmode3").style.backgroundColor = 'transparent';
392 document.getElementById("gamepad").style.backgroundColor = 'transparent';
393 document.getElementById("gamepad2").style.backgroundColor = 'transparent';
394 document.getElementById("gamepad3").style.backgroundColor = 'transparent';
397 document.getElementById(modename).style.backgroundColor = '#e0ffff';
403 * To change this license header, choose License Headers in Project Properties.
404 * To change this template file, choose Tools | Templates
405 * and open the template in the editor.
409 radio = document.getElementsByName('tilting');
410 document.getElementById('angurar').innerHTML= document.forms.setting.tiltingnum.value;
411 if (radio[0].checked) {
413 document.getElementById('standard').style.display = "";
414 document.getElementById('saxtorn').style.display = "none";
415 } else if (radio[1].checked) {
417 document.getElementById('standard').style.display = "none";
418 document.getElementById('saxtorn').style.display = "";
422 function canvasmds() {
423 var theCanvas = document.getElementById("canvasmds");
424 //canvasとして利用するhtmlのタグの場所を指定
425 var context = theCanvas.getContext("2d");
427 function drawScreen() {
429 context.fillStyle = "fffffaa";
431 context.fillRect(0, 0, 540, 605);
434 //if(document.forms.movestage.movex.value!=moveformx){
435 moveformx = document.forms.movestagemds.movex.value;
436 movex=parseInt(moveformx);
438 //if(document.forms.movestage.movey.value!=moveformy){
439 moveformy = document.forms.movestagemds.movey.value;
440 movey=parseInt(moveformy);
442 moveformz = document.forms.movezmds.movez.value;
443 movez=parseInt(moveformz);
446 stagecontrol('stage',movex,movey,movez,movea);
447 emcondition('request');
452 var movez = document.forms.s2.movez.value;
458 var img = new Image();
460 img.onload = function() {
461 //イメージがロードするのを待つ必要があるのでonload
462 //context.scale(movez*0.1,movez*0.1);
463 //context.setTransform(movez*0.1,0,0,movez*0.1,0,0);
464 //context.translate(540/2,605/2);
465 context.drawImage(img, movex, movey);
466 //イメージを描写、引数は画像のオブジェクト,左端のx,y
467 document.getElementById("currentmdsx").innerHTML = movex;
468 document.getElementById("currentmdsy").innerHTML = movey;
469 console.log("x=" + movex);
470 console.log("y=" + movey);
474 img.src = "./image/flower.jpg";
477 context.strokeStyle = "#000000";
479 context.strokeRect(5, 5, 505, 610);
480 //わくの輪郭を書く、引数は左端のx,y,幅,高さ
485 function shiftplace() {
487 movex = parseInt(movex) + parseInt(10);
488 stagecontrol('stage', movex, movey, movez, movea);
489 emcondition('request');
495 movex = parseInt(movex) - parseInt(10);
496 stagecontrol('stage', movex, movey, movez, movea);
497 emcondition('request');
502 function canvasroot() {
503 var theCanvas = document.getElementById("canvasroot");
504 //canvasとして利用するhtmlのタグの場所を指定
505 var context = theCanvas.getContext("2d");
508 function drawScreen() {
510 context.fillStyle = "fffffaa";
512 context.fillRect(0, 0, 200, 200);
515 //if(document.forms.movestage.movex.value!=moveformx){
516 moveformx = document.forms.movestage.movex.value;
517 movex=parseInt(moveformx);
519 //if(document.forms.movestage.movey.value!=moveformy){
520 moveformy = document.forms.movestage.movey.value;
521 movey=parseInt(moveformy);
523 moveformz = document.forms.moveza.movez.value;
524 movez=parseInt(moveformz);
527 stagecontrol('stage',movex,movey,movez,movea);
528 emcondition('request');
533 var movez = document.forms.s2.movez.value;
539 var img = new Image();
541 img.onload = function() {
542 //イメージがロードするのを待つ必要があるのでonload
543 //context.scale(movez*0.1,movez*0.1);
544 //context.setTransform(movez*0.1,0,0,movez*0.1,0,0);
545 //context.translate(540/2,605/2);
546 context.drawImage(img, movex, movey);
547 //イメージを描写、引数は画像のオブジェクト,左端のx,y
548 document.getElementById("currentx").innerHTML = movex;
549 document.getElementById("currenty").innerHTML = movey;
550 console.log("x=" + movex);
551 console.log("y=" + movey);
556 img.src = "./image/ele.jpg";
559 context.strokeStyle = "#000000";
561 context.strokeRect(5, 5, 505, 610);
562 //わくの輪郭を書く、引数は左端のx,y,幅,高さ