-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex2.html
73 lines (71 loc) · 2.52 KB
/
index2.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/open/libs/weui/1.1.2/weui.min.css">
<script type="text/javascript" src="https://cunjinli6.github.io/jWeixin.js?t=4"></script>
</head>
<body>
<img style="width:50px; height:50px;" id="img">change12
<div id='div' style="-webkit-overflow-scrolling:touch;width:100%;"></div>
<div style="position:fixed;bottom:0;left:0;right:0;height:30px;">bottom div</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r71/three.min.js"></script>
<script type="text/javascript">
var camera, scene, renderer;
var mesh;
init();
animate();
// d2()
setTimeout(function() {
requestAnimationFrame(fps);
// fps2d()
}, 3000);
var c
function d2() {
c=document.createElement("c");
document.getElementById('div').appendChild(c);
var ctx=c.getContext("2d");
ctx.fillStyle="red";
ctx.fillRect(0,0,300,150);
}
function init() {
renderer = new THREE.WebGLRenderer({ alpha: true, preserveDrawingBuffer: false });
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
document.getElementById('div').appendChild(renderer.domElement);
//
camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000);
camera.position.z = 400;
scene = new THREE.Scene();
var geometry = new THREE.BoxGeometry(200, 200, 200);
var material = new THREE.MeshNormalMaterial();
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
window.addEventListener('resize', onWindowResize, false);
setTimeout(function() {
document.getElementById("img").src = renderer.domElement.toDataURL()
}, 2000)
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
function animate() {
requestAnimationFrame(animate);
mesh.rotation.x += 0.005;
mesh.rotation.y += 0.01;
renderer.render(scene, camera);
// document.getElementById("img").src = renderer.domElement.toDataURL()
}
function fps() {
// var context = renderer.domElement.getContext("webgl")
// context.drawArrays(context.POINTS, 0, 1)
document.getElementById("img").src = renderer.domElement.toDataURL()
}
function fps2d() {
document.getElementById("img").src = c.toDataURL()
}
</script>
</body>
</html>