diff --git a/LICENSE b/LICENSE index 9d5730c..924b5b0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2026 Sigitex +Copyright © 2026 Dan Finch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/assets/background.js b/assets/background.js index 286b54e..0b8afa0 100644 --- a/assets/background.js +++ b/assets/background.js @@ -1,3 +1,5 @@ +// 100% VIBES + const canvas = document.getElementById('background'); const gl = canvas.getContext('webgl'); @@ -21,6 +23,7 @@ void main() { gl_Position = vec4(a_pos, 0.0, 1.0); } #extension GL_OES_standard_derivatives : enable precision highp float; uniform float u_time; +uniform float u_glitch; uniform vec2 u_res; #define COL_SKY_TOP vec3(0.04, 0.0, 0.12) @@ -56,20 +59,14 @@ float mountain(float x, float scale, float height, float offset) { return m * height * sideMask; } -float glitch(float y, float t) { - float gt = mod(t, 25.0); - float g1 = smoothstep(12.0, 12.05, gt) * smoothstep(12.25, 12.2, gt); - float g = g1; +float glitch(float y, float t, float g) { if (g < 0.01) return 0.0; float band = step(0.7, hash(vec2(floor(y * 30.0), floor(t * 20.0)))); float off = (hash(vec2(floor(y * 30.0), floor(t * 30.0))) - 0.5) * 0.06; return off * band * g; } -float glitchColor(float y, float t) { - float gt = mod(t, 25.0); - float g1 = smoothstep(12.0, 12.05, gt) * smoothstep(12.25, 12.2, gt); - float g = g1; +float glitchColor(float y, float t, float g) { float band = step(0.6, hash(vec2(floor(y * 25.0), floor(t * 15.0)))); return band * g; } @@ -79,7 +76,7 @@ void main() { float aspect = u_res.x / u_res.y; float t = u_time; - float gOff = glitch(uv.y, t); + float gOff = glitch(uv.y, t, u_glitch); uv.x += gOff; vec2 cuv = (uv - 0.5) * vec2(aspect, 1.0); @@ -170,7 +167,7 @@ void main() { float vignette = 1.0 - dot(vc * 0.5, vc * 0.5); col *= smoothstep(0.0, 0.7, vignette); - float gc = glitchColor(uv.y, t); + float gc = glitchColor(uv.y, t, u_glitch); col.r += gc * 0.15; col.b -= gc * 0.1; @@ -210,13 +207,52 @@ void main() { gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 0, 0); const uTime = gl.getUniformLocation(prog, 'u_time'); + const uGlitch = gl.getUniformLocation(prog, 'u_glitch'); const uRes = gl.getUniformLocation(prog, 'u_res'); - const start = performance.now(); - (function frame() { - gl.uniform1f(uTime, (performance.now() - start) / 1000); + const glitchDuration = 300; + let glitchStart = -glitchDuration; + let elapsed = 0; + let lastFrame = 0; + let raf = null; + + document.addEventListener('click', function() { + glitchStart = performance.now(); + }, true); + + function glitchAmount(now) { + const age = now - glitchStart; + if (age < 0 || age > glitchDuration) return 0; + return Math.sin((age / glitchDuration) * Math.PI); + } + + function frame(now) { + if (document.hidden) { + raf = null; + lastFrame = 0; + return; + } + + if (lastFrame) { + elapsed += Math.min((now - lastFrame) / 1000, 0.1); + } + lastFrame = now; + + gl.uniform1f(uTime, elapsed); + gl.uniform1f(uGlitch, glitchAmount(now)); gl.uniform2f(uRes, canvas.width, canvas.height); gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); - requestAnimationFrame(frame); - })(); + + raf = requestAnimationFrame(frame); + } + + function startAnimation() { + if (!raf && !document.hidden) { + lastFrame = 0; + raf = requestAnimationFrame(frame); + } + } + + document.addEventListener('visibilitychange', startAnimation); + startAnimation(); } diff --git a/regime.config.json b/regime.config.json index e588174..a5fd2ca 100644 --- a/regime.config.json +++ b/regime.config.json @@ -1,7 +1,8 @@ { "templates": [ "profile/workspace", - "profile/app/hypeup-static" + "profile/app/hypeup-static", + "!include/license" ], "vars": { "repo": "da.nfin.ch" diff --git a/scripts/build-cv.sh b/scripts/build-cv.sh deleted file mode 100755 index 722196e..0000000 --- a/scripts/build-cv.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -mkdir -p dist -thorium-browser \ - --headless=new \ - --no-sandbox \ - --disable-gpu \ - --virtual-time-budget=5000 \ - --align-pdf-default-print-settings-with-html \ - --print-to-pdf="dist/cv.pdf" \ - "http://localhost:5173/cv"