Skip to content

Commit 88661d3

Browse files
committed
Created universal code, added theme to resume.html
1 parent 617cbf8 commit 88661d3

File tree

8 files changed

+227
-217
lines changed

8 files changed

+227
-217
lines changed

assets/home.css

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
1-
/* Fonts */
2-
3-
@font-face {
4-
font-family: 'rampage-monoline';
5-
src: url('../fonts/rampage-monoline.woff2') format('woff2'),
6-
url('../fonts/rampage-monoline.woff') format('woff');
7-
font-weight: normal;
8-
font-style: normal;
9-
}
10-
@font-face {
11-
font-family: 'roboto';
12-
src: url('../fonts/roboto.woff2') format('woff2'),
13-
url('../fonts/roboto.woff') format('woff');
14-
font-weight: normal;
15-
font-style: normal;
16-
}
17-
18-
/* General Styling */
19-
body {
20-
font-family: 'roboto', sans-serif;
21-
margin: 0;
22-
padding: 0;
23-
line-height: 1.6;
24-
color: #001729; /* Light blue text */
25-
background: linear-gradient(to bottom, #b8deff, #519de4, #004b91);
26-
}
271

282
/* Header */
293
header {

assets/home.html

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,12 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Joseph Lavoie - Portfolio</title>
7+
<link rel="stylesheet" href="load/universal.css">
78
<link rel="stylesheet" href="home.css">
89
</head>
910
<body>
10-
<header>
11-
<nav>
12-
<ul>
13-
<li><a href="#home"><img src="../images/home.png" alt="Home Icon"> Home</a></li>
14-
<li><a href="#projects"><img src="../images/projects.png" alt="Projects Icon"> Projects</a></li>
15-
<li><a href="#skills"><img src="../images/skills.png" alt="Skills Icon"> Skills</a></li>
16-
<li><a href="#education"><img src="../images/education.png" alt="Education Icon"> Education</a></li>
17-
<li><a href="#contact"><img src="../images/contact.png" alt="Contact Icon"> Contact</a></li>
18-
<li><a href="resume.html"><img src="../images/skills.png" alt="Contact Icon">Resume</a></li>
19-
</ul>
20-
</nav>
21-
</header>
11+
<header></header>
12+
2213
<section id="home">
2314
<h1>Joseph JP Lavoie</h1>
2415
<p>Aspiring Software Developer | 3.63 GPA | Passionate about innovation and problem-solving</p>
@@ -81,6 +72,7 @@ <h2>Contact</h2>
8172
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.19.0/matter.min.js"></script>
8273
<script src="https://unpkg.com/matter-wrap"></script>
8374
<script src="script.js"></script>
75+
<script src="load/universal.js"></script>
8476
<canvas id="bg"></canvas>
8577
</body>
8678
</html>

assets/load/header.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<header>
2+
<nav>
3+
<ul>
4+
<li><a href="#home"><img src="../images/home.png" alt="Home Icon"> Home</a></li>
5+
<li><a href="#projects"><img src="../images/projects.png" alt="Projects Icon"> Projects</a></li>
6+
<li><a href="#skills"><img src="../images/skills.png" alt="Skills Icon"> Skills</a></li>
7+
<li><a href="#education"><img src="../images/education.png" alt="Education Icon"> Education</a></li>
8+
<li><a href="#contact"><img src="../images/contact.png" alt="Contact Icon"> Contact</a></li>
9+
<li><a href="resume.html"><img src="../images/skills.png" alt="Contact Icon">Resume</a></li>
10+
</ul>
11+
</nav>
12+
</header>

assets/load/universal.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Fonts */
2+
3+
@font-face {
4+
font-family: 'rampage-monoline';
5+
src: url('../fonts/rampage-monoline.woff2') format('woff2'),
6+
url('../fonts/rampage-monoline.woff') format('woff');
7+
font-weight: normal;
8+
font-style: normal;
9+
}
10+
@font-face {
11+
font-family: 'roboto';
12+
src: url('../fonts/roboto.woff2') format('woff2'),
13+
url('../fonts/roboto.woff') format('woff');
14+
font-weight: normal;
15+
font-style: normal;
16+
}
17+
18+
19+
/* General Styling */
20+
body {
21+
font-family: 'roboto', sans-serif;
22+
margin: 0;
23+
padding: 0;
24+
line-height: 1.6;
25+
color: #001729; /* Light blue text */
26+
background: linear-gradient(to bottom, #b8deff, #519de4, #004b91);
27+
}

assets/load/universal.js

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
document.addEventListener("DOMContentLoaded", () => {
2+
fetch('header.html')
3+
.then(response => response.text())
4+
.then(data => {
5+
document.querySelector('header').innerHTML = data;
6+
});
7+
});
8+
9+
const footer = document.querySelector('footer p');
10+
footer.innerHTML = ${new Date().getFullYear()} Joseph Lavoie`;
11+
12+
13+
Matter.use('matter-wrap');
14+
15+
let floatyBubbles = {
16+
options: {
17+
canvasSelector: '', // to find <canvas> in DOM to draw on
18+
radiusRange: [50, 100], // random range of body radii
19+
xVarianceRange: [-0.5, 0.5], // random range of x velocity scaling on bodies
20+
yVarianceRange: [0.5, 1.5], // random range of y velocity scaling on bodies
21+
airFriction: 0.03, // air friction of bodies
22+
opacity: 1, // opacity of bodies
23+
collisions: true, // do bodies collide or pass through
24+
scrollVelocity: 0.025, // scaling of scroll delta to velocity applied to bodies
25+
pixelsPerBody: 50000, // viewport pixels required for each body added
26+
27+
// colors to cycle through to fill bodies
28+
colors: ['#e4e4cc', '#e1d2c4', '#d1e4df']
29+
},
30+
31+
// throttling intervals (in ms)
32+
scrollDelay: 100,
33+
resizeDelay: 400,
34+
35+
// throttling variables and timeouts
36+
lastOffset: undefined,
37+
scrollTimeout: undefined,
38+
resizeTimeout: undefined,
39+
40+
// Matter.js objects
41+
engine: undefined,
42+
render: undefined,
43+
runner: undefined,
44+
bodies: undefined,
45+
46+
// Starts the bubbles
47+
init(options) {
48+
// override default options with incoming options
49+
this.options = Object.assign({}, this.options, options);
50+
51+
let viewportWidth = document.documentElement.clientWidth;
52+
let viewportHeight = document.documentElement.clientHeight;
53+
54+
this.lastOffset = window.pageYOffset;
55+
this.scrollTimeout = null;
56+
this.resizeTimeout = null;
57+
58+
// engine
59+
this.engine = Matter.Engine.create();
60+
this.engine.world.gravity.y = 0;
61+
62+
// render
63+
this.render = Matter.Render.create({
64+
canvas: document.querySelector(this.options.canvasSelector),
65+
engine: this.engine,
66+
options: {
67+
width: viewportWidth,
68+
height: viewportHeight,
69+
wireframes: false,
70+
background: 'transparent'
71+
}
72+
});
73+
Matter.Render.run(this.render);
74+
75+
// runner
76+
this.runner = Matter.Runner.create();
77+
Matter.Runner.run(this.runner, this.engine);
78+
79+
// bodies
80+
this.bodies = [];
81+
let totalBodies = Math.round(viewportWidth * viewportHeight / this.options.pixelsPerBody);
82+
for (let i = 0; i <= totalBodies; i++) {
83+
let body = this.createBody(viewportWidth, viewportHeight);
84+
this.bodies.push(body);
85+
}
86+
Matter.World.add(this.engine.world, this.bodies);
87+
88+
// events
89+
window.addEventListener('scroll', this.onScrollThrottled.bind(this));
90+
window.addEventListener('resize', this.onResizeThrottled.bind(this));
91+
},
92+
93+
// stop all bubbles
94+
shutdown() {
95+
Matter.Engine.clear(this.engine);
96+
Matter.Render.stop(this.render);
97+
Matter.Runner.stop(this.runner);
98+
99+
window.removeEventListener('scroll', this.onScrollThrottled);
100+
window.removeEventListener('resize', this.onResizeThrottled);
101+
},
102+
103+
// random number generator
104+
randomize(range) {
105+
let [min, max] = range;
106+
return Math.random() * (max - min) + min;
107+
},
108+
109+
// create body with some random parameters
110+
createBody(viewportWidth, viewportHeight) {
111+
let x = this.randomize([0, viewportWidth]);
112+
let y = this.randomize([0, viewportHeight]);
113+
let radius = this.randomize(this.options.radiusRange);
114+
let color = this.options.colors[this.bodies.length % this.options.colors.length];
115+
116+
return Matter.Bodies.circle(x, y, radius, {
117+
render: {
118+
fillStyle: color,
119+
opacity: this.options.opacity
120+
},
121+
frictionAir: this.options.airFriction,
122+
collisionFilter: {
123+
group: this.options.collisions ? 1 : -1
124+
},
125+
plugin: {
126+
wrap: {
127+
min: { x: 0, y: 0 },
128+
max: { x: viewportWidth, y: viewportHeight }
129+
}
130+
}
131+
});
132+
},
133+
134+
// enforces throttling of scroll handler
135+
onScrollThrottled() {
136+
if (!this.scrollTimeout) {
137+
this.scrollTimeout = setTimeout(this.onScroll.bind(this), this.scrollDelay);
138+
}
139+
},
140+
141+
// applies velocity to bodies based on scrolling with some randomness
142+
onScroll() {
143+
this.scrollTimeout = null;
144+
145+
let delta = (this.lastOffset - window.pageYOffset) * this.options.scrollVelocity;
146+
this.bodies.forEach((body) => {
147+
Matter.Body.setVelocity(body, {
148+
x: body.velocity.x + delta * this.randomize(this.options.xVarianceRange),
149+
y: body.velocity.y + delta * this.randomize(this.options.yVarianceRange)
150+
});
151+
});
152+
153+
this.lastOffset = window.pageYOffset;
154+
},
155+
156+
// enforces throttling of resize handler
157+
onResizeThrottled() {
158+
if (!this.resizeTimeout) {
159+
this.resizeTimeout = setTimeout(this.onResize.bind(this), this.resizeDelay);
160+
}
161+
},
162+
163+
// restart everything with the new viewport size
164+
onResize() {
165+
this.shutdown();
166+
this.init();
167+
}
168+
};
169+
170+
// wait for DOM to load
171+
window.addEventListener('DOMContentLoaded', () => {
172+
// start floaty bubbles background
173+
Object.create(floatyBubbles).init({
174+
canvasSelector: '#bg'
175+
});
176+
});

assets/resume.css

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
body {
2-
font-family: Arial, sans-serif;
3-
line-height: 1.6;
4-
margin: 0;
5-
padding: 0;
6-
background-color: #f8f9fa;
7-
}
81

92
.container {
103
max-width: 800px;

assets/resume.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Joseph JP Lavoie</title>
7+
<link rel="stylesheet" href="load/universal.css">
78
<link rel="stylesheet" href="resume.css">
89
</head>
910
<body>
1011
<div class="container">
11-
<header>
12+
<header></header>
13+
<section>
1214
<h1>Joseph JP Lavoie</h1>
1315
<p>Fredericton, New Brunswick, Canada</p>
1416
<p>Email: <a href="mailto:[email protected]">[email protected]</a> | Phone: (319) 280-2100</p>
1517
<p>
1618
GitHub: <a href="https://github.com/Code-JL" target="_blank">github.com/Code-JL</a> |
1719
LinkedIn: <a href="https://linkedin.com/in/joseph-lavoie-803470260/" target="_blank">linkedin.com/in/joseph-lavoie</a>
1820
</p>
19-
</header>
20-
21+
</section>
2122
<section>
2223
<h2>Professional Summary</h2>
2324
<p>
@@ -68,5 +69,9 @@ <h2>About Me</h2>
6869
<a href="../files/Resume%20-%20Joseph%20Lavoie.pdf" download class="download-btn"><img src="../images/download.png" alt="Download Icon"> Download Resume!</a>
6970
</footer>
7071
</div>
72+
73+
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.19.0/matter.min.js"></script>
74+
<script src="https://unpkg.com/matter-wrap"></script>
75+
<script src="load/universal.js"></script>
7176
</body>
7277
</html>

0 commit comments

Comments
 (0)