-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
330 lines (268 loc) · 10.1 KB
/
index.php
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?php
require_once "admin/connexion.php";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Outland - Le répertoire en ligne de planètes.</title>
<link rel="stylesheet" href="assets/css/reset.css">
<link rel="stylesheet" href="assets/css/style.css">
<link href="assets/se-connecter.html">
<link href="https://fonts.googleapis.com/css?family=Orbitron:500" rel="stylesheet">
<style>
body {
font-family: 'Orbitron', sans-serif;
}
</style>
</head>
<body>
<canvas id="starfield" width="100%" height="900px;"></canvas>
<header class="header">
<nav class="navbar">
<a class="navbar__logo" href="#"><img src="assets/img/outlandWhite.png" alt=""></a>
<ul class="header__items">
<li class="header__item header__item__panier"><a class="header__item" href="admin/index.php">| Paramètres</a></li>
</ul>
</nav>
<div class="header__callToAction">
<img src="assets/img/outlandWhite.svg" alt="" class="header__callToActionText">
</div>
<?php
$stmt = $conn->prepare("SELECT id, planete, image, description, temperature, km FROM planetes");
$stmt->execute();
?>
<div class="planet__containers">
<div class="planet__container">
<div class="planet__terre">
<h2 class="terre__tilte">Bienvenue sur Outland</h2>
<a href="/earth" class="planet__terre__callToActionText">Cliquez sur une planète pour avoir sa description.</a>
</div>
</div>
</div>
<img class="img__planet__terre rotating" src="https://preview.ibb.co/jKqFY7/Outreterre_Wo_W.png" alt="">
<img src="assets/img/WallE.png" class="wallE" alt="">
<div class="conatainer__nav__planet">
<?php while (false !== $row = $stmt->fetch(PDO::FETCH_ASSOC)) :?>
<div class="nav__planet__proximab">
<a href="product/index.php?id=<?= $row["id"]?>">
<img src="<?= $row["image"]?>" class="nav__planet" alt="">
</a>
</div>
<?php endwhile;?>
</div>
</header>
</body>
<script type="text/javascript">
var callToAction = document.querySelector('.header__callToActionText')
var earth = document.querySelector('.img__planet__terre')
var planet = document.querySelector('.planet__containers')
var arrowleft = document.querySelector('.planet__arrow__left')
var arrowright = document.querySelector('.planet__arrow__right')
var navbarA = document.querySelector('.navbar')
window.addEventListener('click', function() {
earth.style.transition = "all 5s"
earth.style.width = '33%'
planet.style.paddingBottom = "130px";
planet.style.marginTop = "-100px";
earth.style.position = "absolute";
callToAction.style.opacity = '1';
callToAction.style.position = 'relative';
callToAction.style.marginLeft = '-500px';
callToAction.style.transform = 'scale(0.3)';
callToAction.style.marginTop = '-270px';
callToAction.style.marginRight = '600px';
callToAction.style.transition = "all 4s"
planet.style.opacity = '1'
navbarA.style.opacity = '1'
});
var counter = 0;
var wallE = document.querySelector('.wallE')
wallE.addEventListener('click', function() {
if (counter === 1) {
wallE.style.marginRight = '-211px'
counter = O;
}
if (counter === 0) {
wallE.style.marginRight = '0px'
counter = 1;
}
});
window.onload = function() {
var element = "starfield";
var bgColor = "#030304";
var FPS = 30;
var displacementRate = 1;
var accelerationRate = 1;
var maxSpeed = 1;
var maxStars = 1000;
var speedUp = setInterval(function() {
if (accelerationRate > maxSpeed) {
clearInterval(speedUp);
}
accelerationRate = accelerationRate * 1.1;
}, 100);
var Star = function() {
this.x = 0;
this.y = 0;
this.z = 0;
this.maxDepth = 0;
this.alpha = 0;
this.radius = 0;
this.dx = 0;
this.dy = 0;
this.dz = 0;
this.ddx = 0;
this.ddy = 0;
this.drawInContext = function(ctx, deltaX, deltaY) {
ctx.beginPath();
ctx.fillStyle = "rgba(255, 255, 255," + this.alpha + ")";
ctx.arc(this.x + deltaX, this.y + deltaY, this.radius, 0, Math.PI * 2, false);
ctx.fill();
};
};
var requestAnimationFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.oRequestAnimationFrame ||
function(callback) {
return window.setTimeout(callback, 1000 / FPS);
};
function isCanvasSupported(element) {
return !!(element.getContext && element.getContext("2d"));
}
function backingScale(context) {
if ('devicePixelRatio' in window) {
if (window.devicePixelRatio > 1) {
return window.devicePixelRatio;
}
}
return 1;
}
function StarField(canvasID) {
this.canvas = document.getElementById(canvasID);
if (!isCanvasSupported(this.canvas)) {
this.canvas.className = "inactive";
this.canvas.width = window.innerWidth;
this.isCanvasEnabled = false;
return this;
}
this.isCanvasEnabled = true;
this.ctx = this.canvas.getContext("2d");
this.scaleFactor = backingScale(this.ctx);
this.stars = new Array();
function newStar() {
var star = new Star();
star.x = Math.random() * this.canvas.width - this.originX;
star.y = Math.random() * this.canvas.height - this.originY;
star.z = star.max_depth = Math.max(this.canvas.width, this.canvas.height);
star.alpha = Math.random();
star.radius = Math.random();
var xcoeff = star.x > 0 ? 1 : -1;
var ycoeff = star.y > 0 ? 1 : -1;
if (Math.abs(star.x) > Math.abs(star.y)) {
star.dx = 1.0;
star.dy = Math.abs(star.y / star.x);
} else {
star.dx = Math.abs(star.x / star.y);
star.dy = 1.0;
}
star.dx *= xcoeff * (displacementRate / 10);
star.dy *= ycoeff * (displacementRate / 10);
star.dz = -1;
star.ddx = (accelerationRate * star.dx) / 10;
star.ddy = (accelerationRate * star.dy) / 10;
return star;
}
function move(star) {
star.x += star.dx;
star.y += star.dy;
star.z += star.dz;
star.dx += star.ddx;
star.dy += star.ddy;
}
function updateStars(ctx, stars) {
for (var i = 0; i < stars.length; i++) {
move(stars[i]);
if (stars[i].x < -this.originX || stars[i].x > this.originX || stars[i].y < -this.originY || stars[i].y > this.originY) {
// Remove
stars[i] = newStar();
} else {
// Paint
var deltaX = this.originX;
var deltaY = this.originY;
stars[i].drawInContext(ctx, deltaX, deltaY);
}
}
}
this.configureGeometry = function() {
// Ensure we are always at full width
this.canvas.width = window.innerWidth;
this.canvas.style.backgroundColor = bgColor;
var ratio = 1;
// Retina support
// See https://www.html5rocks.com/en/tutorials/canvas/hidpi/
if (this.scaleFactor > 1) {
var devicePixelRatio = this.scaleFactor;
var context = this.ctx;
var backingStoreRatio = context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
ratio = devicePixelRatio / backingStoreRatio;
// Upscale the canvas if the two ratios don't match
if (devicePixelRatio !== backingStoreRatio) {
var canvas = this.canvas;
var oldWidth = canvas.width;
var oldHeight = canvas.height;
canvas.width = oldWidth * ratio;
canvas.height = oldHeight * ratio;
canvas.style.width = oldWidth + 'px';
canvas.style.height = oldHeight + 'px';
// Now scale the context to counter the fact that we've manually scaled our canvas element
context.scale(ratio, ratio);
}
}
// Starting origin of stars
var logicalWidth = this.canvas.width / ratio;
var logicalHeight = this.canvas.height / ratio;
this.originX = logicalWidth / 2;
this.originY = logicalHeight / 2;
var numStars = logicalWidth / 2;
this.numStars = numStars > maxStars ? maxStars : numStars;
}
this.render = function() {
setTimeout(function() {
// Drawing
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
updateStars(this.ctx, this.stars);
requestAnimationFrame(render);
}, 1000 / FPS);
};
// Configure origin and frames before creating initial batch of stars
this.configureGeometry();
for (var i = 0; i < this.numStars; i++) {
this.stars.push(newStar());
}
return this;
}
var starfield = StarField(element);
if (starfield.isCanvasEnabled) {
starfield.render();
}
// Make sure we adjust the canvas whenever the window resizes
// Don't rely on CSS rules for 100% width because that causes rendering issues
window.addEventListener('resize', resizeCanvas, false);
function resizeCanvas() {
if (starfield.isCanvasEnabled) {
starfield.configureGeometry();
} else {
starfield.canvas.width = window.innerWidth;
}
}
}
</script>
</html>