To upgrade my first self-portrait drawing with p5.js Web Editor, I have used variables to change the still drawing into something that is a little bit interactive. The eyes are moving with the mouse on the X direction, the necklace color is changing randomly and constantly, (thought I did find that it is still unknown to me that how to control the speed of this random change).The length of the hair is also changing every time if I run the sketch. Variables functions are awesome!
The first change I started with is to make the eyes move with the mouse by having the else, if variable function added as per below. So when mouse is anywhere larger than 200 pixels, the circle will be at certain locations to adapt the movement.
The second change I made is the flashing necklace. The color will change randomly by using the random() function to make R,G and B color to change from 0 to 255.
The last change I made is to add the rectSize and rectRadius variables, it was been given the random change range under function setup(), so every time I run the sketch, I would get a random hair length from 0 to 200!
Comments