-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
108 lines (99 loc) · 4.39 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/style.css">
<title>three.js - rotate</title>
</head>
<body>
<div class="title">
<span>by</span>
<a class="logo" href="https://joomation.com/home">
<svg x="0px" y="0px" viewBox="0 0 80 25">
<ellipse class="logo-svg" cx="13.6" cy="12.8" rx="3.6" ry="4.4" />
<ellipse class="logo-svg" cx="23.7" cy="12.8" rx="3.6" ry="4.4" />
<ellipse class="logo-svg" cx="64" cy="12.8" rx="3.6" ry="4.4" />
<polyline class="logo-svg" points="37.6,17.2 37.6,8.4 34.1,12 30.5,8.4 30.5,17.2 " />
<g>
<line class="logo-svg" x1="44.2" y1="14.3" x2="42" y2="14.3" />
<polyline class="logo-svg" points="47.6,17.2 44.2,8.4 40.8,17.2 " />
<line class="logo-svg" x1="44.2" y1="14.3" x2="46.5" y2="14.3" />
</g>
<g>
<line class="logo-svg" x1="48.4" y1="8.4" x2="53.8" y2="8.4" />
<line class="logo-svg" x1="51.1" y1="8.4" x2="51.1" y2="17.2" />
</g>
<line class="logo-svg" x1="56.9" y1="8.4" x2="56.9" y2="17.2" />
<polyline class="logo-svg" points="70.6,17.2 70.6,8.4 76.6,17.2 76.6,8.4 " />
<path class="logo-svg" d="M6.8,8.3c0,0,0,3.9,0,5.8s-1.5,4.3-3.8,2.3" />
</svg>
</a>
</div>
<script src="js/three.min.js"></script>
<script>
var camera;
var renderer;
function init() {
var color = new THREE.Color(0xff0000);
var scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, document.documentElement.clientWidth / document.documentElement.clientHeight, 0.1, 1000);
renderer = new THREE.WebGLRenderer({
alpha: true
});
renderer.setSize(document.documentElement.clientWidth, document.documentElement.clientHeight);
renderer.domElement.style.position = 'absolute';
renderer.domElement.style.zIndex = 1;
renderer.domElement.style.top = 0;
document.body.appendChild(renderer.domElement);
var shape = [];
geometry = new THREE.IcosahedronGeometry(2, 0);
material = new THREE.MeshLambertMaterial({
color: 0xf1f1f1,
emissive: 0x888888
});
geometryFrame = new THREE.SphereGeometry(3.5, 0);
materialFrame = new THREE.MeshBasicMaterial({
wireframe: true,
transparent: true,
opacity: 0.2,
color: 0xffffff,
});
shape[0] = new THREE.Mesh(geometryFrame, materialFrame);
shape[0].position.set(3, 5, 0);
shape[1] = new THREE.Mesh(geometry, material);
shape[1].position.set(3, 5, 0);
scene.add(shape[0]);
scene.add(shape[1]);
var skyboxGeometry = new THREE.CubeGeometry(10000, 10000, 10000);
var skyboxMaterial = new THREE.MeshBasicMaterial({
color: 0xFFFFFF,
side: THREE.BackSide
});
var skybox = new THREE.Mesh(skyboxGeometry, skyboxMaterial);
scene.add(skybox);
var pointLight = new THREE.PointLight(0x888888);
pointLight.position.set(0, 100, 500);
scene.add(pointLight);
camera.position.set(3, 5.5, 10); // x y z
function render() {
requestAnimationFrame(render);
shape[0].rotation.x -= 0.005;
shape[0].rotation.y -= 0.005;
shape[1].rotation.x += 0.003;
shape[1].rotation.y += 0.003;
renderer.render(scene, camera);
}
render();
}
init();
window.addEventListener('resize', resize, false);
function resize() {
camera.aspect = document.documentElement.clientWidth / document.documentElement.clientHeight;
camera.updateProjectionMatrix();
renderer.setSize(document.documentElement.clientWidth, document.documentElement.clientHeight);
}
</script>
</body>
</html>