-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
76 lines (54 loc) · 1.63 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Panorama Viewer v0.1</title>
<script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>
<script src="https://npmcdn.com/[email protected]"></script>
<script src="https://npmcdn.com/[email protected]"></script>
<script src="https://npmcdn.com/[email protected]"></script>
<script src="https://npmcdn.com/[email protected]"></script>
<script src="components/set-image.js"></script>
<style>
#frame {
border: 10px dashed #ccc;
width: 1024px;
height: 512px;
margin: 20px auto;
}
#frame.hover {
border: 10px dashed #333;
}
</style>
</head>
<body>
<div id='frame'>
<a-scene embedded>
<a-sky id='image-360' radius='10' src=''></a-sky>
</a-scene>
</div>
<script>
var frame = document.getElementById('frame');
var sky = document.getElementById('image-360');
frame.ondragover = function() {
this.className = 'hover';
return false;
};
frame.ondragend = function() {
this.className = '';
return false;
};
frame.ondrop = function(e) {
this.className = '';
e.preventDefault;
var file = e.dataTransfer.files[0];
var reader = new FileReader();
reader.onload = function(event) {
sky.setAttribute('src', 'url(' + event.target.result + ') no-repeat center');
};
reader.readAsDataURL(file);
return false;
};
</script>
</body>
</html>