Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood 2022-12-13 16:27:44 -05:00
parent bc71995cf0
commit 55aaac8220
2 changed files with 16 additions and 6 deletions

View file

@ -22,7 +22,7 @@
<canvas id="bg" alt=""></canvas>
<div class="text-container">
<h1>Hi, I&rsquo;m Naman.</h1>
<h3>I&rsquo;m a<span class="age"> twenty one</span> year-old who's fond of <em>coffee</em>, <em>math</em>, <em>writing</em>, <em>cars</em>, <a class="among" href="javascript:among()">among</a> other things. I also enjoy <em>programming</em> enough to do that for a living. I'm currently studying <em>computer science</em> at the <em>University of Waterloo</em>.</h3>
<h3>I&rsquo;m a<span class="age"> twenty one</span> year-old who's fond of <em>coffee</em>, <em>math</em>, <em>writing</em>, <em>cars</em>, <a class="among" role="button" href="javascript:among()">among</a> other things. I also enjoy <em>programming</em> enough to do that for a living. I'm currently studying <em>computer science</em> at the <em>University of Waterloo</em>.</h3>
<h3>You can click to see my <a href="/resume.pdf">resume</a>, visit my <a href="https://prose.nsood.in">blog</a>, or check out ways to contact me below.</h3>
<div class="contact-methods">
<a href="mailto:mail@nsood.in" class="contact-method" aria-label="Email">

View file

@ -46,6 +46,7 @@ function Point() {
this.x = Math.random() * canvas.width;
this.y = snowing ? initialProgress * canvas.height / 3 : Math.random() * canvas.height;
this.r = snowing ? Math.random() * r : 0;
this.rng = Math.random();
}
this.draw = function() {
@ -57,13 +58,15 @@ function Point() {
// accidentally causing negative sine values which cause ctx.arc
// to throw errors
if(!snowing) ctx.arc(this.x, this.y, Math.abs(Math.sin(Math.PI*this.progress)*r), 0, 2*Math.PI);
else ctx.arc(this.x + 20 * Math.sin(this.progress * 3 * Math.PI), this.y, this.r, 0, 2*Math.PI);
else ctx.arc(
this.x + 20 * Math.sin(this.progress * 3 * Math.PI) + Math.cos(this.progress * (5*this.rng) * Math.PI),
this.y, this.r, 0, 2*Math.PI);
ctx.fill();
}
};
this.render = function() {
if(snowing) {
this.y += Math.pow(this.r, 0.25);
this.y += (Math.pow(this.rng, 0.25)) * 0.5 * (1 + Math.sin(this.progress % Math.PI));
this.x = (this.x + 0.3) % canvas.width; // wind
this.progress += 0.005;
this.draw();
@ -121,8 +124,8 @@ document.querySelector('.age').textContent = `${tens[Math.floor(age / 10)]} ${on
// easter egg
const sequences = [
[ 99, 108, 97, 112, 111, 102, 102 ],
[ 99, 108, 97, 112, 111, 110 ],
'CLAPOFF'.split('').map(s => 'Key' + s),
'CLAPON'.split('').map(s => 'Key' + s)
];
let eei = 0;
@ -130,7 +133,7 @@ let eei = 0;
addEventListener('keypress', e => {
const clapper = document.querySelector('.clapper');
const sequence = sequences[darkMode];
if(e.keyCode == sequence[eei]) {
if(e.code == sequence[eei]) {
eei++;
}
else {
@ -173,3 +176,10 @@ addEventListener('keypress', e => {
function among() {
alert('haha among us');
}
document.querySelector('.among').addEventListener('keypress', e => {
if(e.code === 'Space') {
e.preventDefault();
among();
}
});