diff options
| author | NinoReichardt <nino.reichardt@oakk.nl> | 2026-11-14 20:29:13 +0100 |
|---|---|---|
| committer | NinoReichardt <nino.reichardt@oakk.nl> | 2026-11-14 20:29:13 +0100 |
| commit | 95f59b40978489080d2a71e2a4e8fe88a797fc6c (patch) | |
| tree | e9279ab4ffe55f1143ffc5d9134bac94ae81353c | |
| download | nire-web-95f59b40978489080d2a71e2a4e8fe88a797fc6c.tar.gz nire-web-95f59b40978489080d2a71e2a4e8fe88a797fc6c.zip | |
feat: intial static website
| -rw-r--r-- | assets/main.css | 42 | ||||
| -rw-r--r-- | assets/trees.js | 132 | ||||
| -rw-r--r-- | index.html | 42 |
3 files changed, 216 insertions, 0 deletions
diff --git a/assets/main.css b/assets/main.css new file mode 100644 index 0000000..740d495 --- /dev/null +++ b/assets/main.css @@ -0,0 +1,42 @@ +* { + font-family: "Inter", sans-serif; + font-optical-sizing: auto; + font-weight: 400; + font-style: normal; + + --text-dim: #666; + --text-normal: #333; + --text-highlighted: #000; + + --text-md: 16px; + --text-sm: 13px; +} + +p { + font-weight: 500; + color: var(--text-normal); + font-size: var(--text-md); +} + +b, a { + font-weight: 700; + color: var(--text-highlighted) +} + +.padding-x-md { + padding-inline: 0.75rem +} + +.padding-y-md { + padding-block: 0.75rem +} + +.content-width { + max-width: 30rem; + width: 100vw; +} + +.center { + display: flex; + justify-content: center; +} diff --git a/assets/trees.js b/assets/trees.js new file mode 100644 index 0000000..74d3c44 --- /dev/null +++ b/assets/trees.js @@ -0,0 +1,132 @@ +const R_10 = Math.PI / 18; +const R_90 = Math.PI / 2; +const R_180 = Math.PI; + +const BRANCH_LENGTH = 5; +const BRANCH_START = 20; +const MAX_CHILDREN = 3; +const CHILD_CHANGE = 0.4; +const CHANCE_DEGRADATION = 4000; +const NEXT_SOFT_CAP = 400; +const BRANCH_MAX_ANGLE = R_10; +const BRANCH_STAY_CHANCE = 0.5; +const BRANCH_LIMIT_PADDING = 24 + +let current = []; +let next = []; +let cycle = 0; + + +function setup() { + const canvas = createCanvas(windowWidth, windowHeight); + canvas.parent("renderer"); + frameRate(30); + background("#05050500"); + stroke(127, 127, 127, 20); + smooth(); + + cycle = 0; + current = []; + next = []; + + const start = (x, y, r) => { + for (let i = 0; i < BRANCH_START; i++) { + let length = Math.random() * BRANCH_LENGTH; + let angle = + r + Math.random() * (BRANCH_MAX_ANGLE - BRANCH_MAX_ANGLE * -1) + BRANCH_MAX_ANGLE * -1; + + current.push({ + x, + y, + x2: x + length * Math.cos(angle), + y2: y + length * Math.sin(angle), + angle, + }); + } + }; + + start( + (Math.random() * 0.6 + 0.2) * windowWidth, + windowHeight + BRANCH_LENGTH, + -R_90, + ); + start( + windowWidth + BRANCH_LENGTH, + (Math.random() * 0.6 + 0.2) * windowHeight, + R_180, + ); + start( + 0 - BRANCH_LENGTH, + (Math.random() * 0.6 + 0.2) * windowHeight, + -R_90 * 4, + ); + start((Math.random() * 0.6 + 0.2) * windowWidth, 0 - BRANCH_LENGTH, R_90); +} + +function draw() { + let currentLen = current.length; + while (currentLen--) { + let index = Math.floor(Math.random() * currentLen); + let branch = current[index]; + current.splice(index, 1); + + // queue branch for next cycle + if (Math.random() <= BRANCH_STAY_CHANCE) { + next.push(branch); + continue; + } + + // draw branch + line(branch.x, branch.y, branch.x2, branch.y2); + + // stop if soft cap is reached + if (next.length >= NEXT_SOFT_CAP) continue; + + if ( + branch.x2 > width + BRANCH_LIMIT_PADDING || + branch.x2 < -BRANCH_LIMIT_PADDING && + branch.y2 > height + BRANCH_LIMIT_PADDING || + branch.y2 < -BRANCH_LIMIT_PADDING + ) { + // stop if out of bounds + continue; + } + + let amount = MAX_CHILDREN; + + while (amount--) { + if (Math.random() > CHILD_CHANGE - cycle / CHANCE_DEGRADATION) continue; + + let length = Math.random() * BRANCH_LENGTH; + + // starting cordinates + let sx = branch.x2 + 1 * Math.cos(branch.angle); + let sy = branch.y2 + 1 * Math.sin(branch.angle); + + let angle = + branch.angle + + Math.random() * (BRANCH_MAX_ANGLE - BRANCH_MAX_ANGLE * -1) + + BRANCH_MAX_ANGLE * -1; + + // ending cordinates + let ex = branch.x2 + length * Math.cos(angle); + let ey = branch.y2 + length * Math.sin(angle); + + next.push({ + x: sx, + y: sy, + x2: ex, + y2: ey, + angle, + }); + } + } + + if (next.length == 0) { + noLoop(); + } + + current = next; + next = []; + cycle++; +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..930414e --- /dev/null +++ b/index.html @@ -0,0 +1,42 @@ +<!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>nire.dev</title> + <link rel="stylesheet" href="./assets/main.css"> + <link rel="icon" href="./favicon.ico" type="image/x-icon"> + + <!-- Inter Front --> + <link rel="preconnect" href="https://fonts.googleapis.com"> + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> + <link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet"> + + <!-- Trees P5js --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.8.0/p5.js"></script> + <script src="./assets/trees.js"></script> + </head> + <body> + <div + id="renderer" + style="position: fixed; padding: 0; margin: 0; top: 0; bottom: 0; left: 0; right: 0; z-index: -5;" + className="fixed p-0 m-0 top-0 bottom-0 left-0 right-0 z--5" + ></div> + <div class="center"> + <main class="content-width padding-x-md"> + <h1>Welcome</h1> + <p>Hey, welcome to <b>nire.dev</b>, I'm <b>Nino</b>, a recreational programmer.</p> + <p> + Software engineer at <b>OAKK Capital Partners B.V.</b> + </p> + <a href="https://github.com/NinoReichardt"> + GitHub + </a> + <a href="https://github.com/NinoReichardt"> + GitHub + </a> + </main> + </div> + </body> +</html> |
