Repository navigation
Expand file tree
/
Copy pathpano.html
More file actions
64 lines (53 loc) · 1.64 KB
/
Copy pathpano.html
File metadata and controls
64 lines (53 loc) · 1.64 KB
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
<!DOCTYPE HTML>
<head>
<script src="../css3d.js"></script>
<style>
#main{
width: 500px;
width: 500px;
}
</style>
</head>
<body>
<div id="main">
</div>
<script>
//创建场景
var s = new C3D.Stage();
s.size(window.innerWidth, window.innerHeight).material({
color : "#cccccc"
}).update();
document.getElementById('main').appendChild(s.el);
//创建1个立方体放入场景
var c = new C3D.Cube();
c.size(1024).position(0, 0, 0).material({
front : "images/cube_FR.jpg",
back : "images/cube_BK.jpg",
left : "images/cube_LF.jpg",
right : "images/cube_RT.jpg",
up : "images/cube_UP.jpg",
down : "images/cube_DN.jpg"
}).update();
s.addChild(c);
//响应屏幕调整尺寸
function resize() {
s.size(window.innerWidth, window.innerHeight).update();
};
window.onresize = function() {
resize();
};
resize();
//刷新场景
requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame ||
function(callback) {
setTimeout(callback, 1000 / 60);
};
function go() {
// c.rotate(0, 0.1, 0).updateT();
// sp.move(0, 1, 0).update();
s.camera.rotate(0,0.3,0).updateT();
requestAnimationFrame(go);
}
requestAnimationFrame(go);
</script>
</body>