Building Interactive Mystic Shield
Turning a static robot-human shield image into a mouse-reactive p5.js experience.
The goal: make the existing shield feel dynamic without replacing the image.
This log documents the first interactive extension of Mystic Shield. Unlike mysticShield2.html, which draws the whole shield from geometry, this app begins with a finished image and overlays p5.js energy geometry that responds to mouse position.
Using the attached image as a background on a canvas, make an interactive app such that as a novice moves the mouse left and right and up and down, the software activates the image and makes it look as if it is responding in real time.
The p5 sketch calls image(bgImg, 0, 0, width, height) at the top of every frame. Everything interactive is layered above it with transparent strokes, additive blending, and HSB fire colors. The base image remains intact and inspectable.
Horizontal mouse position controls hue shift, slight tilt, and spark swirl. Vertical position creates lift and energy pressure. Proximity to the shield increases intensity. The mouse never has to touch a button; the whole canvas becomes the control surface.
The live canvas is the main event and appears above the source code. The source panel sits below it so novices can first experience the interaction, then inspect and copy the implementation.
The page provides three essentials for rebuilding the sketch in the p5.js editor: a visible source listing, a copy button powered by copyRaw(), and a download link for the base image aiRobotMentoringHuman.jpg.
The sketch now starts with bgImg = null and attempts to load images/aiRobotMentoringHuman.jpg using success and failure callbacks. If the file is unavailable, draw() uses background(0, 0, 20, 100) instead. This lets a novice paste the code into the p5.js editor and see the interactive shield geometry immediately, even before uploading the base image.
The local color variable was renamed from hue to myHue. p5.js already provides a hue() function, and shadowing that name can create confusing failures in the editor. The rule going forward: avoid naming custom variables after p5 API functions.