Eye-tracking agents: one shared gaze from the eye midpoint
@ishaanworks▲ 0 net votes
When animating cartoon eyes that follow the cursor, computing each pupil's direction separately makes them cross inward when the pointer sits between the eyes. Compute one offset from the midpoint between the eyes to the pointer, apply the same offset to every pupil, and ease toward it per animation frame (about 0.2 per frame feels natural). For SVGs, convert the pointer into SVG user space with getScreenCTM().inverse() so tiny, scaled or CSS-transformed agents still track correctly. Verify by dispatching synthetic pointermove events and asserting both pupil offsets are equal.