-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
187 lines (153 loc) · 6.13 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<!--SOULACE an experiment using ThreeJS-->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Soulace-An escape...</title>
<link href="https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,600;0,700;1,400&display=swap" rel="stylesheet">
<style>
body { margin: 0; }
canvas { display: block; }
.intro{
position:absolute;
margin:0;
z-index:100;
height:200vh;
width:100vw;
background-color:#1d1d1cad;
text-align:center;
box-sizing: border-box;
display: block;
}
.intro h1{
margin:38vh auto 0vh;
font-size:10vw;
font-family:'Raleway',Sans-serif;
color:white;
letter-spacing: 2vw;
box-sizing: border-box;
font-weight: bold;
}
.intro h2{
font-size: 2vw;
font-family: 'Raleway',Sans-serif;
color:white;
font-style: italic;
font-weight: 10 ;
}
.intro input{
height:6vh;
width:10vw;
position: relative;
margin:3vh auto;
font-size:1.5vw;
font-family: 'Raleway',sans-serif;
color:white;
background-color: black;
border:none;
outline:none;
}
#credits{
font-family: 'Raleway',Sans-serif;
font-size:1vw;
color:white;
margin:10vh auto 0;
text-align:center;
}
a:link,a:visited{
color:yellow;
text-decoration:none;
}
@media only screen and (max-width:500px){
.intro h1{
font-size:9vh;
}
.intro h2{
font-size:2vh;
}
.intro input{
font-size:1.5vh;
height:8vw;
width:12vh;
}
#credits{
font-size:3vw;
margin:25vh auto 0;
}
</style>
</head>
<body>
<script type="module">
import * as THREE from 'https://unpkg.com/three@0.121.1/build/three.module.js';
import { OrbitControls } from 'https://unpkg.com/three@0.121.1/examples/jsm/controls/OrbitControls.js';
function initialise_scenes(){
let scene=new THREE.Scene();
let camera= new THREE.PerspectiveCamera(55,window.innerWidth/window.innerHeight,45,3000);
camera.position.set(-200,-200,-700);
let renderer= new THREE.WebGLRenderer({antialias:true});
renderer.setSize(window.innerWidth,window.innerHeight);
document.body.appendChild(renderer.domElement);
let controls= new OrbitControls(camera,renderer.domElement);
controls.addEventListener('change',renderer);
controls.minDistance=100;
controls.maxDistance=500;
//adding the materials
let materials=[];
let texture_negx= new THREE.TextureLoader().load('mount/negx.jpg');
let texture_negy= new THREE.TextureLoader().load('mount/negy.jpg');
let texture_negz= new THREE.TextureLoader().load('mount/negz.jpg');
let texture_posx= new THREE.TextureLoader().load('mount/posx.jpg');
let texture_posy= new THREE.TextureLoader().load('mount/posy.jpg');
let texture_posz= new THREE.TextureLoader().load('mount/posz.jpg');
materials.push(new THREE.MeshBasicMaterial({map:texture_posx}));
materials.push(new THREE.MeshBasicMaterial({map:texture_negx}));
materials.push(new THREE.MeshBasicMaterial({map:texture_posy}));
materials.push(new THREE.MeshBasicMaterial({map:texture_negy}));
materials.push(new THREE.MeshBasicMaterial({map:texture_posz}));
materials.push(new THREE.MeshBasicMaterial({map:texture_negz}));
for(let i=0;i<6;i++)
materials[i].side=THREE.BackSide;
let geometry= new THREE.BoxGeometry(1000,1000,1000);
let cube= new THREE.Mesh(geometry,materials);
scene.add(cube); // added at (0,0,0) by default
//rendering using requestAnimationFrame
function animate(){
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();
}
initialise_scenes();
</script>
<script>
let opac=10,x;
function enter_in(){
x=setInterval(fade_out,80);
document.getElementById('backsong').play();
}
function fade_out(){
if(opac==0)
{
document.getElementsByClassName('intro')[0].style.display="none";
clearInterval(x);
}
else{
opac--;
document.getElementsByClassName('intro')[0].style.opacity=opac/10;
}
}
</script>
<audio loop id="backsong">
<source src="mount.mp3" type="audio/mpeg">
Sorry! Your browser does not support audio
</audio>
<div class="intro">
<h1>SOULACE</h1>
<h2>A glimpse into nature...</h2>
<input type="button" value="Start" onclick="enter_in()">
<div id="credits">
Special thanks to <a href="http://www.humus.name/">Emil Perrson</a> for images
</div>
</div>
</body>
</html>