-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgames.html
319 lines (266 loc) · 11.2 KB
/
games.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ElijahRus | Games</title>
<meta name="description" content="Ever wanted to just sit back and play some old school games? Here you can do that. Play by yourself or with a friend!"/>
<meta name="theme-color" content="#ffc800" />
<meta name="msapplication-TileColor" content="#ffc800" />
<meta name="description" content="Welcome to my site! I have put some games, and some fun pages on this site about me. I would love it if you could check it out! On this page you will find some fun clasic games in a modern forum">
<meta name="keywords" content="ElijahRus, ElijahRus, ElijahRus.xyz, Elijah, Retro, games, oline games, friends, play">
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap" rel="stylesheet">
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">
<link rel="shortcut icon" type="image/x-icon" href="img/staticpfp.png"/>
</head>
<body>
<div class="wrapper">
<div class="nav">
<div class="logo">
<h4>ElijahRus</h4>
</div>
<div class="links">
<a href="https://elijahrus.xyz/">Home</a>
<a href="https://elijahrus.xyz/games"class="mainlink" >Games</a>
<a href="https://elijahrus.xyz/projects">Projects</a>
<a href="https://elijahrus.xyz/connect">Connect</a>
<a href="https://elijahrus.xyz/credits">Credits</a>
</div>
</div>
<!-- LANDING PAGE -->
<div class="landing">
<div class="landingText" data-aos="fade-up" data-aos-duration="1000">
<h1>Games<span style="color:#e0501b;font-size: 4vw">!</span> </h1>
<h3>Welcome to the games page, I like to play games and you might to!<br> There are a few of the clasic old school games on this site! Scroll down and check them out!</h3>
</div>
<div class="landingImage" data-aos="fade-down" data-aos-duration="2000">
<img src="img/games.png" alt="">
</div>
</div>
<!-- INFO SECTION -->
<div class="infoSection">
<div class="infoHeader" data-aos="fade-up" data-aos-duration="1000">
<h1>Lets Play <br> <span style="color:#e0501b">Old School Games</span> </h1>
</div>
<div class="infoCards">
<div class="card three" data-aos="fade-up" data-aos-duration="1000">
<img src="img/tetris.png" class="cardthreeImg" alt="" data-aos="fade-up" data-aos-duration="1100">
<div class="cardtetris"></div>
<div class="cardContent">
<h2>Tetris</h2>
<p>Clasic Tetris, Use your side arrows to move the blocks side to side and your up and down arrows to spin it around!</p>
<a href="https://elijahrus.xyz/games/tetris">
<div class="cardBtn">
<img src="img/next.png" alt="" class="cardIcon">
</div>
</a>
</div>
</div>
<div class="card one" data-aos="fade-up" data-aos-duration="1600">
<img src="img/snake.png" class="cardoneImg" alt="" data-aos="fade-up" data-aos-duration="1300">
<div class="cardsnake"></div>
<div class="cardContent">
<h2>Snake</h2>
<p>Clasic Snake game that you can play! Use the arrow keys to collect as many red squares as you can to grow!</p>
<a href="https://elijahrus.xyz/games/Snake">
<div class="cardBtn">
<img src="img/next.png" alt="" class="cardIcon">
</div>
</a>
</div>
</div>
<div class="card three" data-aos="fade-up" data-aos-duration="1000">
<img src="img/pong-1.png" class="cardthreeImg" alt="" data-aos="fade-up" data-aos-duration="1100">
<div class="cardbgone"></div>
<div class="cardContent">
<h2>Pong</h2>
<p>You can play with you and your friend on this one. One player gets the arrow keys and one gets the W and S keys! Have fun!</p>
<a href="https://elijahrus.xyz/games/pong">
<div class="cardBtn">
<img src="img/next.png" alt="" class="cardIcon">
</div>
</a>
</div>
</div>
</div>
</div>
<!-- FOOTER -->
<div class="footer">
<h2>ElijahRus</h2>
<div class="footerlinks">
<a href="https://elijahrus.xyz/">Home</a>
<a href="https://elijahrus.xyz/games"class="mainlink">Games</a>
<a href="https://elijahrus.xyz/projects">Projects</a>
<a href="https://elijahrus.xyz/connect">Connect</a>
<a href="https://elijahrus.xyz/credits">Credits</a>
</div>
</div>
</div>
<script src="https://unpkg.com/[email protected]/dist/aos.js"></script>
<script>
AOS.init();
</script>
<style>
#snowflakeContainer {
position: absolute;
left: 0px;
top: 0px;
display: none;
}
.snowflake {
position: fixed;
background-color: #CCC;
user-select: none;
z-index: 1000;
pointer-events: none;
border-radius: 50%;
width: 10px;
height: 10px;
}
</style>
<div id="snowflakeContainer">
<span class="snowflake"></span>
</div>
<script>
// Array to store our Snowflake objects
var snowflakes = [];
// Global variables to store our browser's window size
var browserWidth;
var browserHeight;
// Specify the number of snowflakes you want visible
var numberOfSnowflakes = 51;
// Flag to reset the position of the snowflakes
var resetPosition = false;
// Handle accessibility
var enableAnimations = false;
var reduceMotionQuery = matchMedia("(prefers-reduced-motion)");
// Handle animation accessibility preferences
function setAccessibilityState() {
if (reduceMotionQuery.matches) {
enableAnimations = false;
} else {
enableAnimations = true;
}
}
setAccessibilityState();
reduceMotionQuery.addListener(setAccessibilityState);
//
// It all starts here...
//
function setup() {
if (enableAnimations) {
window.addEventListener("DOMContentLoaded", generateSnowflakes, false);
window.addEventListener("resize", setResetFlag, false);
}
}
setup();
//
// Constructor for our Snowflake object
//
function Snowflake(element, speed, xPos, yPos) {
// set initial snowflake properties
this.element = element;
this.speed = speed;
this.xPos = xPos;
this.yPos = yPos;
this.scale = 1;
// declare variables used for snowflake's motion
this.counter = 0;
this.sign = Math.random() < 0.5 ? 1 : -1;
// setting an initial opacity and size for our snowflake
this.element.style.opacity = (.1 + Math.random()) / 3;
}
//
// The function responsible for actually moving our snowflake
//
Snowflake.prototype.update = function () {
// using some trigonometry to determine our x and y position
this.counter += this.speed / 5000;
this.xPos += this.sign * this.speed * Math.cos(this.counter) / 40;
this.yPos += Math.sin(this.counter) / 40 + this.speed / 30;
this.scale = .5 + Math.abs(10 * Math.cos(this.counter) / 20);
// setting our snowflake's position
setTransform(Math.round(this.xPos), Math.round(this.yPos), this.scale, this.element);
// if snowflake goes below the browser window, move it back to the top
if (this.yPos > browserHeight) {
this.yPos = -50;
}
}
//
// A performant way to set your snowflake's position and size
//
function setTransform(xPos, yPos, scale, el) {
el.style.transform = `translate3d(${xPos}px, ${yPos}px, 0) scale(${scale}, ${scale})`;
}
//
// The function responsible for creating the snowflake
//
function generateSnowflakes() {
// get our snowflake element from the DOM and store it
var originalSnowflake = document.querySelector(".snowflake");
// access our snowflake element's parent container
var snowflakeContainer = originalSnowflake.parentNode;
snowflakeContainer.style.display = "block";
// get our browser's size
browserWidth = document.documentElement.clientWidth;
browserHeight = document.documentElement.clientHeight;
// create each individual snowflake
for (var i = 0; i < numberOfSnowflakes; i++) {
// clone our original snowflake and add it to snowflakeContainer
var snowflakeClone = originalSnowflake.cloneNode(true);
snowflakeContainer.appendChild(snowflakeClone);
// set our snowflake's initial position and related properties
var initialXPos = getPosition(50, browserWidth);
var initialYPos = getPosition(50, browserHeight);
var speed = 5 + Math.random() * 40;
// create our Snowflake object
var snowflakeObject = new Snowflake(snowflakeClone,
speed,
initialXPos,
initialYPos);
snowflakes.push(snowflakeObject);
}
// remove the original snowflake because we no longer need it visible
snowflakeContainer.removeChild(originalSnowflake);
moveSnowflakes();
}
//
// Responsible for moving each snowflake by calling its update function
//
function moveSnowflakes() {
if (enableAnimations) {
for (var i = 0; i < snowflakes.length; i++) {
var snowflake = snowflakes[i];
snowflake.update();
}
}
// Reset the position of all the snowflakes to a new value
if (resetPosition) {
browserWidth = document.documentElement.clientWidth;
browserHeight = document.documentElement.clientHeight;
for (var i = 0; i < snowflakes.length; i++) {
var snowflake = snowflakes[i];
snowflake.xPos = getPosition(50, browserWidth);
snowflake.yPos = getPosition(50, browserHeight);
}
resetPosition = false;
}
requestAnimationFrame(moveSnowflakes);
}
//
// This function returns a number between (maximum - offset) and (maximum + offset)
//
function getPosition(offset, size) {
return Math.round(-1 * offset + Math.random() * (size + 2 * offset));
}
//
// Trigger a reset of all the snowflakes' positions
//
function setResetFlag(e) {
resetPosition = true;
}
</script>
</body>
</html>