1. Sketch and Code
2. Overview
For this assignment, I created an interactive artwork featuring a grid of neon pink “needles” that respond dynamically to user input. The sketch utilizes vector math, coordinate transformations, and mapped interactive feedback.
3. Concept
The goal of this work was to explore the concept of a sort of “magnetic field” using geometric shapes. I wanted to create something that felt alive under my curser. The choice of a vibrant pink palette against a deep background was inspired by modern neon-noir visuals as I am somewhat interested in cyberpunk styles, and also my favourite color being pink.
4. Process and Methods
My process focused on moving from a rigid grid to a fluid, reactive environment. I broke the project down into three main layers:
-
- The grid: I used a nested for() loop to populate the canvas. By using a spacing variable, I ensured that the elements were perfectly aligned and easy to adjust.
- Trigonometric alignment: I used trigonometry to calculate the relationship between each grid point and the mouse to make it interactive. I used atan2() for this to determine the specific angle needed for each shape to face the mouse.
let angle = atan2(mouseY - y, mouseX - x);
-
- Visual mapping: I used the dist() function to measure how close each point is to the cursor, then used the map() function to link that distance to the stroke weight, length, and color intensity of the lines.
// Calculate how far each point is from the cursor let d = dist(mouseX, mouseY, x, y); // Use the distance (d) to drive the visuals // Closer to mouse = brighter color and thicker lines let pinkIntensity = map(d, 0, 400, 225, 50); let weight = map(d, 0, 400, 5, 1); let lineLen = map(d, 0, 400, 35, 10); // Set styles stroke(255, pinkIntensity, 220); // RGB: Pink variations
5. Technical Details
-
- I implemented push() and pop() within the loops, which allowed me to use translate() to move the origin to each grid point and rotate(). If not for this, every line would rotate around the top-left corner (0,0) of the screen rather than its own center.
- To achieve the motion blur effect, I set the transparency to be 30 in in the draw() loop, making it so that the previous frames don’t disappear immediately, leaving a trail behind the moving lines.
- Because the lines are drawn from a negative to positive value relative to the translated center, the rotation occurs perfectly around the midpoint of the line.
line(-lineLen, 0, lineLen, 0);
-
- The color is updated dynamically where, as the mouse moves closer, the green channel in RGB increases, shifting the color from a deep purple-pink to a bright, glowing, neon pink.
let pinkIntensity = map(d, 0, 400, 225, 50);
6. Reflection
This assignment developed my understanding of the transformation matrix (push, pop, translate, rotate). My biggest challenge was getting the rotation to feel natural; initially, the lines were spinning wildly, which was how I found the map() function, which helped me map the distance to the angle. Tiny adjustments to the mapping ranges completely changed the mood of my work.

