-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
139 lines (104 loc) · 4.28 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,hight=device-hight,minimum-scale=1.0,maximum-scale=1.0,ser-scalable=none"/>
<title>滑稽</title>
<style type="text/css">
body { margin: 0; padding: 0; position: relative; background-image: url(img/bg.png); background-position: center; /*background-repeat: no-repeat;*/ width: 100%; height: 100%; background-size: 100% 100%; }
iframe {
display: none;
}
#coding {
position: fixed;
right: 10px;
width: 180px;
bottom: 40px;
}
#adHref{
width: 100%;
position: fixed;
left: 0px;
top: 20px;
background:rgba(0,0,0,0.1);
}
</style>
</head>
<body id="body" onLoad="init()">
<script type="text/javascript" src="js/ThreeCanvas.js"></script>
<script type="text/javascript" src="js/Snow.js"></script>
<script type="text/javascript">
var SCREEN_WIDTH = window.innerWidth;//
var SCREEN_HEIGHT = window.innerHeight;
var container;
var particle;//粒子
var camera;
var scene;
var renderer;
var starSnow = 1;
var particles = [];
var particleImage = new Image();
//THREE.ImageUtils.loadTexture( "img/ParticleSmoke.png" );
particleImage.src = 'img/huaji.png';
function init() {
//自定义对话框
//Materialize.toast('<span>切换样式</span><a class="btn-flat yellow-text" href=http://www.whuisai.top/pages/coding/>切换<a>', 5000);
//alert("message3");
container = document.createElement('div');//container:画布实例;
document.body.appendChild(container);
camera = new THREE.PerspectiveCamera( 60, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 );
camera.position.z = 1000;
//camera.position.y = 50;
scene = new THREE.Scene();
scene.add(camera);
renderer = new THREE.CanvasRenderer();
renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
var material = new THREE.ParticleBasicMaterial( { map: new THREE.Texture(particleImage) } );
//alert("message2");
for (var i = 0; i < 200; i++) {
//alert("message");
particle = new Particle3D( material);
particle.position.x = Math.random() * 2000-1000;
particle.position.z = Math.random() * 2000-1000;
particle.position.y = Math.random() * 2000-1000;
//particle.position.y = Math.random() * (1600-particle.position.z)-1000;
particle.scale.x = particle.scale.y = 1;
scene.add( particle );
particles.push(particle);
}
container.appendChild( renderer.domElement );
setInterval( loop, 1000 / 60 );
setInterval( appendHUAJI, 100 );
}
function appendHUAJI()
{
if(particles.length<3000){
var material = new THREE.ParticleBasicMaterial( { map: new THREE.Texture(particleImage) } );
particle = new Particle3D( material);
particle.position.x = Math.random() * 2000-1000;
particle.position.z = Math.random() * 2000-1000;
particle.position.y = Math.random() * 2000-1000;
//particle.position.y = Math.random() * (1600-particle.position.z)-1000;
particle.scale.x = particle.scale.y = 1;
scene.add( particle );
particles.push(particle);
}
}
function loop() {
for(var i = 0; i<particles.length; i++){
var particle = particles[i];
particle.updatePhysics();
with(particle.position)
{
if(x>1000||x<-1000) x=Math.random() * 2000-1000;
if(y>1000||y<-1000) y=Math.random() * 2000-1000;
if(z>1000||z<-1000) z=Math.random() * 2000-1000;
}
}
camera.lookAt(scene.position);
renderer.render( scene, camera );
}
</script>
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="http://music.163.com/outchain/player?type=2&id=1371159&auto=1&height=66"></iframe>
</body>
</html>