-
Notifications
You must be signed in to change notification settings - Fork 0
/
jqueryTest.php
95 lines (93 loc) · 4.58 KB
/
jqueryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<html>
<?php
include 'php/template.php';
head('JqueryTest', 'JqueryTest');
?>
<body>
<?php
navBar();
?>
<div class="container">
<div class="row">
<div class="col-lg-12" >
<div id="editor">
<p id="coordinates">LOADING...</p>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("body").mousemove(function(event){
document.getElementById("coordinates").innerHTML="Your mouse is at: ("+ event.pageX +"," + event.pageY+")";
});
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/84/three.js"></script>
<script>
var camera, scene, renderer;
var mesh;
init();
animate();
function init() {
width = 600;
height = 600;
camera = new THREE.PerspectiveCamera( 50, width / height, 1, 1000 );
camera.position.z = 400;
scene = new THREE.Scene();
var texture = new THREE.TextureLoader().load( 'http://addisonsnyder.com/pics/URL_Fetcher.png' );
var materials = [
new THREE.MeshBasicMaterial({
map: texture
}),
new THREE.MeshBasicMaterial({
map: texture
}),
new THREE.MeshBasicMaterial({
map: texture
}),
new THREE.MeshBasicMaterial({
map: texture
}),
new THREE.MeshBasicMaterial({
map: texture
}),
new THREE.MeshBasicMaterial({
map: texture
})
];
dice = new THREE.Mesh(
new THREE.BoxGeometry( 200, 200, 200 ),
new THREE.MultiMaterial( materials ) );
scene.add( dice );
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( width, height );
document.getElementById("editor").appendChild( renderer.domElement );
//
window.addEventListener( 'resize', onWindowResize, false );
$("canvas").mousemove(function(e) {
dice.rotation.x = e.pageX/100;
dice.rotation.y = e.pageY/100;
})
}
function onWindowResize() {
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setSize( width, height );
}
function animate() {
requestAnimationFrame( animate );
renderer.render( scene, camera );
}
$(document).ready(function() {
$('img').click(function(e) {
var offset = $(this).offset();
alert((e.pageX - offset.left) + "," + (e.pageY - offset.top));
});
});
</script>
</div>
</div>
<img class="img" src="pics/Map1.PNG" alt="">
</div>
</div>
</body>
</html>