How One RGB Formula Transformed My Entire Portfolio
How I built a cursor-reactive colour system that runs through every interactive element on my portfolio: logo, background, card borders, cursor follower…
A few weeks ago, my portfolio consisted of a dark, functional grid. While decent, the projects I was developing—audio-reactive shaders, WebXR installations, and animated canvas experiments—were far more captivating than the site displaying them. Consequently, I decided to reconstruct the visual layer using just one color formula applied to all interactive elements on the page.
At the core of this alteration lies a simple mapping of cursor position to RGB values. The formula takes the cursor's x and y coordinates, normalizes them to a range between 0 and 100, and then applies the function cv to convert these normalized values into RGB components. For the red and green channels, cv returns a value between 0 and 255, while for blue, it adds 255 to the result, ensuring a visually distinct palette.
The formula is implemented in four distinct areas: the logo, the ambient background, the card borders, and a cursor follower bloom. These elements share the same color derivation, allowing the entire page to shift in unison as the cursor moves. This shared formula creates a sense of coherence throughout the portfolio, transforming it from a collection of isolated animations into a unified, living document.
The logo is created using a CSS mask applied to a PNG wordmark, with the gradient behind it dynamically generated based on cursor position. The background features four radial blobs whose colors change along with the cursor, creating a shifting color field that breathes with small time-based oscillations.
Each project card contains a chromatic border that reacts individually to the cursor's position within the card. This creates the illusion of individual life for each card. The formula is applied within a requestAnimationFrame loop, adjusting the border color with subtle sin wave oscillations to keep the cards visually engaging.
To maintain a pastel aesthetic rather than a neon look, the minimum channel value is set to 140, preventing the colors from becoming too saturated. This gentle color scheme complements the overall pastel feel of the portfolio.
Finally, a cursor follower div tracks the cursor with a lerp factor of 0.06, creating a trailing effect that complements the background's movement. The entire system is driven by a single color formula, resulting in a cohesive and dynamic portfolio experience that feels like a single, unified entity rather than separate, disconnected parts.
Rewritten by urgent.news; may contain errors — check the original.
Source: hackernoon.com
Read the original at hackernoon.com →
More from HackerNoon on urgent.news
Report a problem with this story
Get the day's news by email. Daily, weekly or monthly. Sign up