How One RGB Formula Transformed My Entire Portfolio
A few weeks ago my portfolio was a clean dark grid. Nice enough, functional. But the projects I was building: audio-reactive shaders, WebXR installations, animated canvas experiments, were far more interesting than the site presenting them.
So I rebuilt the visual layer. Not with a design tool but in code, using one colour formula that runs through every interactive element on the page. Here's how it works.
The formula
The whole thing comes down to mapping cursor position to RGB:
const cv = (n: number) => Math.min(255, Math.floor((255 / 100) * n));const xPc = (e.clientX / window.innerWidth) * 100;const yPc = (e.clientY / window.innerHeight) * 100;const r = cv(xPc);const g = cv(yPc);const b = 255 - r;
Move left: blues dominate. Move right: reds and greens. Move down: green increases. The complement trick (255 - r for blue) keeps the palette from mudding into grey.
This same calculation runs in...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE